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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
52,300 | copress/copress-component-oauth2 | lib/oauth2.js | function (req, res, next) {
if (options.decisionPage) {
var urlObj = {
pathname: options.decisionPage,
query: {
transactionId: req.oauth2.transactionID,
userId: req.oauth2.user.id,
... | javascript | function (req, res, next) {
if (options.decisionPage) {
var urlObj = {
pathname: options.decisionPage,
query: {
transactionId: req.oauth2.transactionID,
userId: req.oauth2.user.id,
... | [
"function",
"(",
"req",
",",
"res",
",",
"next",
")",
"{",
"if",
"(",
"options",
".",
"decisionPage",
")",
"{",
"var",
"urlObj",
"=",
"{",
"pathname",
":",
"options",
".",
"decisionPage",
",",
"query",
":",
"{",
"transactionId",
":",
"req",
".",
"oau... | Now try to render the dialog to approve client app's request for permissions | [
"Now",
"try",
"to",
"render",
"the",
"dialog",
"to",
"approve",
"client",
"app",
"s",
"request",
"for",
"permissions"
] | 4819f379a0d42753bfd51e237c5c3aaddee37544 | https://github.com/copress/copress-component-oauth2/blob/4819f379a0d42753bfd51e237c5c3aaddee37544/lib/oauth2.js#L628-L649 | |
52,301 | copress/copress-component-oauth2 | lib/oauth2.js | clientLogin | function clientLogin(clientId, clientSecret, done) {
debug('clientLogin: %s', clientId);
clientId = parseInt(clientId);
if (!clientId && clientId !== 0) {
return done(null, false);
}
models.Clients.findByClientId(clientId, function (err, client) {
if (er... | javascript | function clientLogin(clientId, clientSecret, done) {
debug('clientLogin: %s', clientId);
clientId = parseInt(clientId);
if (!clientId && clientId !== 0) {
return done(null, false);
}
models.Clients.findByClientId(clientId, function (err, client) {
if (er... | [
"function",
"clientLogin",
"(",
"clientId",
",",
"clientSecret",
",",
"done",
")",
"{",
"debug",
"(",
"'clientLogin: %s'",
",",
"clientId",
")",
";",
"clientId",
"=",
"parseInt",
"(",
"clientId",
")",
";",
"if",
"(",
"!",
"clientId",
"&&",
"clientId",
"!==... | BasicStrategy & ClientPasswordStrategy
These strategies are used to authenticate registered OAuth clients. They are
employed to protect the `token` endpoint, which consumers use to obtain
access tokens. The OAuth 2.0 specification suggests that clients use the
HTTP Basic scheme to authenticate. Use of the client pa... | [
"BasicStrategy",
"&",
"ClientPasswordStrategy"
] | 4819f379a0d42753bfd51e237c5c3aaddee37544 | https://github.com/copress/copress-component-oauth2/blob/4819f379a0d42753bfd51e237c5c3aaddee37544/lib/oauth2.js#L708-L729 |
52,302 | blueskyfish/bluesky-logger | factory.js | function (namespaces) {
_.forEach(namespaces, function (level, namespace) {
cache.add(namespace, level);
});
return this;
} | javascript | function (namespaces) {
_.forEach(namespaces, function (level, namespace) {
cache.add(namespace, level);
});
return this;
} | [
"function",
"(",
"namespaces",
")",
"{",
"_",
".",
"forEach",
"(",
"namespaces",
",",
"function",
"(",
"level",
",",
"namespace",
")",
"{",
"cache",
".",
"add",
"(",
"namespace",
",",
"level",
")",
";",
"}",
")",
";",
"return",
"this",
";",
"}"
] | set the namespaces configuration.
Config object
```
{
'root': 'all',
'namespace1.namespace2': 'info',
}
```
**root** namespace is for all unknown namespaces.
@param {object} namespaces the map with the namespace and its log level
@return {self} | [
"set",
"the",
"namespaces",
"configuration",
"."
] | 87f7324e19222595fabfe9a8c9c5031f9546e16a | https://github.com/blueskyfish/bluesky-logger/blob/87f7324e19222595fabfe9a8c9c5031f9546e16a/factory.js#L33-L38 | |
52,303 | totorojs/totoro-logger | lib/console.js | function(level, title, format, filters, needstack, args) {
var msg = utils.format.apply(this, args)
var data = {
timestamp : dateFormat(new Date(), _config.dateformat),
message : msg,
title : title,
level : level,
args : args
}
... | javascript | function(level, title, format, filters, needstack, args) {
var msg = utils.format.apply(this, args)
var data = {
timestamp : dateFormat(new Date(), _config.dateformat),
message : msg,
title : title,
level : level,
args : args
}
... | [
"function",
"(",
"level",
",",
"title",
",",
"format",
",",
"filters",
",",
"needstack",
",",
"args",
")",
"{",
"var",
"msg",
"=",
"utils",
".",
"format",
".",
"apply",
"(",
"this",
",",
"args",
")",
"var",
"data",
"=",
"{",
"timestamp",
":",
"date... | main log method | [
"main",
"log",
"method"
] | 1865b681e40bcd4a956226a016bcca4c0339cd6e | https://github.com/totorojs/totoro-logger/blob/1865b681e40bcd4a956226a016bcca4c0339cd6e/lib/console.js#L26-L74 | |
52,304 | dutchenkoOleg/gulp-not-supported-file | index.js | withFilePath | function withFilePath (file, msg) {
if (file && file.path) {
msg += `\n ${file.path}`;
}
return msg;
} | javascript | function withFilePath (file, msg) {
if (file && file.path) {
msg += `\n ${file.path}`;
}
return msg;
} | [
"function",
"withFilePath",
"(",
"file",
",",
"msg",
")",
"{",
"if",
"(",
"file",
"&&",
"file",
".",
"path",
")",
"{",
"msg",
"+=",
"`",
"\\n",
"${",
"file",
".",
"path",
"}",
"`",
";",
"}",
"return",
"msg",
";",
"}"
] | Get msg with file path if exist
@param {File} file
@param {string} msg
@return {string}
@private | [
"Get",
"msg",
"with",
"file",
"path",
"if",
"exist"
] | 6a49c9df53bb3131828524eed71d30b73df36035 | https://github.com/dutchenkoOleg/gulp-not-supported-file/blob/6a49c9df53bb3131828524eed71d30b73df36035/index.js#L35-L40 |
52,305 | feedhenry/fh-mbaas-middleware | lib/middleware/forms.js | _createRequestParams | function _createRequestParams(params){
var resourcePath = params.resourcePath;
resourcePath = resourcePath.replace(":domain", params.domain)
.replace(":projectid", params.projectid)
.replace(":guid", params.appid);
log.logger.debug("Creating Request Params For Core ", params);
var coreHost = params.ap... | javascript | function _createRequestParams(params){
var resourcePath = params.resourcePath;
resourcePath = resourcePath.replace(":domain", params.domain)
.replace(":projectid", params.projectid)
.replace(":guid", params.appid);
log.logger.debug("Creating Request Params For Core ", params);
var coreHost = params.ap... | [
"function",
"_createRequestParams",
"(",
"params",
")",
"{",
"var",
"resourcePath",
"=",
"params",
".",
"resourcePath",
";",
"resourcePath",
"=",
"resourcePath",
".",
"replace",
"(",
"\":domain\"",
",",
"params",
".",
"domain",
")",
".",
"replace",
"(",
"\":pr... | Creating A Request To Supercore. Supercore will authenticate the app request. | [
"Creating",
"A",
"Request",
"To",
"Supercore",
".",
"Supercore",
"will",
"authenticate",
"the",
"app",
"request",
"."
] | f906e98efbb4b0963bf5137b34b5e0589ba24e69 | https://github.com/feedhenry/fh-mbaas-middleware/blob/f906e98efbb4b0963bf5137b34b5e0589ba24e69/lib/middleware/forms.js#L7-L29 |
52,306 | feedhenry/fh-mbaas-middleware | lib/middleware/forms.js | _createResponseHandler | function _createResponseHandler(req, next, skipDataResult){
return function(err, httpResponse, responseBody){
log.logger.debug("Performing Core Action ", req.url, err, httpResponse.statusCode, responseBody);
if(err || (httpResponse.statusCode !== 200 && httpResponse.statusCode !== 204)){
return next(er... | javascript | function _createResponseHandler(req, next, skipDataResult){
return function(err, httpResponse, responseBody){
log.logger.debug("Performing Core Action ", req.url, err, httpResponse.statusCode, responseBody);
if(err || (httpResponse.statusCode !== 200 && httpResponse.statusCode !== 204)){
return next(er... | [
"function",
"_createResponseHandler",
"(",
"req",
",",
"next",
",",
"skipDataResult",
")",
"{",
"return",
"function",
"(",
"err",
",",
"httpResponse",
",",
"responseBody",
")",
"{",
"log",
".",
"logger",
".",
"debug",
"(",
"\"Performing Core Action \"",
",",
"... | Utility function for creating response handlers
@param req
@param next
@returns {Function} | [
"Utility",
"function",
"for",
"creating",
"response",
"handlers"
] | f906e98efbb4b0963bf5137b34b5e0589ba24e69 | https://github.com/feedhenry/fh-mbaas-middleware/blob/f906e98efbb4b0963bf5137b34b5e0589ba24e69/lib/middleware/forms.js#L38-L55 |
52,307 | feedhenry/fh-mbaas-middleware | lib/middleware/forms.js | checkFormAssociation | function checkFormAssociation(req, res, next){
var requestedFormId = req.params.id;
req.appformsResultPayload = req.appformsResultPayload || {};
var formsAssociatedWithProject = req.appformsResultPayload.data || [];
var foundForm = _.find(formsAssociatedWithProject, function(formId){
return requestedFormId... | javascript | function checkFormAssociation(req, res, next){
var requestedFormId = req.params.id;
req.appformsResultPayload = req.appformsResultPayload || {};
var formsAssociatedWithProject = req.appformsResultPayload.data || [];
var foundForm = _.find(formsAssociatedWithProject, function(formId){
return requestedFormId... | [
"function",
"checkFormAssociation",
"(",
"req",
",",
"res",
",",
"next",
")",
"{",
"var",
"requestedFormId",
"=",
"req",
".",
"params",
".",
"id",
";",
"req",
".",
"appformsResultPayload",
"=",
"req",
".",
"appformsResultPayload",
"||",
"{",
"}",
";",
"var... | Middleware To Check That A Requested Form Exists
@param req
@param res
@param next | [
"Middleware",
"To",
"Check",
"That",
"A",
"Requested",
"Form",
"Exists"
] | f906e98efbb4b0963bf5137b34b5e0589ba24e69 | https://github.com/feedhenry/fh-mbaas-middleware/blob/f906e98efbb4b0963bf5137b34b5e0589ba24e69/lib/middleware/forms.js#L64-L79 |
52,308 | feedhenry/fh-mbaas-middleware | lib/middleware/forms.js | notifySubmissionComplete | function notifySubmissionComplete(req, res, next){
req.appformsResultPayload = req.appformsResultPayload || {};
var completeStatus = req.appformsResultPayload.data;
var submission = completeStatus.formSubmission;
//The Submission Is Not Complete, No need to send a notification.
if("complete" !== completeStat... | javascript | function notifySubmissionComplete(req, res, next){
req.appformsResultPayload = req.appformsResultPayload || {};
var completeStatus = req.appformsResultPayload.data;
var submission = completeStatus.formSubmission;
//The Submission Is Not Complete, No need to send a notification.
if("complete" !== completeStat... | [
"function",
"notifySubmissionComplete",
"(",
"req",
",",
"res",
",",
"next",
")",
"{",
"req",
".",
"appformsResultPayload",
"=",
"req",
".",
"appformsResultPayload",
"||",
"{",
"}",
";",
"var",
"completeStatus",
"=",
"req",
".",
"appformsResultPayload",
".",
"... | Function To Notify Core Platform That The Submission Is Complete. The core platform will send a mail to any subscribers.
@param req
@param res
@param next | [
"Function",
"To",
"Notify",
"Core",
"Platform",
"That",
"The",
"Submission",
"Is",
"Complete",
".",
"The",
"core",
"platform",
"will",
"send",
"a",
"mail",
"to",
"any",
"subscribers",
"."
] | f906e98efbb4b0963bf5137b34b5e0589ba24e69 | https://github.com/feedhenry/fh-mbaas-middleware/blob/f906e98efbb4b0963bf5137b34b5e0589ba24e69/lib/middleware/forms.js#L87-L110 |
52,309 | klovadis/redis-lua-helper | lib/index.js | replaceMacro | function replaceMacro(code) {
if (!re) return getKeys(code);
var match = code.match(re);
if (!match) return getKeys(code);
var includeFile = match[1];
includeFile = path.relative(self.config.root, path.join(path.dirname(fileName), includeFile));
self._parse(includeFile, function (err, includeCode) {
if... | javascript | function replaceMacro(code) {
if (!re) return getKeys(code);
var match = code.match(re);
if (!match) return getKeys(code);
var includeFile = match[1];
includeFile = path.relative(self.config.root, path.join(path.dirname(fileName), includeFile));
self._parse(includeFile, function (err, includeCode) {
if... | [
"function",
"replaceMacro",
"(",
"code",
")",
"{",
"if",
"(",
"!",
"re",
")",
"return",
"getKeys",
"(",
"code",
")",
";",
"var",
"match",
"=",
"code",
".",
"match",
"(",
"re",
")",
";",
"if",
"(",
"!",
"match",
")",
"return",
"getKeys",
"(",
"cod... | get included files | [
"get",
"included",
"files"
] | f23b82054b8ea3c08b7713c6f996fd6f43b55e04 | https://github.com/klovadis/redis-lua-helper/blob/f23b82054b8ea3c08b7713c6f996fd6f43b55e04/lib/index.js#L162-L178 |
52,310 | klovadis/redis-lua-helper | lib/index.js | done | function done(code) {
// calculate shasum and cache info
var shasum = crypto.createHash('sha1');
shasum.update(code);
self._shasums[scriptName] = shasum.digest('hex');
self._scripts[scriptName] = code;
self._files[fileName] = code;
// make dublicate entries for both script and script.lua
if (path.extna... | javascript | function done(code) {
// calculate shasum and cache info
var shasum = crypto.createHash('sha1');
shasum.update(code);
self._shasums[scriptName] = shasum.digest('hex');
self._scripts[scriptName] = code;
self._files[fileName] = code;
// make dublicate entries for both script and script.lua
if (path.extna... | [
"function",
"done",
"(",
"code",
")",
"{",
"// calculate shasum and cache info",
"var",
"shasum",
"=",
"crypto",
".",
"createHash",
"(",
"'sha1'",
")",
";",
"shasum",
".",
"update",
"(",
"code",
")",
";",
"self",
".",
"_shasums",
"[",
"scriptName",
"]",
"=... | file has been loaded | [
"file",
"has",
"been",
"loaded"
] | f23b82054b8ea3c08b7713c6f996fd6f43b55e04 | https://github.com/klovadis/redis-lua-helper/blob/f23b82054b8ea3c08b7713c6f996fd6f43b55e04/lib/index.js#L195-L213 |
52,311 | origin1tech/stiks | dist/exec.js | exec | function exec(cmd, args, options) {
// If true user wants stdout to output value
// instead of using inherit outputting
// to process.stdout stream.
if (options === true)
options = { stdio: 'pipe' };
options = chek_1.extend({}, spawnDefaults, options);
if (chek_1.isString(args))
... | javascript | function exec(cmd, args, options) {
// If true user wants stdout to output value
// instead of using inherit outputting
// to process.stdout stream.
if (options === true)
options = { stdio: 'pipe' };
options = chek_1.extend({}, spawnDefaults, options);
if (chek_1.isString(args))
... | [
"function",
"exec",
"(",
"cmd",
",",
"args",
",",
"options",
")",
"{",
"// If true user wants stdout to output value",
"// instead of using inherit outputting",
"// to process.stdout stream.",
"if",
"(",
"options",
"===",
"true",
")",
"options",
"=",
"{",
"stdio",
":",
... | Exec
Executes command using child process.
@param cmd node, npm or shell command to be executed.
@param args arguments to be passed to command.
@param options the child process spawn options. | [
"Exec",
"Executes",
"command",
"using",
"child",
"process",
"."
] | dca9cd352bb914e53e64e791fc85985aef3d9fb7 | https://github.com/origin1tech/stiks/blob/dca9cd352bb914e53e64e791fc85985aef3d9fb7/dist/exec.js#L54-L75 |
52,312 | SoftwarePlumbers/immutable-base | immutable.js | processArguments | function processArguments(props, args, defaults) {
debug('processArguments',props,args,defaults);
values = Object.assign({}, defaults);
let properties = Object.getOwnPropertyNames(values);
// First execute any single-arg functions to create dynamic defaults
for (property of properties) {
... | javascript | function processArguments(props, args, defaults) {
debug('processArguments',props,args,defaults);
values = Object.assign({}, defaults);
let properties = Object.getOwnPropertyNames(values);
// First execute any single-arg functions to create dynamic defaults
for (property of properties) {
... | [
"function",
"processArguments",
"(",
"props",
",",
"args",
",",
"defaults",
")",
"{",
"debug",
"(",
"'processArguments'",
",",
"props",
",",
"args",
",",
"defaults",
")",
";",
"values",
"=",
"Object",
".",
"assign",
"(",
"{",
"}",
",",
"defaults",
")",
... | Handle case where we have a single argument containing an object.
Basically, merge properties in args[0] into defaults, iff we have a single argument and it is an object. | [
"Handle",
"case",
"where",
"we",
"have",
"a",
"single",
"argument",
"containing",
"an",
"object",
"."
] | 3975c5e3ca30614916d3df0a262aeef229a1d538 | https://github.com/SoftwarePlumbers/immutable-base/blob/3975c5e3ca30614916d3df0a262aeef229a1d538/immutable.js#L10-L35 |
52,313 | SoftwarePlumbers/immutable-base | immutable.js | create | function create(defaults) {
let props = Object.getOwnPropertyNames(defaults);
/** Immutable class created from defaults.
*
*/
const immutableClass = class {
/** Constructor.
*
* Can take a single object argument, in which case the properties of the object are copied ov... | javascript | function create(defaults) {
let props = Object.getOwnPropertyNames(defaults);
/** Immutable class created from defaults.
*
*/
const immutableClass = class {
/** Constructor.
*
* Can take a single object argument, in which case the properties of the object are copied ov... | [
"function",
"create",
"(",
"defaults",
")",
"{",
"let",
"props",
"=",
"Object",
".",
"getOwnPropertyNames",
"(",
"defaults",
")",
";",
"/** Immutable class created from defaults.\n *\n */",
"const",
"immutableClass",
"=",
"class",
"{",
"/** Constructor.\n ... | Create an immutable class
The resulting class will have the supplied properties and defaults, a constructor, and setters
which return a copy of the instance they are applied to with the implied update in place.
Passing in { property: undefined } will ensure a setter is created for 'property' without creating a defaul... | [
"Create",
"an",
"immutable",
"class"
] | 3975c5e3ca30614916d3df0a262aeef229a1d538 | https://github.com/SoftwarePlumbers/immutable-base/blob/3975c5e3ca30614916d3df0a262aeef229a1d538/immutable.js#L47-L109 |
52,314 | SoftwarePlumbers/immutable-base | immutable.js | extend | function extend(to_extend, new_defaults = {}) {
let new_default_props = Object.getOwnPropertyNames(new_defaults);
let old_props = to_extend.getImmutablePropertyNames();
let new_props = new_default_props.filter(e => old_props.indexOf(e) < 0);
//let overriden_props = new_default_props.filter(e => old_pro... | javascript | function extend(to_extend, new_defaults = {}) {
let new_default_props = Object.getOwnPropertyNames(new_defaults);
let old_props = to_extend.getImmutablePropertyNames();
let new_props = new_default_props.filter(e => old_props.indexOf(e) < 0);
//let overriden_props = new_default_props.filter(e => old_pro... | [
"function",
"extend",
"(",
"to_extend",
",",
"new_defaults",
"=",
"{",
"}",
")",
"{",
"let",
"new_default_props",
"=",
"Object",
".",
"getOwnPropertyNames",
"(",
"new_defaults",
")",
";",
"let",
"old_props",
"=",
"to_extend",
".",
"getImmutablePropertyNames",
"(... | Extend an immutable class
The resulting class will have the supplied properties and defaults, a constructor, an additional setters
which return a copy of the instance they are applied to with the implied update in place.
Passing in { property: undefined } will ensure a setter is created for 'property' without creatin... | [
"Extend",
"an",
"immutable",
"class"
] | 3975c5e3ca30614916d3df0a262aeef229a1d538 | https://github.com/SoftwarePlumbers/immutable-base/blob/3975c5e3ca30614916d3df0a262aeef229a1d538/immutable.js#L122-L184 |
52,315 | tkesgar/sharo-next | index.js | withSharo | function withSharo(nextConfig = {}) {
// https://github.com/zeit/next-plugins/issues/320
const withMdx = require('@zeit/next-mdx')({
// Allow regular markdown files (*.md) to be imported.
extension: /\.mdx?$/
})
return (
withSass(withMdx(
Object.assign(
// ==============================... | javascript | function withSharo(nextConfig = {}) {
// https://github.com/zeit/next-plugins/issues/320
const withMdx = require('@zeit/next-mdx')({
// Allow regular markdown files (*.md) to be imported.
extension: /\.mdx?$/
})
return (
withSass(withMdx(
Object.assign(
// ==============================... | [
"function",
"withSharo",
"(",
"nextConfig",
"=",
"{",
"}",
")",
"{",
"// https://github.com/zeit/next-plugins/issues/320",
"const",
"withMdx",
"=",
"require",
"(",
"'@zeit/next-mdx'",
")",
"(",
"{",
"// Allow regular markdown files (*.md) to be imported.",
"extension",
":",... | This function is a Next.js plugin for sharo.
Features:
- Bundle analysis reporter via `@zeit/next-bundle-analyzer`
- MDX support via `@zeit/next-mdx`
- Web Workers transpilation support via `@zeit/next-workers`
- SASS/SCSS support via `@zeit/next-sass`
To generate bundle analysis report, provide `BUNDLE_ANALYZE` envi... | [
"This",
"function",
"is",
"a",
"Next",
".",
"js",
"plugin",
"for",
"sharo",
"."
] | ce4fbd45b418a50599deba5d129286b8691d1f72 | https://github.com/tkesgar/sharo-next/blob/ce4fbd45b418a50599deba5d129286b8691d1f72/index.js#L28-L67 |
52,316 | vmarkdown/vremark-parse | packages/vremark-toc/mdast-util-toc/lib/insert.js | insert | function insert(node, parent, tight) {
var children = parent.children;
var length = children.length;
var last = children[length - 1];
var isLoose = false;
var index;
var item;
if (node.depth === 1) {
item = listItem();
item.children.push({
type: PARAGRAPH,
... | javascript | function insert(node, parent, tight) {
var children = parent.children;
var length = children.length;
var last = children[length - 1];
var isLoose = false;
var index;
var item;
if (node.depth === 1) {
item = listItem();
item.children.push({
type: PARAGRAPH,
... | [
"function",
"insert",
"(",
"node",
",",
"parent",
",",
"tight",
")",
"{",
"var",
"children",
"=",
"parent",
".",
"children",
";",
"var",
"length",
"=",
"children",
".",
"length",
";",
"var",
"last",
"=",
"children",
"[",
"length",
"-",
"1",
"]",
";",... | Insert a `node` into a `parent`.
@param {Object} node - `node` to insert.
@param {Object} parent - Parent of `node`.
@param {boolean?} [tight] - Prefer tight list-items.
@return {undefined} | [
"Insert",
"a",
"node",
"into",
"a",
"parent",
"."
] | d7b353dcb5d021eeceb40f3c505ece893202db7a | https://github.com/vmarkdown/vremark-parse/blob/d7b353dcb5d021eeceb40f3c505ece893202db7a/packages/vremark-toc/mdast-util-toc/lib/insert.js#L31-L123 |
52,317 | molecuel/gridfs-uploader | lib/gfsupload.js | GFSupload | function GFSupload(mongoinst, prefix) {
this.mongo = mongoinst;
this.db = this.mongo.db;
this.Grid = this.mongo.Grid;
this.GridStore = this.mongo.GridStore;
this.ObjectID = this.mongo.ObjectID;
this.prefix = prefix || this.GridStore.DEFAULT_ROOT_COLLECTION;
return this;
} | javascript | function GFSupload(mongoinst, prefix) {
this.mongo = mongoinst;
this.db = this.mongo.db;
this.Grid = this.mongo.Grid;
this.GridStore = this.mongo.GridStore;
this.ObjectID = this.mongo.ObjectID;
this.prefix = prefix || this.GridStore.DEFAULT_ROOT_COLLECTION;
return this;
} | [
"function",
"GFSupload",
"(",
"mongoinst",
",",
"prefix",
")",
"{",
"this",
".",
"mongo",
"=",
"mongoinst",
";",
"this",
".",
"db",
"=",
"this",
".",
"mongo",
".",
"db",
";",
"this",
".",
"Grid",
"=",
"this",
".",
"mongo",
".",
"Grid",
";",
"this",... | This class enables gridfs uploads for all the mongoose users
@constructor
@param {Object} mongoose Mongoose Object from you application
@param {String} prefix Prefix for the database like "imports"
@author "Dominic Böttger" <Dominic.Boettger@inspirationlabs.com>
@return {Object} | [
"This",
"class",
"enables",
"gridfs",
"uploads",
"for",
"all",
"the",
"mongoose",
"users"
] | 3a0a97d70de39e348881f7eca34a99dd7408454f | https://github.com/molecuel/gridfs-uploader/blob/3a0a97d70de39e348881f7eca34a99dd7408454f/lib/gfsupload.js#L66-L74 |
52,318 | TheDustyard/SimplerDiscord | SimplerDiscord/index.js | function (name, guild) {
let emoji = guild.emojis.find('name', name);
if (emoji === undefined || emoji === null)
return name;
return `<:${name}:${emoji.id}>`;
} | javascript | function (name, guild) {
let emoji = guild.emojis.find('name', name);
if (emoji === undefined || emoji === null)
return name;
return `<:${name}:${emoji.id}>`;
} | [
"function",
"(",
"name",
",",
"guild",
")",
"{",
"let",
"emoji",
"=",
"guild",
".",
"emojis",
".",
"find",
"(",
"'name'",
",",
"name",
")",
";",
"if",
"(",
"emoji",
"===",
"undefined",
"||",
"emoji",
"===",
"null",
")",
"return",
"name",
";",
"retu... | METHODS
Gets an emoji
@returns {string} emoji
@param {string} name Name of the emoji
@param {Guild} guild Guild for the emoji | [
"METHODS",
"Gets",
"an",
"emoji"
] | fdbc854fa2d64d0637e9d4797d916a7494d88f62 | https://github.com/TheDustyard/SimplerDiscord/blob/fdbc854fa2d64d0637e9d4797d916a7494d88f62/SimplerDiscord/index.js#L32-L37 | |
52,319 | TheDustyard/SimplerDiscord | SimplerDiscord/index.js | function (name, guild) {
return guild.members.filter((item) => item.user.username.toLowerCase() === this.name.toLowerCase()).join();
} | javascript | function (name, guild) {
return guild.members.filter((item) => item.user.username.toLowerCase() === this.name.toLowerCase()).join();
} | [
"function",
"(",
"name",
",",
"guild",
")",
"{",
"return",
"guild",
".",
"members",
".",
"filter",
"(",
"(",
"item",
")",
"=>",
"item",
".",
"user",
".",
"username",
".",
"toLowerCase",
"(",
")",
"===",
"this",
".",
"name",
".",
"toLowerCase",
"(",
... | Gets a mention of a user
@returns {string} Mention
@param {string} name Name
@param {Guild} guild guild | [
"Gets",
"a",
"mention",
"of",
"a",
"user"
] | fdbc854fa2d64d0637e9d4797d916a7494d88f62 | https://github.com/TheDustyard/SimplerDiscord/blob/fdbc854fa2d64d0637e9d4797d916a7494d88f62/SimplerDiscord/index.js#L44-L46 | |
52,320 | TheDustyard/SimplerDiscord | SimplerDiscord/index.js | function (name, guild) {
return guild.channels.filter((item) => item.type === "text").filter((item) => item.name === this.name).join();
} | javascript | function (name, guild) {
return guild.channels.filter((item) => item.type === "text").filter((item) => item.name === this.name).join();
} | [
"function",
"(",
"name",
",",
"guild",
")",
"{",
"return",
"guild",
".",
"channels",
".",
"filter",
"(",
"(",
"item",
")",
"=>",
"item",
".",
"type",
"===",
"\"text\"",
")",
".",
"filter",
"(",
"(",
"item",
")",
"=>",
"item",
".",
"name",
"===",
... | Gets a mention of a channel
@returns {string} Mention
@param {string} name Name
@param {Guild} guild Guild | [
"Gets",
"a",
"mention",
"of",
"a",
"channel"
] | fdbc854fa2d64d0637e9d4797d916a7494d88f62 | https://github.com/TheDustyard/SimplerDiscord/blob/fdbc854fa2d64d0637e9d4797d916a7494d88f62/SimplerDiscord/index.js#L53-L55 | |
52,321 | redisjs/jsr-server | lib/command/database/zset/zrange.js | validate | function validate(cmd, args, info) {
AbstractCommand.prototype.validate.apply(this, arguments);
var withscores;
if(args.length > 3) {
withscores = ('' + args[3]).toLowerCase();
if(withscores !== Constants.ZSET.WITHSCORES) {
throw CommandSyntax;
}
args[3] = withscores;
}
} | javascript | function validate(cmd, args, info) {
AbstractCommand.prototype.validate.apply(this, arguments);
var withscores;
if(args.length > 3) {
withscores = ('' + args[3]).toLowerCase();
if(withscores !== Constants.ZSET.WITHSCORES) {
throw CommandSyntax;
}
args[3] = withscores;
}
} | [
"function",
"validate",
"(",
"cmd",
",",
"args",
",",
"info",
")",
"{",
"AbstractCommand",
".",
"prototype",
".",
"validate",
".",
"apply",
"(",
"this",
",",
"arguments",
")",
";",
"var",
"withscores",
";",
"if",
"(",
"args",
".",
"length",
">",
"3",
... | Validate the ZRANGE command. | [
"Validate",
"the",
"ZRANGE",
"command",
"."
] | 49413052d3039524fbdd2ade0ef9bae26cb4d647 | https://github.com/redisjs/jsr-server/blob/49413052d3039524fbdd2ade0ef9bae26cb4d647/lib/command/database/zset/zrange.js#L19-L29 |
52,322 | mattaschmann/simple-menu | lib/simplemenu.js | _printItem | function _printItem (item) {
switch(item.type) {
case 'option':
console.log(item.index + ': ' + item.label);
break;
case 'break':
for (var breakString = ''; breakString.length < item.charCount;) {
breakString += item.character;
}
console.log(breakString);
break;
... | javascript | function _printItem (item) {
switch(item.type) {
case 'option':
console.log(item.index + ': ' + item.label);
break;
case 'break':
for (var breakString = ''; breakString.length < item.charCount;) {
breakString += item.character;
}
console.log(breakString);
break;
... | [
"function",
"_printItem",
"(",
"item",
")",
"{",
"switch",
"(",
"item",
".",
"type",
")",
"{",
"case",
"'option'",
":",
"console",
".",
"log",
"(",
"item",
".",
"index",
"+",
"': '",
"+",
"item",
".",
"label",
")",
";",
"break",
";",
"case",
"'brea... | Utility function to print out an item in the array.
@param {Object} item An item in the array. | [
"Utility",
"function",
"to",
"print",
"out",
"an",
"item",
"in",
"the",
"array",
"."
] | 8b93869fba5c2ffade6d33a97784201797a1e793 | https://github.com/mattaschmann/simple-menu/blob/8b93869fba5c2ffade6d33a97784201797a1e793/lib/simplemenu.js#L106-L125 |
52,323 | inviqa/deck-task-registry | src/assets/buildImages.js | buildImages | function buildImages(conf, undertaker) {
const imageMinConfig = {
progressive: true,
svgoPlugins: [{
removeViewBox: false
}, {
cleanupIDs: true
}, {
cleanupAttrs: true
}]
};
const imageSrc = path.join(conf.themeConfig.root, conf.themeConfig.images.src,... | javascript | function buildImages(conf, undertaker) {
const imageMinConfig = {
progressive: true,
svgoPlugins: [{
removeViewBox: false
}, {
cleanupIDs: true
}, {
cleanupAttrs: true
}]
};
const imageSrc = path.join(conf.themeConfig.root, conf.themeConfig.images.src,... | [
"function",
"buildImages",
"(",
"conf",
",",
"undertaker",
")",
"{",
"const",
"imageMinConfig",
"=",
"{",
"progressive",
":",
"true",
",",
"svgoPlugins",
":",
"[",
"{",
"removeViewBox",
":",
"false",
"}",
",",
"{",
"cleanupIDs",
":",
"true",
"}",
",",
"{... | Build project images.
@param {ConfigParser} conf A configuration parser object.
@param {Undertaker} undertaker An Undertaker instance.
@returns {Stream} A stream of files. | [
"Build",
"project",
"images",
"."
] | 4c31787b978e9d99a47052e090d4589a50cd3015 | https://github.com/inviqa/deck-task-registry/blob/4c31787b978e9d99a47052e090d4589a50cd3015/src/assets/buildImages.js#L14-L34 |
52,324 | gethuman/jyt | lib/jyt.runtime.js | render | function render(element, opts) {
opts = opts || {};
var prepend = opts.prepend;
var model = opts.model || {};
var indentLevel = opts.indentLevel || 0;
var isPretty = opts.isPretty;
var jtPrintIndent = isPretty ? '\t' : '';
var jtPrintNewline = isPretty ? '\n' : '';
var indent = '', i, l... | javascript | function render(element, opts) {
opts = opts || {};
var prepend = opts.prepend;
var model = opts.model || {};
var indentLevel = opts.indentLevel || 0;
var isPretty = opts.isPretty;
var jtPrintIndent = isPretty ? '\t' : '';
var jtPrintNewline = isPretty ? '\n' : '';
var indent = '', i, l... | [
"function",
"render",
"(",
"element",
",",
"opts",
")",
"{",
"opts",
"=",
"opts",
"||",
"{",
"}",
";",
"var",
"prepend",
"=",
"opts",
".",
"prepend",
";",
"var",
"model",
"=",
"opts",
".",
"model",
"||",
"{",
"}",
";",
"var",
"indentLevel",
"=",
... | Take a jyt element and render it to an HTML string
@param element
@param opts | [
"Take",
"a",
"jyt",
"element",
"and",
"render",
"it",
"to",
"an",
"HTML",
"string"
] | 716be37e09217b4be917e179389f752212a428b3 | https://github.com/gethuman/jyt/blob/716be37e09217b4be917e179389f752212a428b3/lib/jyt.runtime.js#L27-L123 |
52,325 | gethuman/jyt | lib/jyt.runtime.js | addElemsToScope | function addElemsToScope(scope) {
var prop;
for (prop in elems) {
if (elems.hasOwnProperty(prop)) {
scope[prop] = elems[prop];
}
}
scope.elem = elem;
} | javascript | function addElemsToScope(scope) {
var prop;
for (prop in elems) {
if (elems.hasOwnProperty(prop)) {
scope[prop] = elems[prop];
}
}
scope.elem = elem;
} | [
"function",
"addElemsToScope",
"(",
"scope",
")",
"{",
"var",
"prop",
";",
"for",
"(",
"prop",
"in",
"elems",
")",
"{",
"if",
"(",
"elems",
".",
"hasOwnProperty",
"(",
"prop",
")",
")",
"{",
"scope",
"[",
"prop",
"]",
"=",
"elems",
"[",
"prop",
"]"... | Add all elements to the given scope
@param scope | [
"Add",
"all",
"elements",
"to",
"the",
"given",
"scope"
] | 716be37e09217b4be917e179389f752212a428b3 | https://github.com/gethuman/jyt/blob/716be37e09217b4be917e179389f752212a428b3/lib/jyt.runtime.js#L191-L199 |
52,326 | gethuman/jyt | lib/jyt.runtime.js | registerComponents | function registerComponents(elemNames) {
if (!elemNames) { return; }
var elemNameDashCase, elemNameCamelCase;
for (var i = 0; i < elemNames.length; i++) {
elemNameDashCase = elemNames[i];
elemNameCamelCase = utils.dashToCamelCase(elemNameDashCase);
elems[elemNameCamelCase] = makeEle... | javascript | function registerComponents(elemNames) {
if (!elemNames) { return; }
var elemNameDashCase, elemNameCamelCase;
for (var i = 0; i < elemNames.length; i++) {
elemNameDashCase = elemNames[i];
elemNameCamelCase = utils.dashToCamelCase(elemNameDashCase);
elems[elemNameCamelCase] = makeEle... | [
"function",
"registerComponents",
"(",
"elemNames",
")",
"{",
"if",
"(",
"!",
"elemNames",
")",
"{",
"return",
";",
"}",
"var",
"elemNameDashCase",
",",
"elemNameCamelCase",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"elemNames",
".",
"length"... | Given an array of element names, register the custom
elements so that a user can make them accessible
@param elemNames | [
"Given",
"an",
"array",
"of",
"element",
"names",
"register",
"the",
"custom",
"elements",
"so",
"that",
"a",
"user",
"can",
"make",
"them",
"accessible"
] | 716be37e09217b4be917e179389f752212a428b3 | https://github.com/gethuman/jyt/blob/716be37e09217b4be917e179389f752212a428b3/lib/jyt.runtime.js#L218-L227 |
52,327 | gethuman/jyt | lib/jyt.runtime.js | init | function init() {
var tagName;
for (var i = 0; i < allTags.length; i++) {
tagName = allTags[i];
elems[tagName] = makeElem(tagName);
}
} | javascript | function init() {
var tagName;
for (var i = 0; i < allTags.length; i++) {
tagName = allTags[i];
elems[tagName] = makeElem(tagName);
}
} | [
"function",
"init",
"(",
")",
"{",
"var",
"tagName",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"allTags",
".",
"length",
";",
"i",
"++",
")",
"{",
"tagName",
"=",
"allTags",
"[",
"i",
"]",
";",
"elems",
"[",
"tagName",
"]",
"=",
"... | Create functions for all standard HTML element | [
"Create",
"functions",
"for",
"all",
"standard",
"HTML",
"element"
] | 716be37e09217b4be917e179389f752212a428b3 | https://github.com/gethuman/jyt/blob/716be37e09217b4be917e179389f752212a428b3/lib/jyt.runtime.js#L232-L238 |
52,328 | staticbuild/staticbuild | index.js | getBundleMinIf | function getBundleMinIf(bundle, build, min) {
// Disable minification?
if (bundle.noMin)
return false;
// Glob filter paths to exlude and include files for minification.
// Start by excluding absolute paths of pre-minified files.
var minGlobs = lodash.map(min, function minAbsPath(relPath) {
return bui... | javascript | function getBundleMinIf(bundle, build, min) {
// Disable minification?
if (bundle.noMin)
return false;
// Glob filter paths to exlude and include files for minification.
// Start by excluding absolute paths of pre-minified files.
var minGlobs = lodash.map(min, function minAbsPath(relPath) {
return bui... | [
"function",
"getBundleMinIf",
"(",
"bundle",
",",
"build",
",",
"min",
")",
"{",
"// Disable minification?",
"if",
"(",
"bundle",
".",
"noMin",
")",
"return",
"false",
";",
"// Glob filter paths to exlude and include files for minification.",
"// Start by excluding absolute... | Returns a minIf value for a new bundle-info object.
@param {string} - Array of pre-minified source paths.
@returns {boolean|string} - The minIf value. | [
"Returns",
"a",
"minIf",
"value",
"for",
"a",
"new",
"bundle",
"-",
"info",
"object",
"."
] | 73891a9a719de46ba07c26a10ce36c43da34ff0e | https://github.com/staticbuild/staticbuild/blob/73891a9a719de46ba07c26a10ce36c43da34ff0e/index.js#L1485-L1501 |
52,329 | Nazariglez/perenquen | lib/pixi/src/core/sprites/Sprite.js | Sprite | function Sprite(texture)
{
Container.call(this);
/**
* The anchor sets the origin point of the texture.
* The default is 0,0 this means the texture's origin is the top left
* Setting the anchor to 0.5,0.5 means the texture's origin is centered
* Setting the anchor to 1,1 would mean the text... | javascript | function Sprite(texture)
{
Container.call(this);
/**
* The anchor sets the origin point of the texture.
* The default is 0,0 this means the texture's origin is the top left
* Setting the anchor to 0.5,0.5 means the texture's origin is centered
* Setting the anchor to 1,1 would mean the text... | [
"function",
"Sprite",
"(",
"texture",
")",
"{",
"Container",
".",
"call",
"(",
"this",
")",
";",
"/**\n * The anchor sets the origin point of the texture.\n * The default is 0,0 this means the texture's origin is the top left\n * Setting the anchor to 0.5,0.5 means the texture'... | The Sprite object is the base for all textured objects that are rendered to the screen
A sprite can be created directly from an image like this:
```js
var sprite = new PIXI.Sprite.fromImage('assets/image.png');
```
@class
@extends Container
@memberof PIXI
@param texture {Texture} The texture for this sprite | [
"The",
"Sprite",
"object",
"is",
"the",
"base",
"for",
"all",
"textured",
"objects",
"that",
"are",
"rendered",
"to",
"the",
"screen"
] | e023964d05afeefebdcac4e2044819fdfa3899ae | https://github.com/Nazariglez/perenquen/blob/e023964d05afeefebdcac4e2044819fdfa3899ae/lib/pixi/src/core/sprites/Sprite.js#L23-L94 |
52,330 | bholloway/browserify-esprima-tools | index.js | processSync | function processSync(filename, content, updater, format) {
var text = String(content);
// parse code to AST using esprima
var ast = esprima.parse(text, {
loc : true,
comment: true,
source : filename
});
// sort nodes before changing the source-map
var sorted = orderNodes(ast);
// associa... | javascript | function processSync(filename, content, updater, format) {
var text = String(content);
// parse code to AST using esprima
var ast = esprima.parse(text, {
loc : true,
comment: true,
source : filename
});
// sort nodes before changing the source-map
var sorted = orderNodes(ast);
// associa... | [
"function",
"processSync",
"(",
"filename",
",",
"content",
",",
"updater",
",",
"format",
")",
"{",
"var",
"text",
"=",
"String",
"(",
"content",
")",
";",
"// parse code to AST using esprima",
"var",
"ast",
"=",
"esprima",
".",
"parse",
"(",
"text",
",",
... | Synchronously process the given content and apply the updater function on its AST then output with the given format.
@throws {Error} Esprima parse error or updater error
@param {string} filename The name of the file that contains the given content
@param {*} content The text content to parse
@param {function} updater A... | [
"Synchronously",
"process",
"the",
"given",
"content",
"and",
"apply",
"the",
"updater",
"function",
"on",
"its",
"AST",
"then",
"output",
"with",
"the",
"given",
"format",
"."
] | a6f248ba3b486f6f7b1dbe27539dd139ede3df6a | https://github.com/bholloway/browserify-esprima-tools/blob/a6f248ba3b486f6f7b1dbe27539dd139ede3df6a/index.js#L82-L127 |
52,331 | bholloway/browserify-esprima-tools | index.js | depthFirst | function depthFirst(node, parent) {
var results = [];
if (node && (typeof node === 'object')) {
// valid node so push it to the list and set new parent
// don't overwrite parent if one was not given
if ('type' in node) {
if (parent !== undefined) {
node.parent = parent;
}
par... | javascript | function depthFirst(node, parent) {
var results = [];
if (node && (typeof node === 'object')) {
// valid node so push it to the list and set new parent
// don't overwrite parent if one was not given
if ('type' in node) {
if (parent !== undefined) {
node.parent = parent;
}
par... | [
"function",
"depthFirst",
"(",
"node",
",",
"parent",
")",
"{",
"var",
"results",
"=",
"[",
"]",
";",
"if",
"(",
"node",
"&&",
"(",
"typeof",
"node",
"===",
"'object'",
")",
")",
"{",
"// valid node so push it to the list and set new parent",
"// don't overwrit... | List the given node and all children, depth first.
@param {object} node An esprima node
@param {object|undefined} [parent] The parent of the given node, where known
@returns {Array} A list of nodes | [
"List",
"the",
"given",
"node",
"and",
"all",
"children",
"depth",
"first",
"."
] | a6f248ba3b486f6f7b1dbe27539dd139ede3df6a | https://github.com/bholloway/browserify-esprima-tools/blob/a6f248ba3b486f6f7b1dbe27539dd139ede3df6a/index.js#L149-L174 |
52,332 | bholloway/browserify-esprima-tools | index.js | breadthFirst | function breadthFirst(node, parent) {
var results = [];
if (node && (typeof node === 'object')) {
// begin the queue with the given node
var queue = [{node:node, parent:parent}];
while (queue.length) {
// pull the next item from the front of the queue
var item = queue.shift();
node ... | javascript | function breadthFirst(node, parent) {
var results = [];
if (node && (typeof node === 'object')) {
// begin the queue with the given node
var queue = [{node:node, parent:parent}];
while (queue.length) {
// pull the next item from the front of the queue
var item = queue.shift();
node ... | [
"function",
"breadthFirst",
"(",
"node",
",",
"parent",
")",
"{",
"var",
"results",
"=",
"[",
"]",
";",
"if",
"(",
"node",
"&&",
"(",
"typeof",
"node",
"===",
"'object'",
")",
")",
"{",
"// begin the queue with the given node",
"var",
"queue",
"=",
"[",
... | List the given node and all children, breadth first.
@param {object} node An esprima node
@param {object|undefined} [parent] The parent of the given node, where known
@returns {Array} A list of nodes | [
"List",
"the",
"given",
"node",
"and",
"all",
"children",
"breadth",
"first",
"."
] | a6f248ba3b486f6f7b1dbe27539dd139ede3df6a | https://github.com/bholloway/browserify-esprima-tools/blob/a6f248ba3b486f6f7b1dbe27539dd139ede3df6a/index.js#L182-L220 |
52,333 | bholloway/browserify-esprima-tools | index.js | nodeSplicer | function nodeSplicer(candidate, offset) {
offset = offset || 0;
return function setter(value) {
var found = findReferrer(candidate);
if (found) {
var key = found.key;
var obj = found.object;
var array = Array.isArray(obj) && obj;
if (!array) {
obj[key] = value;
}
... | javascript | function nodeSplicer(candidate, offset) {
offset = offset || 0;
return function setter(value) {
var found = findReferrer(candidate);
if (found) {
var key = found.key;
var obj = found.object;
var array = Array.isArray(obj) && obj;
if (!array) {
obj[key] = value;
}
... | [
"function",
"nodeSplicer",
"(",
"candidate",
",",
"offset",
")",
"{",
"offset",
"=",
"offset",
"||",
"0",
";",
"return",
"function",
"setter",
"(",
"value",
")",
"{",
"var",
"found",
"=",
"findReferrer",
"(",
"candidate",
")",
";",
"if",
"(",
"found",
... | Create a setter that will replace the given node or insert relative to it.
@param {object} candidate An esprima AST node to match
@param {number|function} [offset] 0 to replace, -1 to insert before node, +1 to insert after node
@returns {function|null} A setter that will replace the given node or do nothing if not vali... | [
"Create",
"a",
"setter",
"that",
"will",
"replace",
"the",
"given",
"node",
"or",
"insert",
"relative",
"to",
"it",
"."
] | a6f248ba3b486f6f7b1dbe27539dd139ede3df6a | https://github.com/bholloway/browserify-esprima-tools/blob/a6f248ba3b486f6f7b1dbe27539dd139ede3df6a/index.js#L228-L252 |
52,334 | bholloway/browserify-esprima-tools | index.js | compareLocation | function compareLocation(nodeA, nodeB) {
var locA = nodeA && nodeA.loc;
var locB = nodeB && nodeB.loc;
if (!locA && !locB) {
return 0;
}
else if (Boolean(locA) !== Boolean(locB)) {
return locA ? +1 : locB ? -1 : 0;
}
else {
var result =
isOrdered(locB.end, locA.start) ? +1 : isOrdered(... | javascript | function compareLocation(nodeA, nodeB) {
var locA = nodeA && nodeA.loc;
var locB = nodeB && nodeB.loc;
if (!locA && !locB) {
return 0;
}
else if (Boolean(locA) !== Boolean(locB)) {
return locA ? +1 : locB ? -1 : 0;
}
else {
var result =
isOrdered(locB.end, locA.start) ? +1 : isOrdered(... | [
"function",
"compareLocation",
"(",
"nodeA",
",",
"nodeB",
")",
"{",
"var",
"locA",
"=",
"nodeA",
"&&",
"nodeA",
".",
"loc",
";",
"var",
"locB",
"=",
"nodeB",
"&&",
"nodeB",
".",
"loc",
";",
"if",
"(",
"!",
"locA",
"&&",
"!",
"locB",
")",
"{",
"r... | Compare function for nodes with location.
@param {object} nodeA First node
@param {object} nodeB Second node
@returns {number} -1 where a follows b, +1 where b follows a, 0 otherwise | [
"Compare",
"function",
"for",
"nodes",
"with",
"location",
"."
] | a6f248ba3b486f6f7b1dbe27539dd139ede3df6a | https://github.com/bholloway/browserify-esprima-tools/blob/a6f248ba3b486f6f7b1dbe27539dd139ede3df6a/index.js#L289-L306 |
52,335 | bholloway/browserify-esprima-tools | index.js | isOrdered | function isOrdered(tupleA, tupleB) {
return (tupleA.line < tupleB.line) || ((tupleA.line === tupleB.line) && (tupleA.column < tupleB.column));
} | javascript | function isOrdered(tupleA, tupleB) {
return (tupleA.line < tupleB.line) || ((tupleA.line === tupleB.line) && (tupleA.column < tupleB.column));
} | [
"function",
"isOrdered",
"(",
"tupleA",
",",
"tupleB",
")",
"{",
"return",
"(",
"tupleA",
".",
"line",
"<",
"tupleB",
".",
"line",
")",
"||",
"(",
"(",
"tupleA",
".",
"line",
"===",
"tupleB",
".",
"line",
")",
"&&",
"(",
"tupleA",
".",
"column",
"<... | Check the order of the given location tuples.
@param {{line:number, column:number}} tupleA The first tuple
@param {{line:number, column:number}} tupleB The second tuple
@returns {boolean} True where tupleA precedes tupleB | [
"Check",
"the",
"order",
"of",
"the",
"given",
"location",
"tuples",
"."
] | a6f248ba3b486f6f7b1dbe27539dd139ede3df6a | https://github.com/bholloway/browserify-esprima-tools/blob/a6f248ba3b486f6f7b1dbe27539dd139ede3df6a/index.js#L314-L316 |
52,336 | bholloway/browserify-esprima-tools | index.js | compareIndex | function compareIndex(nodeA, nodeB) {
var indexA = nodeA && nodeA.sortIndex;
var indexB = nodeB && nodeB.sortIndex;
if (!indexA && !indexB) {
return 0;
}
else if (Boolean(indexA) !== Boolean(indexB)) {
return indexA ? +1 : indexB ? -1 : 0;
}
else {
return indexA - indexB;
}
} | javascript | function compareIndex(nodeA, nodeB) {
var indexA = nodeA && nodeA.sortIndex;
var indexB = nodeB && nodeB.sortIndex;
if (!indexA && !indexB) {
return 0;
}
else if (Boolean(indexA) !== Boolean(indexB)) {
return indexA ? +1 : indexB ? -1 : 0;
}
else {
return indexA - indexB;
}
} | [
"function",
"compareIndex",
"(",
"nodeA",
",",
"nodeB",
")",
"{",
"var",
"indexA",
"=",
"nodeA",
"&&",
"nodeA",
".",
"sortIndex",
";",
"var",
"indexB",
"=",
"nodeB",
"&&",
"nodeB",
".",
"sortIndex",
";",
"if",
"(",
"!",
"indexA",
"&&",
"!",
"indexB",
... | Compare function for nodes with sort-index.
@param {object} nodeA First node
@param {object} nodeB Second node
@returns {number} -1 where a follows b, +1 where b follows a, 0 otherwise | [
"Compare",
"function",
"for",
"nodes",
"with",
"sort",
"-",
"index",
"."
] | a6f248ba3b486f6f7b1dbe27539dd139ede3df6a | https://github.com/bholloway/browserify-esprima-tools/blob/a6f248ba3b486f6f7b1dbe27539dd139ede3df6a/index.js#L324-L336 |
52,337 | bholloway/browserify-esprima-tools | index.js | findReferrer | function findReferrer(candidate, container) {
var result;
if (candidate) {
// initially for the parent of the candidate node
container = container || candidate.parent;
// consider keys in the node until we have a result
var keys = getKeys(container);
for (var i = 0; !result && (i < keys.length... | javascript | function findReferrer(candidate, container) {
var result;
if (candidate) {
// initially for the parent of the candidate node
container = container || candidate.parent;
// consider keys in the node until we have a result
var keys = getKeys(container);
for (var i = 0; !result && (i < keys.length... | [
"function",
"findReferrer",
"(",
"candidate",
",",
"container",
")",
"{",
"var",
"result",
";",
"if",
"(",
"candidate",
")",
"{",
"// initially for the parent of the candidate node",
"container",
"=",
"container",
"||",
"candidate",
".",
"parent",
";",
"// consider ... | Find the object and field that refers to the given node.
@param {object} candidate An esprima AST node to match
@param {object} [container] Optional container to search within or the candidate parent where omitted
@returns {{object:object, key:*}} The object and its key where the candidate node is a value | [
"Find",
"the",
"object",
"and",
"field",
"that",
"refers",
"to",
"the",
"given",
"node",
"."
] | a6f248ba3b486f6f7b1dbe27539dd139ede3df6a | https://github.com/bholloway/browserify-esprima-tools/blob/a6f248ba3b486f6f7b1dbe27539dd139ede3df6a/index.js#L357-L388 |
52,338 | bholloway/browserify-esprima-tools | index.js | getKeys | function getKeys(container) {
function arrayIndex(value, i) {
return i;
}
if (typeof container === 'object') {
return Array.isArray(container) ? container.map(arrayIndex) : Object.keys(container);
} else {
return [];
}
} | javascript | function getKeys(container) {
function arrayIndex(value, i) {
return i;
}
if (typeof container === 'object') {
return Array.isArray(container) ? container.map(arrayIndex) : Object.keys(container);
} else {
return [];
}
} | [
"function",
"getKeys",
"(",
"container",
")",
"{",
"function",
"arrayIndex",
"(",
"value",
",",
"i",
")",
"{",
"return",
"i",
";",
"}",
"if",
"(",
"typeof",
"container",
"===",
"'object'",
")",
"{",
"return",
"Array",
".",
"isArray",
"(",
"container",
... | Get the keys of an object as strings or those of an array as integers.
@param {object|Array} container A hash or array
@returns {Array.<string|number>} The keys of the container | [
"Get",
"the",
"keys",
"of",
"an",
"object",
"as",
"strings",
"or",
"those",
"of",
"an",
"array",
"as",
"integers",
"."
] | a6f248ba3b486f6f7b1dbe27539dd139ede3df6a | https://github.com/bholloway/browserify-esprima-tools/blob/a6f248ba3b486f6f7b1dbe27539dd139ede3df6a/index.js#L395-L404 |
52,339 | andrevinsky/redux-actions-sequences | src/index.js | tagResultFunction | function tagResultFunction(fn, tokenDescription, replacement) {
const description = tag(fn);
if (description) {
tokenDescription = description.replace(tokenDescription, replacement);
}
tag(fn, tokenDescription);
fn.toString = tokenToString;
return fn;
} | javascript | function tagResultFunction(fn, tokenDescription, replacement) {
const description = tag(fn);
if (description) {
tokenDescription = description.replace(tokenDescription, replacement);
}
tag(fn, tokenDescription);
fn.toString = tokenToString;
return fn;
} | [
"function",
"tagResultFunction",
"(",
"fn",
",",
"tokenDescription",
",",
"replacement",
")",
"{",
"const",
"description",
"=",
"tag",
"(",
"fn",
")",
";",
"if",
"(",
"description",
")",
"{",
"tokenDescription",
"=",
"description",
".",
"replace",
"(",
"toke... | Internal utility function that wraps result function
@param fn
@param tokenDescription
@param replacement
@returns {*} | [
"Internal",
"utility",
"function",
"that",
"wraps",
"result",
"function"
] | 1357fce58c674c106d4d850f3fa0bca9c2359c6b | https://github.com/andrevinsky/redux-actions-sequences/blob/1357fce58c674c106d4d850f3fa0bca9c2359c6b/src/index.js#L106-L116 |
52,340 | inviqa/deck-task-registry | src/helpers/findRoot.js | findRoot | function findRoot() {
let rootPath;
try {
rootPath = glob.sync('../**/Drupal.php', {ignore: ['../vendor/**', '../node_modules/**']});
} catch (err) {
throw new Error('No Drupal root found.');
}
// If we found no results for Drupal.php..then bomb out.
if (rootPath.length === 0) {
throw new Err... | javascript | function findRoot() {
let rootPath;
try {
rootPath = glob.sync('../**/Drupal.php', {ignore: ['../vendor/**', '../node_modules/**']});
} catch (err) {
throw new Error('No Drupal root found.');
}
// If we found no results for Drupal.php..then bomb out.
if (rootPath.length === 0) {
throw new Err... | [
"function",
"findRoot",
"(",
")",
"{",
"let",
"rootPath",
";",
"try",
"{",
"rootPath",
"=",
"glob",
".",
"sync",
"(",
"'../**/Drupal.php'",
",",
"{",
"ignore",
":",
"[",
"'../vendor/**'",
",",
"'../node_modules/**'",
"]",
"}",
")",
";",
"}",
"catch",
"("... | Find the root of a Drupal project.
@throws {Error} Thrown if no Drupal root was found.
@returns {String} The root to the Drupal installation from tools root. | [
"Find",
"the",
"root",
"of",
"a",
"Drupal",
"project",
"."
] | 4c31787b978e9d99a47052e090d4589a50cd3015 | https://github.com/inviqa/deck-task-registry/blob/4c31787b978e9d99a47052e090d4589a50cd3015/src/helpers/findRoot.js#L13-L41 |
52,341 | LeoYehTW/data-service | public/js/xeditable.js | function(name) {
var i;
if (this.$editables.length) {
//activate by name
if (angular.isString(name)) {
for(i=0; i<this.$editables.length; i++) {
if (this.$editables[i].name === name) {
this.$editables[i].activate();
return;
}
... | javascript | function(name) {
var i;
if (this.$editables.length) {
//activate by name
if (angular.isString(name)) {
for(i=0; i<this.$editables.length; i++) {
if (this.$editables[i].name === name) {
this.$editables[i].activate();
return;
}
... | [
"function",
"(",
"name",
")",
"{",
"var",
"i",
";",
"if",
"(",
"this",
".",
"$editables",
".",
"length",
")",
"{",
"//activate by name",
"if",
"(",
"angular",
".",
"isString",
"(",
"name",
")",
")",
"{",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
... | Sets focus on form field specified by `name`.
@method $activate(name)
@param {string} name name of field
@memberOf editable-form | [
"Sets",
"focus",
"on",
"form",
"field",
"specified",
"by",
"name",
"."
] | b55871663c2aacf2e3bd61c397987fa5bbedbc8d | https://github.com/LeoYehTW/data-service/blob/b55871663c2aacf2e3bd61c397987fa5bbedbc8d/public/js/xeditable.js#L974-L998 | |
52,342 | gethuman/pancakes-recipe | middleware/mw.auth.token.js | getUserForToken | function getUserForToken(decodedToken) {
var userId = decodedToken._id;
var authToken = decodedToken.authToken;
var cacheKey = userId + authToken;
var conditions = {
caller: userService.admin,
where: { _id: userId, authToken: authToken, status: 'created' },
... | javascript | function getUserForToken(decodedToken) {
var userId = decodedToken._id;
var authToken = decodedToken.authToken;
var cacheKey = userId + authToken;
var conditions = {
caller: userService.admin,
where: { _id: userId, authToken: authToken, status: 'created' },
... | [
"function",
"getUserForToken",
"(",
"decodedToken",
")",
"{",
"var",
"userId",
"=",
"decodedToken",
".",
"_id",
";",
"var",
"authToken",
"=",
"decodedToken",
".",
"authToken",
";",
"var",
"cacheKey",
"=",
"userId",
"+",
"authToken",
";",
"var",
"conditions",
... | Get a user for a particular token
@param decodedToken
@returns {*} | [
"Get",
"a",
"user",
"for",
"a",
"particular",
"token"
] | ea3feb8839e2edaf1b4577c052b8958953db4498 | https://github.com/gethuman/pancakes-recipe/blob/ea3feb8839e2edaf1b4577c052b8958953db4498/middleware/mw.auth.token.js#L16-L46 |
52,343 | gethuman/pancakes-recipe | middleware/mw.auth.token.js | validateToken | function validateToken(req, reply) {
var authorization = req.headers.authorization;
if (!authorization) {
return reply.continue();
}
// this is hack fix so that localStorage and cookies can either have Bearer or not
// if in local storate, it is serialized, so need t... | javascript | function validateToken(req, reply) {
var authorization = req.headers.authorization;
if (!authorization) {
return reply.continue();
}
// this is hack fix so that localStorage and cookies can either have Bearer or not
// if in local storate, it is serialized, so need t... | [
"function",
"validateToken",
"(",
"req",
",",
"reply",
")",
"{",
"var",
"authorization",
"=",
"req",
".",
"headers",
".",
"authorization",
";",
"if",
"(",
"!",
"authorization",
")",
"{",
"return",
"reply",
".",
"continue",
"(",
")",
";",
"}",
"// this is... | Attempt to find a user for a given token. There will be an error if the
Authorization header is invalid, but if it doesn't exist or the user
can't be found, no error because we let Fakeblock ACLs determine whether
transaction can be anonymous.
@param req
@param reply | [
"Attempt",
"to",
"find",
"a",
"user",
"for",
"a",
"given",
"token",
".",
"There",
"will",
"be",
"an",
"error",
"if",
"the",
"Authorization",
"header",
"is",
"invalid",
"but",
"if",
"it",
"doesn",
"t",
"exist",
"or",
"the",
"user",
"can",
"t",
"be",
"... | ea3feb8839e2edaf1b4577c052b8958953db4498 | https://github.com/gethuman/pancakes-recipe/blob/ea3feb8839e2edaf1b4577c052b8958953db4498/middleware/mw.auth.token.js#L57-L102 |
52,344 | gethuman/pancakes-recipe | middleware/mw.auth.token.js | init | function init(ctx) {
var server = ctx.server;
if (!privateKey) {
throw new Error('Please set config.security.token.privateKey');
}
server.ext('onPreAuth', validateToken);
return new Q(ctx);
} | javascript | function init(ctx) {
var server = ctx.server;
if (!privateKey) {
throw new Error('Please set config.security.token.privateKey');
}
server.ext('onPreAuth', validateToken);
return new Q(ctx);
} | [
"function",
"init",
"(",
"ctx",
")",
"{",
"var",
"server",
"=",
"ctx",
".",
"server",
";",
"if",
"(",
"!",
"privateKey",
")",
"{",
"throw",
"new",
"Error",
"(",
"'Please set config.security.token.privateKey'",
")",
";",
"}",
"server",
".",
"ext",
"(",
"'... | Register the hapi auth strategy
@param ctx | [
"Register",
"the",
"hapi",
"auth",
"strategy"
] | ea3feb8839e2edaf1b4577c052b8958953db4498 | https://github.com/gethuman/pancakes-recipe/blob/ea3feb8839e2edaf1b4577c052b8958953db4498/middleware/mw.auth.token.js#L109-L119 |
52,345 | redisjs/jsr-server | lib/command/transaction/unwatch.js | execute | function execute(req, res) {
req.conn.unwatch(req.db);
res.send(null, Constants.OK);
} | javascript | function execute(req, res) {
req.conn.unwatch(req.db);
res.send(null, Constants.OK);
} | [
"function",
"execute",
"(",
"req",
",",
"res",
")",
"{",
"req",
".",
"conn",
".",
"unwatch",
"(",
"req",
".",
"db",
")",
";",
"res",
".",
"send",
"(",
"null",
",",
"Constants",
".",
"OK",
")",
";",
"}"
] | Respond to the UNWATCH command. | [
"Respond",
"to",
"the",
"UNWATCH",
"command",
"."
] | 49413052d3039524fbdd2ade0ef9bae26cb4d647 | https://github.com/redisjs/jsr-server/blob/49413052d3039524fbdd2ade0ef9bae26cb4d647/lib/command/transaction/unwatch.js#L19-L22 |
52,346 | noderaider/redux-addons | lib/dispatcher.js | getLibStateAccessor | function getLibStateAccessor(libState) {
/** The current state name */
return { get actionName() {
return libState.actionName;
}
/** Is in idle state (no more states to progress to) */
, get isIdle() {
return libState.isIdle;
}
/** State can be pau... | javascript | function getLibStateAccessor(libState) {
/** The current state name */
return { get actionName() {
return libState.actionName;
}
/** Is in idle state (no more states to progress to) */
, get isIdle() {
return libState.isIdle;
}
/** State can be pau... | [
"function",
"getLibStateAccessor",
"(",
"libState",
")",
"{",
"/** The current state name */",
"return",
"{",
"get",
"actionName",
"(",
")",
"{",
"return",
"libState",
".",
"actionName",
";",
"}",
"/** Is in idle state (no more states to progress to) */",
",",
"get",
"i... | ABSTRACTS ACCESS TO STATE VIA GETTERS | [
"ABSTRACTS",
"ACCESS",
"TO",
"STATE",
"VIA",
"GETTERS"
] | 7b11262b5a89039e7d96e47b8391840e72510fe1 | https://github.com/noderaider/redux-addons/blob/7b11262b5a89039e7d96e47b8391840e72510fe1/lib/dispatcher.js#L118-L144 |
52,347 | noderaider/redux-addons | lib/dispatcher.js | _shouldActivityUpdate | function _shouldActivityUpdate(_ref5) {
var type = _ref5.type;
var pageX = _ref5.pageX;
var pageY = _ref5.pageY;
if (type !== 'mousemove') return true;
var _stores$fast = stores.fast;
var lastActive = _stores$fast.lastActive;
var _stores$fast$lastEven = _stores$fast.lastEvent... | javascript | function _shouldActivityUpdate(_ref5) {
var type = _ref5.type;
var pageX = _ref5.pageX;
var pageY = _ref5.pageY;
if (type !== 'mousemove') return true;
var _stores$fast = stores.fast;
var lastActive = _stores$fast.lastActive;
var _stores$fast$lastEven = _stores$fast.lastEvent... | [
"function",
"_shouldActivityUpdate",
"(",
"_ref5",
")",
"{",
"var",
"type",
"=",
"_ref5",
".",
"type",
";",
"var",
"pageX",
"=",
"_ref5",
".",
"pageX",
";",
"var",
"pageY",
"=",
"_ref5",
".",
"pageY",
";",
"if",
"(",
"type",
"!==",
"'mousemove'",
")",
... | Detects whether the activity should trigger a redux update | [
"Detects",
"whether",
"the",
"activity",
"should",
"trigger",
"a",
"redux",
"update"
] | 7b11262b5a89039e7d96e47b8391840e72510fe1 | https://github.com/noderaider/redux-addons/blob/7b11262b5a89039e7d96e47b8391840e72510fe1/lib/dispatcher.js#L222-L243 |
52,348 | noderaider/redux-addons | lib/dispatcher.js | onActivity | function onActivity(e) {
if (!_shouldActivityUpdate(e)) return;
if (_shouldRestart()) return dispatch(context.actions.start());
/** THIS WILL BE ROUTED TO FAST OR LOCAL STATE IF ENABLED */
setState(_constants.IDLEMONITOR_ACTIVITY, { lastActive: +new Date(), lastEvent: { x: e.pageX, y: e.pageY } ... | javascript | function onActivity(e) {
if (!_shouldActivityUpdate(e)) return;
if (_shouldRestart()) return dispatch(context.actions.start());
/** THIS WILL BE ROUTED TO FAST OR LOCAL STATE IF ENABLED */
setState(_constants.IDLEMONITOR_ACTIVITY, { lastActive: +new Date(), lastEvent: { x: e.pageX, y: e.pageY } ... | [
"function",
"onActivity",
"(",
"e",
")",
"{",
"if",
"(",
"!",
"_shouldActivityUpdate",
"(",
"e",
")",
")",
"return",
";",
"if",
"(",
"_shouldRestart",
"(",
")",
")",
"return",
"dispatch",
"(",
"context",
".",
"actions",
".",
"start",
"(",
")",
")",
"... | One of the event listeners triggered an activity occurrence event. This gets spammed | [
"One",
"of",
"the",
"event",
"listeners",
"triggered",
"an",
"activity",
"occurrence",
"event",
".",
"This",
"gets",
"spammed"
] | 7b11262b5a89039e7d96e47b8391840e72510fe1 | https://github.com/noderaider/redux-addons/blob/7b11262b5a89039e7d96e47b8391840e72510fe1/lib/dispatcher.js#L250-L255 |
52,349 | noderaider/redux-addons | lib/dispatcher.js | schedule | function schedule(actionName) {
timeout.clear();
var timeoutMS = timeout.timeoutMS(actionName);
log.debug({ actionName: actionName, timeoutMS: timeoutMS }, 'schedule');
var args = { actionName: actionName, isPaused: _isPauseTriggered(timeoutMS) };
if (timeoutMS > 0) return setTimeout(funct... | javascript | function schedule(actionName) {
timeout.clear();
var timeoutMS = timeout.timeoutMS(actionName);
log.debug({ actionName: actionName, timeoutMS: timeoutMS }, 'schedule');
var args = { actionName: actionName, isPaused: _isPauseTriggered(timeoutMS) };
if (timeoutMS > 0) return setTimeout(funct... | [
"function",
"schedule",
"(",
"actionName",
")",
"{",
"timeout",
".",
"clear",
"(",
")",
";",
"var",
"timeoutMS",
"=",
"timeout",
".",
"timeoutMS",
"(",
"actionName",
")",
";",
"log",
".",
"debug",
"(",
"{",
"actionName",
":",
"actionName",
",",
"timeoutM... | Responsible for clearing old timeout and scheduling new one or immediately executing, returns new timeoutID or undefined | [
"Responsible",
"for",
"clearing",
"old",
"timeout",
"and",
"scheduling",
"new",
"one",
"or",
"immediately",
"executing",
"returns",
"new",
"timeoutID",
"or",
"undefined"
] | 7b11262b5a89039e7d96e47b8391840e72510fe1 | https://github.com/noderaider/redux-addons/blob/7b11262b5a89039e7d96e47b8391840e72510fe1/lib/dispatcher.js#L298-L307 |
52,350 | noderaider/redux-addons | lib/dispatcher.js | execute | function execute(_ref7) {
var actionName = _ref7.actionName;
var isPaused = _ref7.isPaused;
var nextActionName = getNextActionName(actionName);
var wasPaused = stores.redux.isPaused;
/** TODO: CHECK LOCAL STATE HERE AND IF ITS BEEN ACTIVE, POSTPONE THE ACTION ABOUT TO BE EXECUTED */
... | javascript | function execute(_ref7) {
var actionName = _ref7.actionName;
var isPaused = _ref7.isPaused;
var nextActionName = getNextActionName(actionName);
var wasPaused = stores.redux.isPaused;
/** TODO: CHECK LOCAL STATE HERE AND IF ITS BEEN ACTIVE, POSTPONE THE ACTION ABOUT TO BE EXECUTED */
... | [
"function",
"execute",
"(",
"_ref7",
")",
"{",
"var",
"actionName",
"=",
"_ref7",
".",
"actionName",
";",
"var",
"isPaused",
"=",
"_ref7",
".",
"isPaused",
";",
"var",
"nextActionName",
"=",
"getNextActionName",
"(",
"actionName",
")",
";",
"var",
"wasPaused... | Responsible for executing an action | [
"Responsible",
"for",
"executing",
"an",
"action"
] | 7b11262b5a89039e7d96e47b8391840e72510fe1 | https://github.com/noderaider/redux-addons/blob/7b11262b5a89039e7d96e47b8391840e72510fe1/lib/dispatcher.js#L310-L340 |
52,351 | panjiesw/frest | internal/docs/themes/hugo-theme-learn/static/js/learn.js | function (e) {
var elem = e.target;
if (this.scrollIfAnchor(elem.getAttribute('href'), true)) {
e.preventDefault();
}
} | javascript | function (e) {
var elem = e.target;
if (this.scrollIfAnchor(elem.getAttribute('href'), true)) {
e.preventDefault();
}
} | [
"function",
"(",
"e",
")",
"{",
"var",
"elem",
"=",
"e",
".",
"target",
";",
"if",
"(",
"this",
".",
"scrollIfAnchor",
"(",
"elem",
".",
"getAttribute",
"(",
"'href'",
")",
",",
"true",
")",
")",
"{",
"e",
".",
"preventDefault",
"(",
")",
";",
"}... | If the click event's target was an anchor, fix the scroll position. | [
"If",
"the",
"click",
"event",
"s",
"target",
"was",
"an",
"anchor",
"fix",
"the",
"scroll",
"position",
"."
] | 975a16ae24bd214b608d0b0001d3d86e5cd65f9e | https://github.com/panjiesw/frest/blob/975a16ae24bd214b608d0b0001d3d86e5cd65f9e/internal/docs/themes/hugo-theme-learn/static/js/learn.js#L331-L337 | |
52,352 | DIMLEO/dim | Session/Session.js | function(key, defaultValue){
var value = this.get(key, defaultValue);
if($ExpressSESSION.session.store[key]){
delete $ExpressSESSION.session.store[key];
}
return value;
} | javascript | function(key, defaultValue){
var value = this.get(key, defaultValue);
if($ExpressSESSION.session.store[key]){
delete $ExpressSESSION.session.store[key];
}
return value;
} | [
"function",
"(",
"key",
",",
"defaultValue",
")",
"{",
"var",
"value",
"=",
"this",
".",
"get",
"(",
"key",
",",
"defaultValue",
")",
";",
"if",
"(",
"$ExpressSESSION",
".",
"session",
".",
"store",
"[",
"key",
"]",
")",
"{",
"delete",
"$ExpressSESSION... | Retrieving An Item And Forgetting It | [
"Retrieving",
"An",
"Item",
"And",
"Forgetting",
"It"
] | 4e8066be4dfc6c6cf53698c302c1ad0cc082d5d3 | https://github.com/DIMLEO/dim/blob/4e8066be4dfc6c6cf53698c302c1ad0cc082d5d3/Session/Session.js#L44-L50 | |
52,353 | phelpstream/svp | lib/functions/merge.js | merge | function merge(target) {
for (var _len = arguments.length, sources = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
sources[_key - 1] = arguments[_key];
}
if (!sources.length) return target;
var source = sources.shift();
if ((0, _isObject2.default)(target) && (0, _isObject2.default)(so... | javascript | function merge(target) {
for (var _len = arguments.length, sources = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
sources[_key - 1] = arguments[_key];
}
if (!sources.length) return target;
var source = sources.shift();
if ((0, _isObject2.default)(target) && (0, _isObject2.default)(so... | [
"function",
"merge",
"(",
"target",
")",
"{",
"for",
"(",
"var",
"_len",
"=",
"arguments",
".",
"length",
",",
"sources",
"=",
"Array",
"(",
"_len",
">",
"1",
"?",
"_len",
"-",
"1",
":",
"0",
")",
",",
"_key",
"=",
"1",
";",
"_key",
"<",
"_len"... | Recursively merge two objects.
@param target
@param ...sources | [
"Recursively",
"merge",
"two",
"objects",
"."
] | 2f99adb9c5d0709e567264bba896d6a59f6a0a59 | https://github.com/phelpstream/svp/blob/2f99adb9c5d0709e567264bba896d6a59f6a0a59/lib/functions/merge.js#L21-L41 |
52,354 | chriskinsman/disque-eventemitter | index.js | readQueue | function readQueue() {
disq.getJob({queue: queueName, count: self.jobCount, withcounters: self.withCounters}, function(err, jobs) {
if(err) {
self.emit('error', err);
}
else {
jobs.forEach(function(job) {
pendingMessages++;
... | javascript | function readQueue() {
disq.getJob({queue: queueName, count: self.jobCount, withcounters: self.withCounters}, function(err, jobs) {
if(err) {
self.emit('error', err);
}
else {
jobs.forEach(function(job) {
pendingMessages++;
... | [
"function",
"readQueue",
"(",
")",
"{",
"disq",
".",
"getJob",
"(",
"{",
"queue",
":",
"queueName",
",",
"count",
":",
"self",
".",
"jobCount",
",",
"withcounters",
":",
"self",
".",
"withCounters",
"}",
",",
"function",
"(",
"err",
",",
"jobs",
")",
... | Main message processor | [
"Main",
"message",
"processor"
] | 0b7550def40f5e1e614de4b015c7fccc9bd6a497 | https://github.com/chriskinsman/disque-eventemitter/blob/0b7550def40f5e1e614de4b015c7fccc9bd6a497/index.js#L22-L47 |
52,355 | implicit-invocation/world-walkable | index.js | dst | function dst(lat1, lon1, lat2, lon2) {
// generally used geo measurement function
var dLat = lat2 * Math.PI / 180 - lat1 * Math.PI / 180;
var dLon = lon2 * Math.PI / 180 - lon1 * Math.PI / 180;
var a =
Math.sin(dLat / 2) * Math.sin(dLat / 2) +
Math.cos(lat1 * Math.PI / 180) *
Math.cos(lat2 * Math.... | javascript | function dst(lat1, lon1, lat2, lon2) {
// generally used geo measurement function
var dLat = lat2 * Math.PI / 180 - lat1 * Math.PI / 180;
var dLon = lon2 * Math.PI / 180 - lon1 * Math.PI / 180;
var a =
Math.sin(dLat / 2) * Math.sin(dLat / 2) +
Math.cos(lat1 * Math.PI / 180) *
Math.cos(lat2 * Math.... | [
"function",
"dst",
"(",
"lat1",
",",
"lon1",
",",
"lat2",
",",
"lon2",
")",
"{",
"// generally used geo measurement function",
"var",
"dLat",
"=",
"lat2",
"*",
"Math",
".",
"PI",
"/",
"180",
"-",
"lat1",
"*",
"Math",
".",
"PI",
"/",
"180",
";",
"var",
... | Radius of earth in KM | [
"Radius",
"of",
"earth",
"in",
"KM"
] | fedeee4e03fe2e91d417621c325ad71400a1a258 | https://github.com/implicit-invocation/world-walkable/blob/fedeee4e03fe2e91d417621c325ad71400a1a258/index.js#L5-L18 |
52,356 | gethuman/pancakes-angular | lib/middleware/jng.pages.js | renderLayout | function renderLayout(appName, layoutName, isAmp, dependencies) {
var layout = this.pancakes.cook('app/' + appName + '/layouts/' + layoutName + '.layout');
var layoutView = this.pancakes.cook(layout.view, { dependencies: dependencies });
return jangular.render(layoutView, dependencies.model, { strip: false,... | javascript | function renderLayout(appName, layoutName, isAmp, dependencies) {
var layout = this.pancakes.cook('app/' + appName + '/layouts/' + layoutName + '.layout');
var layoutView = this.pancakes.cook(layout.view, { dependencies: dependencies });
return jangular.render(layoutView, dependencies.model, { strip: false,... | [
"function",
"renderLayout",
"(",
"appName",
",",
"layoutName",
",",
"isAmp",
",",
"dependencies",
")",
"{",
"var",
"layout",
"=",
"this",
".",
"pancakes",
".",
"cook",
"(",
"'app/'",
"+",
"appName",
"+",
"'/layouts/'",
"+",
"layoutName",
"+",
"'.layout'",
... | Get a particular layout
@param appName
@param layoutName
@param isAmp
@param dependencies | [
"Get",
"a",
"particular",
"layout"
] | 9589b7ba09619843e271293088005c62ed23f355 | https://github.com/gethuman/pancakes-angular/blob/9589b7ba09619843e271293088005c62ed23f355/lib/middleware/jng.pages.js#L18-L22 |
52,357 | gethuman/pancakes-angular | lib/middleware/jng.directives.js | checkOnScopeChangeVals | function checkOnScopeChangeVals(partial, partialName) {
var remodelOnScopeChange = partial.remodelOnScopeChange || (partial.remodel && partial.remodel.onScopeChange);
var rerenderOnScopeChange = partial.rerenderOnScopeChange || (partial.rerender && partial.rerender.onScopeChange);
var scope = partial.scope ... | javascript | function checkOnScopeChangeVals(partial, partialName) {
var remodelOnScopeChange = partial.remodelOnScopeChange || (partial.remodel && partial.remodel.onScopeChange);
var rerenderOnScopeChange = partial.rerenderOnScopeChange || (partial.rerender && partial.rerender.onScopeChange);
var scope = partial.scope ... | [
"function",
"checkOnScopeChangeVals",
"(",
"partial",
",",
"partialName",
")",
"{",
"var",
"remodelOnScopeChange",
"=",
"partial",
".",
"remodelOnScopeChange",
"||",
"(",
"partial",
".",
"remodel",
"&&",
"partial",
".",
"remodel",
".",
"onScopeChange",
")",
";",
... | Make sure the remodelOnScopeChange and rerenderOnScopeChange values are
all from the isolated scope definition. In other words, are values that
come from the parent scope.
@param partial
@param partialName | [
"Make",
"sure",
"the",
"remodelOnScopeChange",
"and",
"rerenderOnScopeChange",
"values",
"are",
"all",
"from",
"the",
"isolated",
"scope",
"definition",
".",
"In",
"other",
"words",
"are",
"values",
"that",
"come",
"from",
"the",
"parent",
"scope",
"."
] | 9589b7ba09619843e271293088005c62ed23f355 | https://github.com/gethuman/pancakes-angular/blob/9589b7ba09619843e271293088005c62ed23f355/lib/middleware/jng.directives.js#L50-L70 |
52,358 | gethuman/pancakes-angular | lib/middleware/jng.directives.js | getSubviews | function getSubviews(subviewFlapjacks) {
var renderedSubviews = {};
var jangularDeps = this.getJangularDeps();
var me = this;
_.each(subviewFlapjacks, function (subview, subviewName) {
renderedSubviews[subviewName] = me.pancakes.cook(subview, { dependencies: jangularDeps });
});
return... | javascript | function getSubviews(subviewFlapjacks) {
var renderedSubviews = {};
var jangularDeps = this.getJangularDeps();
var me = this;
_.each(subviewFlapjacks, function (subview, subviewName) {
renderedSubviews[subviewName] = me.pancakes.cook(subview, { dependencies: jangularDeps });
});
return... | [
"function",
"getSubviews",
"(",
"subviewFlapjacks",
")",
"{",
"var",
"renderedSubviews",
"=",
"{",
"}",
";",
"var",
"jangularDeps",
"=",
"this",
".",
"getJangularDeps",
"(",
")",
";",
"var",
"me",
"=",
"this",
";",
"_",
".",
"each",
"(",
"subviewFlapjacks"... | Get all subviews
@param subviewFlapjacks | [
"Get",
"all",
"subviews"
] | 9589b7ba09619843e271293088005c62ed23f355 | https://github.com/gethuman/pancakes-angular/blob/9589b7ba09619843e271293088005c62ed23f355/lib/middleware/jng.directives.js#L162-L172 |
52,359 | gethuman/pancakes-angular | lib/middleware/jng.directives.js | getPartialRenderFn | function getPartialRenderFn(partial, partialName) {
var jangularDeps = this.getJangularDeps();
var me = this;
return function renderPartial(model, elem, attrs) {
me.isolateScope(model, partial.scope, attrs);
// throw error if onScopeChange values not in the scope {} definition
me.c... | javascript | function getPartialRenderFn(partial, partialName) {
var jangularDeps = this.getJangularDeps();
var me = this;
return function renderPartial(model, elem, attrs) {
me.isolateScope(model, partial.scope, attrs);
// throw error if onScopeChange values not in the scope {} definition
me.c... | [
"function",
"getPartialRenderFn",
"(",
"partial",
",",
"partialName",
")",
"{",
"var",
"jangularDeps",
"=",
"this",
".",
"getJangularDeps",
"(",
")",
";",
"var",
"me",
"=",
"this",
";",
"return",
"function",
"renderPartial",
"(",
"model",
",",
"elem",
",",
... | Get a function to help render a partial
@param partial
@param partialName
@returns {Function} | [
"Get",
"a",
"function",
"to",
"help",
"render",
"a",
"partial"
] | 9589b7ba09619843e271293088005c62ed23f355 | https://github.com/gethuman/pancakes-angular/blob/9589b7ba09619843e271293088005c62ed23f355/lib/middleware/jng.directives.js#L180-L207 |
52,360 | gethuman/pancakes-angular | lib/middleware/jng.directives.js | getBehavioralDirectives | function getBehavioralDirectives(appName) {
var directives = {};
var me = this;
_.each(this.getAppFileNames(appName, 'jng.directives'), function (directiveName) {
// if not a JavaScript file, ignore it
if (!me.pancakes.utils.isJavaScript(directiveName)) { return; }
// get the dire... | javascript | function getBehavioralDirectives(appName) {
var directives = {};
var me = this;
_.each(this.getAppFileNames(appName, 'jng.directives'), function (directiveName) {
// if not a JavaScript file, ignore it
if (!me.pancakes.utils.isJavaScript(directiveName)) { return; }
// get the dire... | [
"function",
"getBehavioralDirectives",
"(",
"appName",
")",
"{",
"var",
"directives",
"=",
"{",
"}",
";",
"var",
"me",
"=",
"this",
";",
"_",
".",
"each",
"(",
"this",
".",
"getAppFileNames",
"(",
"appName",
",",
"'jng.directives'",
")",
",",
"function",
... | Add behavior directives from the jng.directives folder.
@param appName | [
"Add",
"behavior",
"directives",
"from",
"the",
"jng",
".",
"directives",
"folder",
"."
] | 9589b7ba09619843e271293088005c62ed23f355 | https://github.com/gethuman/pancakes-angular/blob/9589b7ba09619843e271293088005c62ed23f355/lib/middleware/jng.directives.js#L245-L262 |
52,361 | gethuman/pancakes-angular | lib/middleware/jng.directives.js | getClientDirectives | function getClientDirectives(appName) {
var directives = [];
var me = this;
_.each(this.getAppFileNames(appName, 'ng.directives'), function (directiveName) {
// if not a JavaScript file, ignore it
if (!me.pancakes.utils.isJavaScript(directiveName)) { return; }
directiveName = dire... | javascript | function getClientDirectives(appName) {
var directives = [];
var me = this;
_.each(this.getAppFileNames(appName, 'ng.directives'), function (directiveName) {
// if not a JavaScript file, ignore it
if (!me.pancakes.utils.isJavaScript(directiveName)) { return; }
directiveName = dire... | [
"function",
"getClientDirectives",
"(",
"appName",
")",
"{",
"var",
"directives",
"=",
"[",
"]",
";",
"var",
"me",
"=",
"this",
";",
"_",
".",
"each",
"(",
"this",
".",
"getAppFileNames",
"(",
"appName",
",",
"'ng.directives'",
")",
",",
"function",
"(",... | Just because they are client-side directives, doesn't mean we don't need to do anything server-side. For example,
if JNG_STRIP is true, we need to strip them. We do, however, need to make it so they don't actually do anything
server-side (noop function0
@param appName | [
"Just",
"because",
"they",
"are",
"client",
"-",
"side",
"directives",
"doesn",
"t",
"mean",
"we",
"don",
"t",
"need",
"to",
"do",
"anything",
"server",
"-",
"side",
".",
"For",
"example",
"if",
"JNG_STRIP",
"is",
"true",
"we",
"need",
"to",
"strip",
"... | 9589b7ba09619843e271293088005c62ed23f355 | https://github.com/gethuman/pancakes-angular/blob/9589b7ba09619843e271293088005c62ed23f355/lib/middleware/jng.directives.js#L271-L285 |
52,362 | gethuman/pancakes-angular | lib/middleware/jng.directives.js | getGenericDirective | function getGenericDirective(prefix, attrName, filterType, isBind, isFilter) {
var directiveName = prefix + attrName.substring(0, 1).toUpperCase() + attrName.substring(1);
var config = this.pancakes.cook('config', null);
var i18n = this.pancakes.cook('i18n', null);
var eventBus = this.pancakes.cook('eve... | javascript | function getGenericDirective(prefix, attrName, filterType, isBind, isFilter) {
var directiveName = prefix + attrName.substring(0, 1).toUpperCase() + attrName.substring(1);
var config = this.pancakes.cook('config', null);
var i18n = this.pancakes.cook('i18n', null);
var eventBus = this.pancakes.cook('eve... | [
"function",
"getGenericDirective",
"(",
"prefix",
",",
"attrName",
",",
"filterType",
",",
"isBind",
",",
"isFilter",
")",
"{",
"var",
"directiveName",
"=",
"prefix",
"+",
"attrName",
".",
"substring",
"(",
"0",
",",
"1",
")",
".",
"toUpperCase",
"(",
")",... | Get a generic directive
@param prefix
@param attrName
@param filterType
@param isBind
@param isFilter
@returns {Function} | [
"Get",
"a",
"generic",
"directive"
] | 9589b7ba09619843e271293088005c62ed23f355 | https://github.com/gethuman/pancakes-angular/blob/9589b7ba09619843e271293088005c62ed23f355/lib/middleware/jng.directives.js#L308-L371 |
52,363 | gethuman/pancakes-angular | lib/middleware/jng.directives.js | getGenericDirectives | function getGenericDirectives() {
var directives = {};
var genericDirectives = {
'src': 'file',
'title': 'i18n',
'placeholder': 'i18n',
'popover': 'i18n',
'value': 'i18n',
'alt': 'i18n',
'text': 'i18n',
... | javascript | function getGenericDirectives() {
var directives = {};
var genericDirectives = {
'src': 'file',
'title': 'i18n',
'placeholder': 'i18n',
'popover': 'i18n',
'value': 'i18n',
'alt': 'i18n',
'text': 'i18n',
... | [
"function",
"getGenericDirectives",
"(",
")",
"{",
"var",
"directives",
"=",
"{",
"}",
";",
"var",
"genericDirectives",
"=",
"{",
"'src'",
":",
"'file'",
",",
"'title'",
":",
"'i18n'",
",",
"'placeholder'",
":",
"'i18n'",
",",
"'popover'",
":",
"'i18n'",
"... | Add generic directives. This functionality should match up to the generic.directives.js
client side code. | [
"Add",
"generic",
"directives",
".",
"This",
"functionality",
"should",
"match",
"up",
"to",
"the",
"generic",
".",
"directives",
".",
"js",
"client",
"side",
"code",
"."
] | 9589b7ba09619843e271293088005c62ed23f355 | https://github.com/gethuman/pancakes-angular/blob/9589b7ba09619843e271293088005c62ed23f355/lib/middleware/jng.directives.js#L377-L411 |
52,364 | gethuman/pancakes-angular | lib/middleware/jng.directives.js | addDirectivesToJangular | function addDirectivesToJangular(directives) {
_.each(directives, function (directive, directiveName) {
jangular.addDirective(directiveName, directive);
});
} | javascript | function addDirectivesToJangular(directives) {
_.each(directives, function (directive, directiveName) {
jangular.addDirective(directiveName, directive);
});
} | [
"function",
"addDirectivesToJangular",
"(",
"directives",
")",
"{",
"_",
".",
"each",
"(",
"directives",
",",
"function",
"(",
"directive",
",",
"directiveName",
")",
"{",
"jangular",
".",
"addDirective",
"(",
"directiveName",
",",
"directive",
")",
";",
"}",
... | Add directives to jangular
@param directives | [
"Add",
"directives",
"to",
"jangular"
] | 9589b7ba09619843e271293088005c62ed23f355 | https://github.com/gethuman/pancakes-angular/blob/9589b7ba09619843e271293088005c62ed23f355/lib/middleware/jng.directives.js#L417-L421 |
52,365 | cemtopkaya/kuark-db | src/db_rol.js | f_rol_tumu | function f_rol_tumu(_tahta_id) {
return result.dbQ.smembers(result.kp.tahta.ssetOzelTahtaRolleri(_tahta_id, true))
.then(function (_rol_idler) {
return f_rol_id(_rol_idler);
});
} | javascript | function f_rol_tumu(_tahta_id) {
return result.dbQ.smembers(result.kp.tahta.ssetOzelTahtaRolleri(_tahta_id, true))
.then(function (_rol_idler) {
return f_rol_id(_rol_idler);
});
} | [
"function",
"f_rol_tumu",
"(",
"_tahta_id",
")",
"{",
"return",
"result",
".",
"dbQ",
".",
"smembers",
"(",
"result",
".",
"kp",
".",
"tahta",
".",
"ssetOzelTahtaRolleri",
"(",
"_tahta_id",
",",
"true",
")",
")",
".",
"then",
"(",
"function",
"(",
"_rol_... | endregion region ROLLER | [
"endregion",
"region",
"ROLLER"
] | d584aaf51f65a013bec79220a05007bd70767ac2 | https://github.com/cemtopkaya/kuark-db/blob/d584aaf51f65a013bec79220a05007bd70767ac2/src/db_rol.js#L63-L68 |
52,366 | usenode/litmus.js | lib/commandline.js | getLitmusForModule | function getLitmusForModule (module) {
if (isLitmus(module)) {
return module;
}
if (module.test && isLitmus(module.test)) {
return module.test;
}
throw new Error('litmus: expected module to export litmus.Test or litmus.Suite');
} | javascript | function getLitmusForModule (module) {
if (isLitmus(module)) {
return module;
}
if (module.test && isLitmus(module.test)) {
return module.test;
}
throw new Error('litmus: expected module to export litmus.Test or litmus.Suite');
} | [
"function",
"getLitmusForModule",
"(",
"module",
")",
"{",
"if",
"(",
"isLitmus",
"(",
"module",
")",
")",
"{",
"return",
"module",
";",
"}",
"if",
"(",
"module",
".",
"test",
"&&",
"isLitmus",
"(",
"module",
".",
"test",
")",
")",
"{",
"return",
"mo... | Find the litmus.Test or litmus.Suite for a module.
Previous versions of litmus expected this to be exposed under a 'test' key. | [
"Find",
"the",
"litmus",
".",
"Test",
"or",
"litmus",
".",
"Suite",
"for",
"a",
"module",
".",
"Previous",
"versions",
"of",
"litmus",
"expected",
"this",
"to",
"be",
"exposed",
"under",
"a",
"test",
"key",
"."
] | 8bed2ea18a925f4590387556b6438f3a15ea82c0 | https://github.com/usenode/litmus.js/blob/8bed2ea18a925f4590387556b6438f3a15ea82c0/lib/commandline.js#L113-L124 |
52,367 | markhuge/aws-sdk-sugar | lib/elb.js | function (elbName, cb) {
query(elbName, function (err, data) {
if (err) return cb(err);
var result = [];
data.Instances.map(function (item) { result.push(item.InstanceId); });
cb(undefined, result);
});
} | javascript | function (elbName, cb) {
query(elbName, function (err, data) {
if (err) return cb(err);
var result = [];
data.Instances.map(function (item) { result.push(item.InstanceId); });
cb(undefined, result);
});
} | [
"function",
"(",
"elbName",
",",
"cb",
")",
"{",
"query",
"(",
"elbName",
",",
"function",
"(",
"err",
",",
"data",
")",
"{",
"if",
"(",
"err",
")",
"return",
"cb",
"(",
"err",
")",
";",
"var",
"result",
"=",
"[",
"]",
";",
"data",
".",
"Instan... | List instances in ELB | [
"List",
"instances",
"in",
"ELB"
] | 16f8c1275b3f730c57d06aece6ebb0a34e492163 | https://github.com/markhuge/aws-sdk-sugar/blob/16f8c1275b3f730c57d06aece6ebb0a34e492163/lib/elb.js#L23-L30 | |
52,368 | vkiding/jud-vue-render | src/render/browser/base/component/index.js | isEventValid | function isEventValid (comp, type) {
// if a component has aleary triggered 'appear' event, then
// the 'appear' even† can't be triggered again utill the
// 'disappear' event triggered.
if (appearEvts.indexOf(type) <= -1) {
return true
}
if (comp._appear === undefined && type === 'disappear') {
retu... | javascript | function isEventValid (comp, type) {
// if a component has aleary triggered 'appear' event, then
// the 'appear' even† can't be triggered again utill the
// 'disappear' event triggered.
if (appearEvts.indexOf(type) <= -1) {
return true
}
if (comp._appear === undefined && type === 'disappear') {
retu... | [
"function",
"isEventValid",
"(",
"comp",
",",
"type",
")",
"{",
"// if a component has aleary triggered 'appear' event, then",
"// the 'appear' even† can't be triggered again utill the",
"// 'disappear' event triggered.",
"if",
"(",
"appearEvts",
".",
"indexOf",
"(",
"type",
")",... | check whether a event is valid to dispatch.
@param {Component} comp the component that this event is to trigger on.
@param {string} type the event type.
@return {Boolean} is it valid to dispatch. | [
"check",
"whether",
"a",
"event",
"is",
"valid",
"to",
"dispatch",
"."
] | 07d8ab08d0ef86cf2819e5f2bf1f4b06381f4d47 | https://github.com/vkiding/jud-vue-render/blob/07d8ab08d0ef86cf2819e5f2bf1f4b06381f4d47/src/render/browser/base/component/index.js#L19-L38 |
52,369 | rm3web/textblocks | lib/textblock.js | splitIntoSlabs | function splitIntoSlabs(str) {
var slabs = str.split('<!-- TEXTBLOCK -->');
return slabs.map(function(val, index, array) {
if (index % 2 == 1) {
var rawAttr = val.match(/<code>(.*)<\/code>/);
var attrs = JSON.parse(decodeURI(rawAttr[1]));
return attrs;
} else {
return val;
}
})... | javascript | function splitIntoSlabs(str) {
var slabs = str.split('<!-- TEXTBLOCK -->');
return slabs.map(function(val, index, array) {
if (index % 2 == 1) {
var rawAttr = val.match(/<code>(.*)<\/code>/);
var attrs = JSON.parse(decodeURI(rawAttr[1]));
return attrs;
} else {
return val;
}
})... | [
"function",
"splitIntoSlabs",
"(",
"str",
")",
"{",
"var",
"slabs",
"=",
"str",
".",
"split",
"(",
"'<!-- TEXTBLOCK -->'",
")",
";",
"return",
"slabs",
".",
"map",
"(",
"function",
"(",
"val",
",",
"index",
",",
"array",
")",
"{",
"if",
"(",
"index",
... | Split into slabs, undoing the placeholders created in generatePlaceholder
@param {String} str The string to convert back to slabs
@return {Array} Slabs that have been broken out | [
"Split",
"into",
"slabs",
"undoing",
"the",
"placeholders",
"created",
"in",
"generatePlaceholder"
] | 5c3896a66339c6de64de691fc6bacd4f4626ce1b | https://github.com/rm3web/textblocks/blob/5c3896a66339c6de64de691fc6bacd4f4626ce1b/lib/textblock.js#L103-L114 |
52,370 | rm3web/textblocks | lib/textblock.js | function(source, format, ctx) {
if (inputFormats.hasOwnProperty(format)) {
return inputFormats[format](source, ctx);
} else {
throw new Error('invalid format to make a text block from: ' + source.format);
}
} | javascript | function(source, format, ctx) {
if (inputFormats.hasOwnProperty(format)) {
return inputFormats[format](source, ctx);
} else {
throw new Error('invalid format to make a text block from: ' + source.format);
}
} | [
"function",
"(",
"source",
",",
"format",
",",
"ctx",
")",
"{",
"if",
"(",
"inputFormats",
".",
"hasOwnProperty",
"(",
"format",
")",
")",
"{",
"return",
"inputFormats",
"[",
"format",
"]",
"(",
"source",
",",
"ctx",
")",
";",
"}",
"else",
"{",
"thro... | Make a text block from source
@param {String} source The source to make a text block from
@param {String} format The format to use
@param {Object} ctx An object to be passed to all of the rendering functions
@return {Object} a new textblock | [
"Make",
"a",
"text",
"block",
"from",
"source"
] | 5c3896a66339c6de64de691fc6bacd4f4626ce1b | https://github.com/rm3web/textblocks/blob/5c3896a66339c6de64de691fc6bacd4f4626ce1b/lib/textblock.js#L188-L194 | |
52,371 | rm3web/textblocks | lib/textblock.js | function(source, ctx) {
if (source.hasOwnProperty('format')) {
if (validateFormats.hasOwnProperty(source.format)) {
return validateFormats[source.format](source, ctx);
} else {
throw new Error('invalid format for textblock: ' + source.format);
}
}
throw new Error('invalid format for textbl... | javascript | function(source, ctx) {
if (source.hasOwnProperty('format')) {
if (validateFormats.hasOwnProperty(source.format)) {
return validateFormats[source.format](source, ctx);
} else {
throw new Error('invalid format for textblock: ' + source.format);
}
}
throw new Error('invalid format for textbl... | [
"function",
"(",
"source",
",",
"ctx",
")",
"{",
"if",
"(",
"source",
".",
"hasOwnProperty",
"(",
"'format'",
")",
")",
"{",
"if",
"(",
"validateFormats",
".",
"hasOwnProperty",
"(",
"source",
".",
"format",
")",
")",
"{",
"return",
"validateFormats",
"[... | Validate a text blocks
@param {String} source The source untrusted text block
@param {Object} ctx An object to be passed to all of the rendering functions
@return {Object} a cleaned text block | [
"Validate",
"a",
"text",
"blocks"
] | 5c3896a66339c6de64de691fc6bacd4f4626ce1b | https://github.com/rm3web/textblocks/blob/5c3896a66339c6de64de691fc6bacd4f4626ce1b/lib/textblock.js#L202-L211 | |
52,372 | rm3web/textblocks | lib/textblock.js | function(source, type) {
if (source.hasOwnProperty('format')) {
if (source.format !== type) {
if (source.format === 'section') {
var blocks = [];
source.blocks.forEach(function(val, index, array) {
var block = deleteTextBlockFormat(val, type);
if (block) {
blo... | javascript | function(source, type) {
if (source.hasOwnProperty('format')) {
if (source.format !== type) {
if (source.format === 'section') {
var blocks = [];
source.blocks.forEach(function(val, index, array) {
var block = deleteTextBlockFormat(val, type);
if (block) {
blo... | [
"function",
"(",
"source",
",",
"type",
")",
"{",
"if",
"(",
"source",
".",
"hasOwnProperty",
"(",
"'format'",
")",
")",
"{",
"if",
"(",
"source",
".",
"format",
"!==",
"type",
")",
"{",
"if",
"(",
"source",
".",
"format",
"===",
"'section'",
")",
... | Delete all blocks with a given format.
@param {String} source The source untrusted text block
@param {String} type The type of block to remove
@return {Object} a cleaned text block | [
"Delete",
"all",
"blocks",
"with",
"a",
"given",
"format",
"."
] | 5c3896a66339c6de64de691fc6bacd4f4626ce1b | https://github.com/rm3web/textblocks/blob/5c3896a66339c6de64de691fc6bacd4f4626ce1b/lib/textblock.js#L219-L243 | |
52,373 | rm3web/textblocks | lib/textblock.js | function(blocks) {
var blockarr = blocks;
if (!(blockarr instanceof Array)) {
blockarr = [blockarr];
}
return {format: 'section', blocks: blockarr};
} | javascript | function(blocks) {
var blockarr = blocks;
if (!(blockarr instanceof Array)) {
blockarr = [blockarr];
}
return {format: 'section', blocks: blockarr};
} | [
"function",
"(",
"blocks",
")",
"{",
"var",
"blockarr",
"=",
"blocks",
";",
"if",
"(",
"!",
"(",
"blockarr",
"instanceof",
"Array",
")",
")",
"{",
"blockarr",
"=",
"[",
"blockarr",
"]",
";",
"}",
"return",
"{",
"format",
":",
"'section'",
",",
"block... | Convert one or more blocks into a section
@param {Object|Array} blocks A block or an array of blocks
@return {Object} A text block | [
"Convert",
"one",
"or",
"more",
"blocks",
"into",
"a",
"section"
] | 5c3896a66339c6de64de691fc6bacd4f4626ce1b | https://github.com/rm3web/textblocks/blob/5c3896a66339c6de64de691fc6bacd4f4626ce1b/lib/textblock.js#L250-L256 | |
52,374 | rm3web/textblocks | lib/textblock.js | function(block, pos, ctx, callback) {
if (block.hasOwnProperty('htmlslabs')) {
outputSlabs(block.htmlslabs, ctx, callback);
} else {
if (formats.hasOwnProperty(block.format)) {
formats[block.format](block, pos, ctx, callback);
} else {
callback(new Error('unknown format: ' + block.format));
... | javascript | function(block, pos, ctx, callback) {
if (block.hasOwnProperty('htmlslabs')) {
outputSlabs(block.htmlslabs, ctx, callback);
} else {
if (formats.hasOwnProperty(block.format)) {
formats[block.format](block, pos, ctx, callback);
} else {
callback(new Error('unknown format: ' + block.format));
... | [
"function",
"(",
"block",
",",
"pos",
",",
"ctx",
",",
"callback",
")",
"{",
"if",
"(",
"block",
".",
"hasOwnProperty",
"(",
"'htmlslabs'",
")",
")",
"{",
"outputSlabs",
"(",
"block",
".",
"htmlslabs",
",",
"ctx",
",",
"callback",
")",
";",
"}",
"els... | Output a text block in HTML.
Warning: This assumes that you have used validateTextBlock or makeTextBlock
to ensure a valid XSS-free textblock.
@param {Object} block The text block to be output
@param {String} pos The position to start adding suffixes to (useful for generating links or pagination)
@param {Object} ctx ... | [
"Output",
"a",
"text",
"block",
"in",
"HTML",
"."
] | 5c3896a66339c6de64de691fc6bacd4f4626ce1b | https://github.com/rm3web/textblocks/blob/5c3896a66339c6de64de691fc6bacd4f4626ce1b/lib/textblock.js#L295-L305 | |
52,375 | rm3web/textblocks | lib/textblock.js | function(block) {
if (block.hasOwnProperty('htmlslabs')) {
return outputSlabsAsText(block.htmlslabs);
} else {
if (block.format === 'section') {
return block.blocks.reduce(function(previousValue, currentValue, currentIndex, array) {
return previousValue + extractTextBlockText(currentValue);
... | javascript | function(block) {
if (block.hasOwnProperty('htmlslabs')) {
return outputSlabsAsText(block.htmlslabs);
} else {
if (block.format === 'section') {
return block.blocks.reduce(function(previousValue, currentValue, currentIndex, array) {
return previousValue + extractTextBlockText(currentValue);
... | [
"function",
"(",
"block",
")",
"{",
"if",
"(",
"block",
".",
"hasOwnProperty",
"(",
"'htmlslabs'",
")",
")",
"{",
"return",
"outputSlabsAsText",
"(",
"block",
".",
"htmlslabs",
")",
";",
"}",
"else",
"{",
"if",
"(",
"block",
".",
"format",
"===",
"'sec... | Output a text block as plain-text
@param {Object} block The text block to be output
@return {String} the textual content, sans enhancement and HTML | [
"Output",
"a",
"text",
"block",
"as",
"plain",
"-",
"text"
] | 5c3896a66339c6de64de691fc6bacd4f4626ce1b | https://github.com/rm3web/textblocks/blob/5c3896a66339c6de64de691fc6bacd4f4626ce1b/lib/textblock.js#L313-L325 | |
52,376 | redisjs/jsr-server | lib/command/database/key/scan.js | execute | function execute(req, res) {
var scanner = new Scanner(
req.db.getKeys(), req.info.cursor, req.info.pattern, req.info.count);
scanner.scan(req, res);
} | javascript | function execute(req, res) {
var scanner = new Scanner(
req.db.getKeys(), req.info.cursor, req.info.pattern, req.info.count);
scanner.scan(req, res);
} | [
"function",
"execute",
"(",
"req",
",",
"res",
")",
"{",
"var",
"scanner",
"=",
"new",
"Scanner",
"(",
"req",
".",
"db",
".",
"getKeys",
"(",
")",
",",
"req",
".",
"info",
".",
"cursor",
",",
"req",
".",
"info",
".",
"pattern",
",",
"req",
".",
... | Respond to the SCAN command. | [
"Respond",
"to",
"the",
"SCAN",
"command",
"."
] | 49413052d3039524fbdd2ade0ef9bae26cb4d647 | https://github.com/redisjs/jsr-server/blob/49413052d3039524fbdd2ade0ef9bae26cb4d647/lib/command/database/key/scan.js#L29-L33 |
52,377 | redisjs/jsr-server | lib/command/database/key/scan.js | validate | function validate(cmd, args, info) {
AbstractCommand.prototype.validate.apply(this, arguments);
var offset = info.exec.offset
, arg = args[offset];
if(args.length > offset + 4) {
throw new CommandArgLength(info.exec.definition.name);
}
// cursor already parsed to integer by numeric validation
info... | javascript | function validate(cmd, args, info) {
AbstractCommand.prototype.validate.apply(this, arguments);
var offset = info.exec.offset
, arg = args[offset];
if(args.length > offset + 4) {
throw new CommandArgLength(info.exec.definition.name);
}
// cursor already parsed to integer by numeric validation
info... | [
"function",
"validate",
"(",
"cmd",
",",
"args",
",",
"info",
")",
"{",
"AbstractCommand",
".",
"prototype",
".",
"validate",
".",
"apply",
"(",
"this",
",",
"arguments",
")",
";",
"var",
"offset",
"=",
"info",
".",
"exec",
".",
"offset",
",",
"arg",
... | Validate the SCAN command. | [
"Validate",
"the",
"SCAN",
"command",
"."
] | 49413052d3039524fbdd2ade0ef9bae26cb4d647 | https://github.com/redisjs/jsr-server/blob/49413052d3039524fbdd2ade0ef9bae26cb4d647/lib/command/database/key/scan.js#L38-L76 |
52,378 | aureooms/js-selection | lib/quickselect/singletco.js | singletco | function singletco(partition) {
var select = function select(compare, a, i, j, k) {
while (true) {
if (j - i < 2) return;
var p = partition(compare, a, i, j);
if (k < p) j = p;else if (k > p) i = p + 1;else return;
}
};
return select;
} | javascript | function singletco(partition) {
var select = function select(compare, a, i, j, k) {
while (true) {
if (j - i < 2) return;
var p = partition(compare, a, i, j);
if (k < p) j = p;else if (k > p) i = p + 1;else return;
}
};
return select;
} | [
"function",
"singletco",
"(",
"partition",
")",
"{",
"var",
"select",
"=",
"function",
"select",
"(",
"compare",
",",
"a",
",",
"i",
",",
"j",
",",
"k",
")",
"{",
"while",
"(",
"true",
")",
"{",
"if",
"(",
"j",
"-",
"i",
"<",
"2",
")",
"return"... | Template for the recursive implementation of quickselect with explicit tail
call optimization. | [
"Template",
"for",
"the",
"recursive",
"implementation",
"of",
"quickselect",
"with",
"explicit",
"tail",
"call",
"optimization",
"."
] | 55d592614e55052ddebe204367a5ada0cddba547 | https://github.com/aureooms/js-selection/blob/55d592614e55052ddebe204367a5ada0cddba547/lib/quickselect/singletco.js#L14-L29 |
52,379 | Nazariglez/perenquen | lib/pixi/src/filters/blur/BlurXFilter.js | BlurXFilter | function BlurXFilter()
{
core.AbstractFilter.call(this,
// vertex shader
fs.readFileSync(__dirname + '/blurX.vert', 'utf8'),
// fragment shader
fs.readFileSync(__dirname + '/blur.frag', 'utf8'),
// set the uniforms
{
strength: { type: '1f', value: 1 }
... | javascript | function BlurXFilter()
{
core.AbstractFilter.call(this,
// vertex shader
fs.readFileSync(__dirname + '/blurX.vert', 'utf8'),
// fragment shader
fs.readFileSync(__dirname + '/blur.frag', 'utf8'),
// set the uniforms
{
strength: { type: '1f', value: 1 }
... | [
"function",
"BlurXFilter",
"(",
")",
"{",
"core",
".",
"AbstractFilter",
".",
"call",
"(",
"this",
",",
"// vertex shader",
"fs",
".",
"readFileSync",
"(",
"__dirname",
"+",
"'/blurX.vert'",
",",
"'utf8'",
")",
",",
"// fragment shader",
"fs",
".",
"readFileSy... | The BlurXFilter applies a horizontal Gaussian blur to an object.
@class
@extends AbstractFilter
@memberof PIXI.filters | [
"The",
"BlurXFilter",
"applies",
"a",
"horizontal",
"Gaussian",
"blur",
"to",
"an",
"object",
"."
] | e023964d05afeefebdcac4e2044819fdfa3899ae | https://github.com/Nazariglez/perenquen/blob/e023964d05afeefebdcac4e2044819fdfa3899ae/lib/pixi/src/filters/blur/BlurXFilter.js#L12-L35 |
52,380 | meltmedia/node-usher | lib/activity/task.js | ActivityTask | function ActivityTask(task) {
if (!(this instanceof ActivityTask)) {
return new ActivityTask(task);
}
this.input = {};
if (task.config.input) {
this.input = JSON.parse(task.config.input);
}
// Depending on the language of the Decider impl, this can be an Array or Object
// This is a big assumpt... | javascript | function ActivityTask(task) {
if (!(this instanceof ActivityTask)) {
return new ActivityTask(task);
}
this.input = {};
if (task.config.input) {
this.input = JSON.parse(task.config.input);
}
// Depending on the language of the Decider impl, this can be an Array or Object
// This is a big assumpt... | [
"function",
"ActivityTask",
"(",
"task",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"ActivityTask",
")",
")",
"{",
"return",
"new",
"ActivityTask",
"(",
"task",
")",
";",
"}",
"this",
".",
"input",
"=",
"{",
"}",
";",
"if",
"(",
"task",
"... | The context for the execution of the activity
@constructor
@param {string} task - The raw `aws-swf` activity task | [
"The",
"context",
"for",
"the",
"execution",
"of",
"the",
"activity"
] | fe6183bf7097f84bef935e8d9c19463accc08ad6 | https://github.com/meltmedia/node-usher/blob/fe6183bf7097f84bef935e8d9c19463accc08ad6/lib/activity/task.js#L19-L56 |
52,381 | lemyskaman/kaman-core | kaman.functions.js | backboneOptsAsProps | function backboneOptsAsProps(subject, opts) {
if (!opts) {
opts = subject.options
}
subject.mergeOptions(subject.options, _.keys(opts));
//removing form view.options the options that ve been merged above
//so if we use view.getOption("opt") will return the merged opt and not the opt in view... | javascript | function backboneOptsAsProps(subject, opts) {
if (!opts) {
opts = subject.options
}
subject.mergeOptions(subject.options, _.keys(opts));
//removing form view.options the options that ve been merged above
//so if we use view.getOption("opt") will return the merged opt and not the opt in view... | [
"function",
"backboneOptsAsProps",
"(",
"subject",
",",
"opts",
")",
"{",
"if",
"(",
"!",
"opts",
")",
"{",
"opts",
"=",
"subject",
".",
"options",
"}",
"subject",
".",
"mergeOptions",
"(",
"subject",
".",
"options",
",",
"_",
".",
"keys",
"(",
"opts",... | It takes a Backbone Object as subject and merge all
opt as subjet properties removing the opt from view options
@param subject Backbone.Object, the object to operate over
@param opts Object, the options to add
@return void | [
"It",
"takes",
"a",
"Backbone",
"Object",
"as",
"subject",
"and",
"merge",
"all",
"opt",
"as",
"subjet",
"properties",
"removing",
"the",
"opt",
"from",
"view",
"options"
] | 331340a01879ec636a31961a81db9a58484d1381 | https://github.com/lemyskaman/kaman-core/blob/331340a01879ec636a31961a81db9a58484d1381/kaman.functions.js#L15-L29 |
52,382 | lemyskaman/kaman-core | kaman.functions.js | omitBackboneOptsAsProps | function omitBackboneOptsAsProps(subject, omit) {
console.log("omitBackboneOptsAsProps:")
console.log(subject, subject.options, omit, _.omit(subject.options, omit))
backboneOptsAsProps(subject, _.omit(subject.options, omit))
} | javascript | function omitBackboneOptsAsProps(subject, omit) {
console.log("omitBackboneOptsAsProps:")
console.log(subject, subject.options, omit, _.omit(subject.options, omit))
backboneOptsAsProps(subject, _.omit(subject.options, omit))
} | [
"function",
"omitBackboneOptsAsProps",
"(",
"subject",
",",
"omit",
")",
"{",
"console",
".",
"log",
"(",
"\"omitBackboneOptsAsProps:\"",
")",
"console",
".",
"log",
"(",
"subject",
",",
"subject",
".",
"options",
",",
"omit",
",",
"_",
".",
"omit",
"(",
"... | It takes a Backbone Object as subject and return same object without omit
@param subject Backbone.Object, the object to operate over
@param omit Array, the keys from subjet.options to omit
@return void | [
"It",
"takes",
"a",
"Backbone",
"Object",
"as",
"subject",
"and",
"return",
"same",
"object",
"without",
"omit"
] | 331340a01879ec636a31961a81db9a58484d1381 | https://github.com/lemyskaman/kaman-core/blob/331340a01879ec636a31961a81db9a58484d1381/kaman.functions.js#L38-L42 |
52,383 | lemyskaman/kaman-core | kaman.functions.js | kappInit | function kappInit(subject, callback) {
//if expose option is added we expose this view
console.log("kappInit:", subject)
if (subject.getOption("expose_as")) {
console.log("kappInit: found exposeAs option " + subject.getOption("expose_as"))
subject.exposeAs(subject.getOption("expose_as"))
... | javascript | function kappInit(subject, callback) {
//if expose option is added we expose this view
console.log("kappInit:", subject)
if (subject.getOption("expose_as")) {
console.log("kappInit: found exposeAs option " + subject.getOption("expose_as"))
subject.exposeAs(subject.getOption("expose_as"))
... | [
"function",
"kappInit",
"(",
"subject",
",",
"callback",
")",
"{",
"//if expose option is added we expose this view",
"console",
".",
"log",
"(",
"\"kappInit:\"",
",",
"subject",
")",
"if",
"(",
"subject",
".",
"getOption",
"(",
"\"expose_as\"",
")",
")",
"{",
"... | you got to bind view object to this function
@param {function} callback | [
"you",
"got",
"to",
"bind",
"view",
"object",
"to",
"this",
"function"
] | 331340a01879ec636a31961a81db9a58484d1381 | https://github.com/lemyskaman/kaman-core/blob/331340a01879ec636a31961a81db9a58484d1381/kaman.functions.js#L48-L71 |
52,384 | lemyskaman/kaman-core | kaman.functions.js | lang | function lang(key, source) {
//first we retrive the lang value of the root of the DOM
var LANG = document.documentElement.lang;
//console.log(source)
//console.log(LANG+' '+key+' - '+source[LANG][key]);
if (_.isObject(source) && _.isObject(source[LANG]) && _.isString(source[LANG][key])) {
re... | javascript | function lang(key, source) {
//first we retrive the lang value of the root of the DOM
var LANG = document.documentElement.lang;
//console.log(source)
//console.log(LANG+' '+key+' - '+source[LANG][key]);
if (_.isObject(source) && _.isObject(source[LANG]) && _.isString(source[LANG][key])) {
re... | [
"function",
"lang",
"(",
"key",
",",
"source",
")",
"{",
"//first we retrive the lang value of the root of the DOM",
"var",
"LANG",
"=",
"document",
".",
"documentElement",
".",
"lang",
";",
"//console.log(source)",
"//console.log(LANG+' '+key+' - '+source[LANG][key]);",
"if"... | utility function to get the language value from keys
on a languageSource object acording the specified language
comming from the server and placed in the
@param key String, the key to search of
@param source Object, the list to search for the key
@return string, the key value if it is in the source list, otherwise will... | [
"utility",
"function",
"to",
"get",
"the",
"language",
"value",
"from",
"keys",
"on",
"a",
"languageSource",
"object",
"acording",
"the",
"specified",
"language",
"comming",
"from",
"the",
"server",
"and",
"placed",
"in",
"the"
] | 331340a01879ec636a31961a81db9a58484d1381 | https://github.com/lemyskaman/kaman-core/blob/331340a01879ec636a31961a81db9a58484d1381/kaman.functions.js#L82-L93 |
52,385 | lemyskaman/kaman-core | kaman.functions.js | expose | function expose(subject, name) {
//console.log(window[name])
if (subject.isRendered()) {
exposer(subject, name);
} else {
subject.on("attach", function () {
exposer(subject, name);
})
}
} | javascript | function expose(subject, name) {
//console.log(window[name])
if (subject.isRendered()) {
exposer(subject, name);
} else {
subject.on("attach", function () {
exposer(subject, name);
})
}
} | [
"function",
"expose",
"(",
"subject",
",",
"name",
")",
"{",
"//console.log(window[name])",
"if",
"(",
"subject",
".",
"isRendered",
"(",
")",
")",
"{",
"exposer",
"(",
"subject",
",",
"name",
")",
";",
"}",
"else",
"{",
"subject",
".",
"on",
"(",
"\"a... | a tool to let some object to be exposed to window on
browsers avoiding overwrite existent objects | [
"a",
"tool",
"to",
"let",
"some",
"object",
"to",
"be",
"exposed",
"to",
"window",
"on",
"browsers",
"avoiding",
"overwrite",
"existent",
"objects"
] | 331340a01879ec636a31961a81db9a58484d1381 | https://github.com/lemyskaman/kaman-core/blob/331340a01879ec636a31961a81db9a58484d1381/kaman.functions.js#L118-L127 |
52,386 | lemyskaman/kaman-core | kaman.functions.js | commutate | function commutate(key, list) {
_.each(list, function (v, k, l) {
if (k === key) {
l[key] = true
}
if (v === true && k !== key) {
l[k] = false
}
})
} | javascript | function commutate(key, list) {
_.each(list, function (v, k, l) {
if (k === key) {
l[key] = true
}
if (v === true && k !== key) {
l[k] = false
}
})
} | [
"function",
"commutate",
"(",
"key",
",",
"list",
")",
"{",
"_",
".",
"each",
"(",
"list",
",",
"function",
"(",
"v",
",",
"k",
",",
"l",
")",
"{",
"if",
"(",
"k",
"===",
"key",
")",
"{",
"l",
"[",
"key",
"]",
"=",
"true",
"}",
"if",
"(",
... | this function will iterate over each list elements
setting the one on key to true an all other on false
@param key String, the key to set as true
@param list Object, the object to search for the key to set to true
@return void | [
"this",
"function",
"will",
"iterate",
"over",
"each",
"list",
"elements",
"setting",
"the",
"one",
"on",
"key",
"to",
"true",
"an",
"all",
"other",
"on",
"false"
] | 331340a01879ec636a31961a81db9a58484d1381 | https://github.com/lemyskaman/kaman-core/blob/331340a01879ec636a31961a81db9a58484d1381/kaman.functions.js#L136-L145 |
52,387 | GreenGremlin/karma-gzip-preprocessor | lib/Preprocessor.js | Preprocessor | function Preprocessor(config, logger) {
const log = logger.create('preprocessor.gzip');
return (content, file, done) => {
const originalSize = content.length;
// const contentBuffer = Buffer.isBuffer(content) ? content : Buffer.from(content);
zlib.gzip(content, (err, gzippedContent) => {
if (err... | javascript | function Preprocessor(config, logger) {
const log = logger.create('preprocessor.gzip');
return (content, file, done) => {
const originalSize = content.length;
// const contentBuffer = Buffer.isBuffer(content) ? content : Buffer.from(content);
zlib.gzip(content, (err, gzippedContent) => {
if (err... | [
"function",
"Preprocessor",
"(",
"config",
",",
"logger",
")",
"{",
"const",
"log",
"=",
"logger",
".",
"create",
"(",
"'preprocessor.gzip'",
")",
";",
"return",
"(",
"content",
",",
"file",
",",
"done",
")",
"=>",
"{",
"const",
"originalSize",
"=",
"con... | Preprocess files to provide a gzip compressed alternative version | [
"Preprocess",
"files",
"to",
"provide",
"a",
"gzip",
"compressed",
"alternative",
"version"
] | 2ceb15b0f4c58beb3e6a13d1a58c5140569a5877 | https://github.com/GreenGremlin/karma-gzip-preprocessor/blob/2ceb15b0f4c58beb3e6a13d1a58c5140569a5877/lib/Preprocessor.js#L5-L26 |
52,388 | apathetic/stickynav | dist/stickynav.es6.js | scrollPage | function scrollPage(to, offset, callback) {
if ( offset === void 0 ) offset = 0;
var startTime;
var duration = 500;
var startPos = window.pageYOffset;
var endPos = ~~(to.getBoundingClientRect().top - offset);
var scroll = function (timestamp) {
var elapsed;
startTime = startTime || timestamp;
... | javascript | function scrollPage(to, offset, callback) {
if ( offset === void 0 ) offset = 0;
var startTime;
var duration = 500;
var startPos = window.pageYOffset;
var endPos = ~~(to.getBoundingClientRect().top - offset);
var scroll = function (timestamp) {
var elapsed;
startTime = startTime || timestamp;
... | [
"function",
"scrollPage",
"(",
"to",
",",
"offset",
",",
"callback",
")",
"{",
"if",
"(",
"offset",
"===",
"void",
"0",
")",
"offset",
"=",
"0",
";",
"var",
"startTime",
";",
"var",
"duration",
"=",
"500",
";",
"var",
"startPos",
"=",
"window",
".",
... | Scroll the page to a particular page anchor
@param {HTMLElement} to The element to scroll to.
@param {number} offset A scrolling offset.
@param {function} callback Function to apply after scrolling
@return {void} | [
"Scroll",
"the",
"page",
"to",
"a",
"particular",
"page",
"anchor"
] | badde353ec6210d6b3759925d2308dc49aa2e65f | https://github.com/apathetic/stickynav/blob/badde353ec6210d6b3759925d2308dc49aa2e65f/dist/stickynav.es6.js#L136-L159 |
52,389 | apathetic/stickynav | dist/stickynav.es6.js | $$ | function $$(els) {
return els instanceof NodeList ? Array.prototype.slice.call(els) :
els instanceof HTMLElement ? [els] :
typeof els === 'string' ? Array.prototype.slice.call(document.querySelectorAll(els)) :
[];
} | javascript | function $$(els) {
return els instanceof NodeList ? Array.prototype.slice.call(els) :
els instanceof HTMLElement ? [els] :
typeof els === 'string' ? Array.prototype.slice.call(document.querySelectorAll(els)) :
[];
} | [
"function",
"$$",
"(",
"els",
")",
"{",
"return",
"els",
"instanceof",
"NodeList",
"?",
"Array",
".",
"prototype",
".",
"slice",
".",
"call",
"(",
"els",
")",
":",
"els",
"instanceof",
"HTMLElement",
"?",
"[",
"els",
"]",
":",
"typeof",
"els",
"===",
... | mini querySelectorAll helper fn | [
"mini",
"querySelectorAll",
"helper",
"fn"
] | badde353ec6210d6b3759925d2308dc49aa2e65f | https://github.com/apathetic/stickynav/blob/badde353ec6210d6b3759925d2308dc49aa2e65f/dist/stickynav.es6.js#L162-L167 |
52,390 | loggur-legacy/baucis-decorator-auth | index.js | requestHandler | function requestHandler (method) {
return function (req, res, next) {
method.call(this, req, responseHandler(res, next));
}.bind(this);
} | javascript | function requestHandler (method) {
return function (req, res, next) {
method.call(this, req, responseHandler(res, next));
}.bind(this);
} | [
"function",
"requestHandler",
"(",
"method",
")",
"{",
"return",
"function",
"(",
"req",
",",
"res",
",",
"next",
")",
"{",
"method",
".",
"call",
"(",
"this",
",",
"req",
",",
"responseHandler",
"(",
"res",
",",
"next",
")",
")",
";",
"}",
".",
"b... | Returns a request handler using some method.
@param {Function} method
@return {Function}
@api private | [
"Returns",
"a",
"request",
"handler",
"using",
"some",
"method",
"."
] | aa31cf625d3c7ba69d97e5d1c07e4dceffbb7dfb | https://github.com/loggur-legacy/baucis-decorator-auth/blob/aa31cf625d3c7ba69d97e5d1c07e4dceffbb7dfb/index.js#L51-L55 |
52,391 | loggur-legacy/baucis-decorator-auth | index.js | responseHandler | function responseHandler (res, next) {
return function (err, message) {
if (err || !message) {
next(err);
} else {
res.send(message);
}
}
} | javascript | function responseHandler (res, next) {
return function (err, message) {
if (err || !message) {
next(err);
} else {
res.send(message);
}
}
} | [
"function",
"responseHandler",
"(",
"res",
",",
"next",
")",
"{",
"return",
"function",
"(",
"err",
",",
"message",
")",
"{",
"if",
"(",
"err",
"||",
"!",
"message",
")",
"{",
"next",
"(",
"err",
")",
";",
"}",
"else",
"{",
"res",
".",
"send",
"(... | Returns a response handler using `res` and `next` from Express.
@param {Object} res
@param {Function} next
@return {Function}
@api private | [
"Returns",
"a",
"response",
"handler",
"using",
"res",
"and",
"next",
"from",
"Express",
"."
] | aa31cf625d3c7ba69d97e5d1c07e4dceffbb7dfb | https://github.com/loggur-legacy/baucis-decorator-auth/blob/aa31cf625d3c7ba69d97e5d1c07e4dceffbb7dfb/index.js#L65-L73 |
52,392 | loggur-legacy/baucis-decorator-auth | index.js | getPasswordObj | function getPasswordObj (values, keys) {
var passwordObj = {};
(keys || Object.keys(values)).forEach(function (key) {
passwordObj[values[key].password] = key;
});
return passwordObj;
} | javascript | function getPasswordObj (values, keys) {
var passwordObj = {};
(keys || Object.keys(values)).forEach(function (key) {
passwordObj[values[key].password] = key;
});
return passwordObj;
} | [
"function",
"getPasswordObj",
"(",
"values",
",",
"keys",
")",
"{",
"var",
"passwordObj",
"=",
"{",
"}",
";",
"(",
"keys",
"||",
"Object",
".",
"keys",
"(",
"values",
")",
")",
".",
"forEach",
"(",
"function",
"(",
"key",
")",
"{",
"passwordObj",
"["... | Gets the password keys from some set of values.
@param {Object} values
@param {Array} keys optional
@return {Object}
@api private | [
"Gets",
"the",
"password",
"keys",
"from",
"some",
"set",
"of",
"values",
"."
] | aa31cf625d3c7ba69d97e5d1c07e4dceffbb7dfb | https://github.com/loggur-legacy/baucis-decorator-auth/blob/aa31cf625d3c7ba69d97e5d1c07e4dceffbb7dfb/index.js#L170-L178 |
52,393 | loggur-legacy/baucis-decorator-auth | index.js | getResetterObj | function getResetterObj (values, keys) {
var resetterObj = {};
(keys || Object.keys(values)).forEach(function (key) {
if (values[key].resetter) {
resetterObj[values[key].resetter] = key;
}
});
return resetterObj;
} | javascript | function getResetterObj (values, keys) {
var resetterObj = {};
(keys || Object.keys(values)).forEach(function (key) {
if (values[key].resetter) {
resetterObj[values[key].resetter] = key;
}
});
return resetterObj;
} | [
"function",
"getResetterObj",
"(",
"values",
",",
"keys",
")",
"{",
"var",
"resetterObj",
"=",
"{",
"}",
";",
"(",
"keys",
"||",
"Object",
".",
"keys",
"(",
"values",
")",
")",
".",
"forEach",
"(",
"function",
"(",
"key",
")",
"{",
"if",
"(",
"valu... | Gets the resetter keys from some set of values.
@param {Object} values
@param {Array} keys optional
@return {Object}
@api private | [
"Gets",
"the",
"resetter",
"keys",
"from",
"some",
"set",
"of",
"values",
"."
] | aa31cf625d3c7ba69d97e5d1c07e4dceffbb7dfb | https://github.com/loggur-legacy/baucis-decorator-auth/blob/aa31cf625d3c7ba69d97e5d1c07e4dceffbb7dfb/index.js#L372-L382 |
52,394 | berkeleybop/bbop-core | lib/core.js | _first_split | function _first_split(character, string){
var retlist = null;
var eq_loc = string.indexOf(character);
if( eq_loc == 0 ){
retlist = ['', string.substr(eq_loc +1, string.length)];
}else if( eq_loc > 0 ){
var before = string.substr(0, eq_loc);
var after = string.substr(eq_loc +1, string.length);
... | javascript | function _first_split(character, string){
var retlist = null;
var eq_loc = string.indexOf(character);
if( eq_loc == 0 ){
retlist = ['', string.substr(eq_loc +1, string.length)];
}else if( eq_loc > 0 ){
var before = string.substr(0, eq_loc);
var after = string.substr(eq_loc +1, string.length);
... | [
"function",
"_first_split",
"(",
"character",
",",
"string",
")",
"{",
"var",
"retlist",
"=",
"null",
";",
"var",
"eq_loc",
"=",
"string",
".",
"indexOf",
"(",
"character",
")",
";",
"if",
"(",
"eq_loc",
"==",
"0",
")",
"{",
"retlist",
"=",
"[",
"''"... | Attempt to return a two part split on the first occurrence of a
character.
Returns '' for parts not found.
Unit tests make the edge cases clear.
@function
@name module:bbop-core#first_split
@param {String} character - the character to split on
@param {String} string - the string to split
@returns {Array} list of fir... | [
"Attempt",
"to",
"return",
"a",
"two",
"part",
"split",
"on",
"the",
"first",
"occurrence",
"of",
"a",
"character",
"."
] | d9ce82a3a7d4f5e7300c0b637d8f7ff0e6969adf | https://github.com/berkeleybop/bbop-core/blob/d9ce82a3a7d4f5e7300c0b637d8f7ff0e6969adf/lib/core.js#L189-L205 |
52,395 | berkeleybop/bbop-core | lib/core.js | function(str, lim, suff){
var ret = str;
var limit = 10;
if( lim ){ limit = lim; }
var suffix = '';
if( suff ){ suffix = suff; }
if( str.length > limit ){
ret = str.substring(0, (limit - suffix.length)) + suffix;
}
return ret;
} | javascript | function(str, lim, suff){
var ret = str;
var limit = 10;
if( lim ){ limit = lim; }
var suffix = '';
if( suff ){ suffix = suff; }
if( str.length > limit ){
ret = str.substring(0, (limit - suffix.length)) + suffix;
}
return ret;
} | [
"function",
"(",
"str",
",",
"lim",
",",
"suff",
")",
"{",
"var",
"ret",
"=",
"str",
";",
"var",
"limit",
"=",
"10",
";",
"if",
"(",
"lim",
")",
"{",
"limit",
"=",
"lim",
";",
"}",
"var",
"suffix",
"=",
"''",
";",
"if",
"(",
"suff",
")",
"{... | Crop a string nicely.
Returns: Nothing. Side-effects: throws an error if the namespace
defined by the strings is not currently found.
@param {} str - the string to crop
@param {} lim - the final length to crop to (optional, defaults to 10)
@param {} suff - the string to add to the end (optional, defaults to '')
@retu... | [
"Crop",
"a",
"string",
"nicely",
"."
] | d9ce82a3a7d4f5e7300c0b637d8f7ff0e6969adf | https://github.com/berkeleybop/bbop-core/blob/d9ce82a3a7d4f5e7300c0b637d8f7ff0e6969adf/lib/core.js#L227-L240 | |
52,396 | berkeleybop/bbop-core | lib/core.js | function(older_hash, newer_hash){
if( ! older_hash ){ older_hash = {}; }
if( ! newer_hash ){ newer_hash = {}; }
var ret_hash = {};
function _add (val, key){
ret_hash[key] = val;
}
each(older_hash, _add);
each(newer_hash, _add);
return ret_hash;
} | javascript | function(older_hash, newer_hash){
if( ! older_hash ){ older_hash = {}; }
if( ! newer_hash ){ newer_hash = {}; }
var ret_hash = {};
function _add (val, key){
ret_hash[key] = val;
}
each(older_hash, _add);
each(newer_hash, _add);
return ret_hash;
} | [
"function",
"(",
"older_hash",
",",
"newer_hash",
")",
"{",
"if",
"(",
"!",
"older_hash",
")",
"{",
"older_hash",
"=",
"{",
"}",
";",
"}",
"if",
"(",
"!",
"newer_hash",
")",
"{",
"newer_hash",
"=",
"{",
"}",
";",
"}",
"var",
"ret_hash",
"=",
"{",
... | Merge a pair of hashes together, the second hash getting
precedence. This is a superset of the keys both hashes.
@see module:bbop-core.fold
@param {} older_hash - first pass
@param {} newer_hash - second pass
@returns {object} a new hash | [
"Merge",
"a",
"pair",
"of",
"hashes",
"together",
"the",
"second",
"hash",
"getting",
"precedence",
".",
"This",
"is",
"a",
"superset",
"of",
"the",
"keys",
"both",
"hashes",
"."
] | d9ce82a3a7d4f5e7300c0b637d8f7ff0e6969adf | https://github.com/berkeleybop/bbop-core/blob/d9ce82a3a7d4f5e7300c0b637d8f7ff0e6969adf/lib/core.js#L280-L292 | |
52,397 | berkeleybop/bbop-core | lib/core.js | function(in_thing, filter_function, sort_function){
var ret = [];
// Probably an not array then.
if( typeof(in_thing) === 'undefined' ){
// this is a nothing, to nothing....
}else if( typeof(in_thing) != 'object' ){
throw new Error('Unsupported type in bbop.core.pare: ' +
typeof(in_thing) );
}e... | javascript | function(in_thing, filter_function, sort_function){
var ret = [];
// Probably an not array then.
if( typeof(in_thing) === 'undefined' ){
// this is a nothing, to nothing....
}else if( typeof(in_thing) != 'object' ){
throw new Error('Unsupported type in bbop.core.pare: ' +
typeof(in_thing) );
}e... | [
"function",
"(",
"in_thing",
",",
"filter_function",
",",
"sort_function",
")",
"{",
"var",
"ret",
"=",
"[",
"]",
";",
"// Probably an not array then.",
"if",
"(",
"typeof",
"(",
"in_thing",
")",
"===",
"'undefined'",
")",
"{",
"// this is a nothing, to nothing...... | Take an array or hash and pare it down using a couple of functions
to what we want.
Both parameters are optional in the sense that you can set them to
null and they will have no function; i.e. a null filter will let
everything through and a null sort will let things go in whatever
order.
@param {Array|Object} in_thin... | [
"Take",
"an",
"array",
"or",
"hash",
"and",
"pare",
"it",
"down",
"using",
"a",
"couple",
"of",
"functions",
"to",
"what",
"we",
"want",
"."
] | d9ce82a3a7d4f5e7300c0b637d8f7ff0e6969adf | https://github.com/berkeleybop/bbop-core/blob/d9ce82a3a7d4f5e7300c0b637d8f7ff0e6969adf/lib/core.js#L487-L535 | |
52,398 | berkeleybop/bbop-core | lib/core.js | function(iobj, interface_list){
var retval = true;
each(interface_list, function(iface){
//print('|' + typeof(in_key) + ' || ' + typeof(in_val));
//print('|' + in_key + ' || ' + in_val);
if( typeof(iobj[iface]) == 'undefined' &&
typeof(iobj.prototype[iface]) == 'undefined' ){
retval = false;
... | javascript | function(iobj, interface_list){
var retval = true;
each(interface_list, function(iface){
//print('|' + typeof(in_key) + ' || ' + typeof(in_val));
//print('|' + in_key + ' || ' + in_val);
if( typeof(iobj[iface]) == 'undefined' &&
typeof(iobj.prototype[iface]) == 'undefined' ){
retval = false;
... | [
"function",
"(",
"iobj",
",",
"interface_list",
")",
"{",
"var",
"retval",
"=",
"true",
";",
"each",
"(",
"interface_list",
",",
"function",
"(",
"iface",
")",
"{",
"//print('|' + typeof(in_key) + ' || ' + typeof(in_val));",
"//print('|' + in_key + ' || ' + in_val);",
"... | Check to see if all top-level objects in a namespace supply an
"interface".
Mostly intended for use during unit testing.
TODO: Unit test this to make sure it catches both prototype (okay I
think) and uninstantiated objects (harder/impossible?).
@param {} iobj - the object/constructor in question
@param {} interface_... | [
"Check",
"to",
"see",
"if",
"all",
"top",
"-",
"level",
"objects",
"in",
"a",
"namespace",
"supply",
"an",
"interface",
"."
] | d9ce82a3a7d4f5e7300c0b637d8f7ff0e6969adf | https://github.com/berkeleybop/bbop-core/blob/d9ce82a3a7d4f5e7300c0b637d8f7ff0e6969adf/lib/core.js#L586-L599 | |
52,399 | berkeleybop/bbop-core | lib/core.js | function(qargs){
var mbuff = [];
for( var qname in qargs ){
var qval = qargs[qname];
// null is technically an object, but we don't want to render
// it.
if( qval != null ){
if( typeof qval == 'string' || typeof qval == 'number' ){
// Is standard name/value pair.
var nano_buffer = ... | javascript | function(qargs){
var mbuff = [];
for( var qname in qargs ){
var qval = qargs[qname];
// null is technically an object, but we don't want to render
// it.
if( qval != null ){
if( typeof qval == 'string' || typeof qval == 'number' ){
// Is standard name/value pair.
var nano_buffer = ... | [
"function",
"(",
"qargs",
")",
"{",
"var",
"mbuff",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"qname",
"in",
"qargs",
")",
"{",
"var",
"qval",
"=",
"qargs",
"[",
"qname",
"]",
";",
"// null is technically an object, but we don't want to render",
"// it.",
"if",... | Assemble an object into a GET-like query. You probably want to see
the tests to get an idea of what this is doing.
The last argument of double hashes gets quoted (Solr-esque),
otherwise not. It will try and avoid adding additional sets of
quotes to strings.
This does nothing to make the produced "URL" in any way safe... | [
"Assemble",
"an",
"object",
"into",
"a",
"GET",
"-",
"like",
"query",
".",
"You",
"probably",
"want",
"to",
"see",
"the",
"tests",
"to",
"get",
"an",
"idea",
"of",
"what",
"this",
"is",
"doing",
"."
] | d9ce82a3a7d4f5e7300c0b637d8f7ff0e6969adf | https://github.com/berkeleybop/bbop-core/blob/d9ce82a3a7d4f5e7300c0b637d8f7ff0e6969adf/lib/core.js#L617-L707 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.