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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
47,200 | mikesamuel/pug-plugin-trusted-types | packages/plugin/index.js | apply | function apply(x) {
const policyPathLength = policyPath.length;
policyPath[policyPathLength] = x;
if (Array.isArray(x)) {
for (let i = 0, len = x.length; i < len; ++i) {
policyPath[policyPathLength + 1] = i;
apply(x[i]);
}
} else if (x && typeof x === 'object'... | javascript | function apply(x) {
const policyPathLength = policyPath.length;
policyPath[policyPathLength] = x;
if (Array.isArray(x)) {
for (let i = 0, len = x.length; i < len; ++i) {
policyPath[policyPathLength + 1] = i;
apply(x[i]);
}
} else if (x && typeof x === 'object'... | [
"function",
"apply",
"(",
"x",
")",
"{",
"const",
"policyPathLength",
"=",
"policyPath",
".",
"length",
";",
"policyPath",
"[",
"policyPathLength",
"]",
"=",
"x",
";",
"if",
"(",
"Array",
".",
"isArray",
"(",
"x",
")",
")",
"{",
"for",
"(",
"let",
"i... | Walk the AST applying the policy | [
"Walk",
"the",
"AST",
"applying",
"the",
"policy"
] | 772c5aa30ca27d46dfddd654d7a60f16fa4519d6 | https://github.com/mikesamuel/pug-plugin-trusted-types/blob/772c5aa30ca27d46dfddd654d7a60f16fa4519d6/packages/plugin/index.js#L570-L597 |
47,201 | theThings/jailed-node | lib/Plugin.js | Plugin | function Plugin(script, _interface, options) {
this._script = script
this._options = options || {}
this._initialInterface = _interface || {}
this._connect()
} | javascript | function Plugin(script, _interface, options) {
this._script = script
this._options = options || {}
this._initialInterface = _interface || {}
this._connect()
} | [
"function",
"Plugin",
"(",
"script",
",",
"_interface",
",",
"options",
")",
"{",
"this",
".",
"_script",
"=",
"script",
"this",
".",
"_options",
"=",
"options",
"||",
"{",
"}",
"this",
".",
"_initialInterface",
"=",
"_interface",
"||",
"{",
"}",
"this",... | Plugin constructor, represents a plugin initialized by a script
with the given path
@param {String} url of a plugin source
@param {Object} _interface to provide for the plugin | [
"Plugin",
"constructor",
"represents",
"a",
"plugin",
"initialized",
"by",
"a",
"script",
"with",
"the",
"given",
"path"
] | 6e453d97e74fbd1c0b27b982084f6fd7c1aa0173 | https://github.com/theThings/jailed-node/blob/6e453d97e74fbd1c0b27b982084f6fd7c1aa0173/lib/Plugin.js#L18-L23 |
47,202 | aeroith/epub-metadata-parser | lib/epub-metadata-parser.js | function (arr) {
var jsonData = {};
_.forEach(arr, function (elem) {
var keys = Object.keys(elem);
_.forEach(keys, function (key) {
var value = elem[key];
jsonData[key] = value;
});
})
return jsonData;
} | javascript | function (arr) {
var jsonData = {};
_.forEach(arr, function (elem) {
var keys = Object.keys(elem);
_.forEach(keys, function (key) {
var value = elem[key];
jsonData[key] = value;
});
})
return jsonData;
} | [
"function",
"(",
"arr",
")",
"{",
"var",
"jsonData",
"=",
"{",
"}",
";",
"_",
".",
"forEach",
"(",
"arr",
",",
"function",
"(",
"elem",
")",
"{",
"var",
"keys",
"=",
"Object",
".",
"keys",
"(",
"elem",
")",
";",
"_",
".",
"forEach",
"(",
"keys"... | a helper function to convert an array to json object | [
"a",
"helper",
"function",
"to",
"convert",
"an",
"array",
"to",
"json",
"object"
] | e52e5066967ba8c8a0f86d2768416ab407d05e47 | https://github.com/aeroith/epub-metadata-parser/blob/e52e5066967ba8c8a0f86d2768416ab407d05e47/lib/epub-metadata-parser.js#L165-L175 | |
47,203 | gribnoysup/nfield-api | index.js | bindAPI | function bindAPI (self, api, fnName) {
return api[fnName].bind(self, self.__REQUEST_OPTIONS, self.__CREDENTIALS, self.__TOKEN);
} | javascript | function bindAPI (self, api, fnName) {
return api[fnName].bind(self, self.__REQUEST_OPTIONS, self.__CREDENTIALS, self.__TOKEN);
} | [
"function",
"bindAPI",
"(",
"self",
",",
"api",
",",
"fnName",
")",
"{",
"return",
"api",
"[",
"fnName",
"]",
".",
"bind",
"(",
"self",
",",
"self",
".",
"__REQUEST_OPTIONS",
",",
"self",
".",
"__CREDENTIALS",
",",
"self",
".",
"__TOKEN",
")",
";",
"... | A little wrapper for easy binding API functions to ConnectedInstance | [
"A",
"little",
"wrapper",
"for",
"easy",
"binding",
"API",
"functions",
"to",
"ConnectedInstance"
] | fcd635255fad2fc483d0e9045ecf7faba04378d9 | https://github.com/gribnoysup/nfield-api/blob/fcd635255fad2fc483d0e9045ecf7faba04378d9/index.js#L10-L12 |
47,204 | gribnoysup/nfield-api | index.js | ConnectedInstance | function ConnectedInstance (requestOptions, authToken, credentials) {
this.__REQUEST_OPTIONS = requestOptions;
this.__TOKEN = authToken;
this.__CREDENTIALS = credentials;
this.SurveyFieldwork = {
status : bindAPI(this, API, 'statusSurveyFieldwork'),
start : bindAPI(this, API, 'startSurveyFieldwork'),... | javascript | function ConnectedInstance (requestOptions, authToken, credentials) {
this.__REQUEST_OPTIONS = requestOptions;
this.__TOKEN = authToken;
this.__CREDENTIALS = credentials;
this.SurveyFieldwork = {
status : bindAPI(this, API, 'statusSurveyFieldwork'),
start : bindAPI(this, API, 'startSurveyFieldwork'),... | [
"function",
"ConnectedInstance",
"(",
"requestOptions",
",",
"authToken",
",",
"credentials",
")",
"{",
"this",
".",
"__REQUEST_OPTIONS",
"=",
"requestOptions",
";",
"this",
".",
"__TOKEN",
"=",
"authToken",
";",
"this",
".",
"__CREDENTIALS",
"=",
"credentials",
... | Creates an instance of object, connected to Nfield API
@constructor | [
"Creates",
"an",
"instance",
"of",
"object",
"connected",
"to",
"Nfield",
"API"
] | fcd635255fad2fc483d0e9045ecf7faba04378d9 | https://github.com/gribnoysup/nfield-api/blob/fcd635255fad2fc483d0e9045ecf7faba04378d9/index.js#L18-L82 |
47,205 | gribnoysup/nfield-api | index.js | NfieldClient | function NfieldClient (defOptions) {
var defaultRequestCliOptions = {
baseUrl : 'https://api.nfieldmr.com/'
};
extend(true, defaultRequestCliOptions, defOptions);
/**
* Sign In api method provided strait with NfieldCliend instance because it doesn't need authentication
*/
this.SignIn = API.... | javascript | function NfieldClient (defOptions) {
var defaultRequestCliOptions = {
baseUrl : 'https://api.nfieldmr.com/'
};
extend(true, defaultRequestCliOptions, defOptions);
/**
* Sign In api method provided strait with NfieldCliend instance because it doesn't need authentication
*/
this.SignIn = API.... | [
"function",
"NfieldClient",
"(",
"defOptions",
")",
"{",
"var",
"defaultRequestCliOptions",
"=",
"{",
"baseUrl",
":",
"'https://api.nfieldmr.com/'",
"}",
";",
"extend",
"(",
"true",
",",
"defaultRequestCliOptions",
",",
"defOptions",
")",
";",
"/**\n * Sign In api m... | Creates NfieldClient object
@constructor | [
"Creates",
"NfieldClient",
"object"
] | fcd635255fad2fc483d0e9045ecf7faba04378d9 | https://github.com/gribnoysup/nfield-api/blob/fcd635255fad2fc483d0e9045ecf7faba04378d9/index.js#L88-L135 |
47,206 | alexyoung/pop | lib/server.js | server | function server() {
// TODO: Show require express error
var express = require('express')
, app = express();
app.configure(function() {
app.use(express.static(siteBuilder.outputRoot));
app.use(express.errorHandler({ dumpExceptions: true, showStack: true }));
});
// Map missing trailing slashes fo... | javascript | function server() {
// TODO: Show require express error
var express = require('express')
, app = express();
app.configure(function() {
app.use(express.static(siteBuilder.outputRoot));
app.use(express.errorHandler({ dumpExceptions: true, showStack: true }));
});
// Map missing trailing slashes fo... | [
"function",
"server",
"(",
")",
"{",
"// TODO: Show require express error",
"var",
"express",
"=",
"require",
"(",
"'express'",
")",
",",
"app",
"=",
"express",
"(",
")",
";",
"app",
".",
"configure",
"(",
"function",
"(",
")",
"{",
"app",
".",
"use",
"(... | Instantiates and runs the Express server. | [
"Instantiates",
"and",
"runs",
"the",
"Express",
"server",
"."
] | 8a0b3f2605cb58e8ae6b34f1373dde00610e9858 | https://github.com/alexyoung/pop/blob/8a0b3f2605cb58e8ae6b34f1373dde00610e9858/lib/server.js#L18-L41 |
47,207 | edus44/express-deliver | lib/response/error.js | normalizeError | function normalizeError(err,pools){
if (!(err instanceof Error)){
err = new Error(err)
}
if (!err._isException){
//Iterate over exceptionPools finding error match
for(let i=0;i<pools.length;i++){
let exception = pools[i]._convert(err)
if (exception) return ex... | javascript | function normalizeError(err,pools){
if (!(err instanceof Error)){
err = new Error(err)
}
if (!err._isException){
//Iterate over exceptionPools finding error match
for(let i=0;i<pools.length;i++){
let exception = pools[i]._convert(err)
if (exception) return ex... | [
"function",
"normalizeError",
"(",
"err",
",",
"pools",
")",
"{",
"if",
"(",
"!",
"(",
"err",
"instanceof",
"Error",
")",
")",
"{",
"err",
"=",
"new",
"Error",
"(",
"err",
")",
"}",
"if",
"(",
"!",
"err",
".",
"_isException",
")",
"{",
"//Iterate o... | Tries to always return an expressDeliver exception
@param {any} err
@param {Array<ExceptionPool>} pools
@return {Exception} | [
"Tries",
"to",
"always",
"return",
"an",
"expressDeliver",
"exception"
] | 895abfaf2e5e48a00b4fef943dccaffcbf244780 | https://github.com/edus44/express-deliver/blob/895abfaf2e5e48a00b4fef943dccaffcbf244780/lib/response/error.js#L31-L44 |
47,208 | edus44/express-deliver | lib/response/error.js | defaultTransformError | function defaultTransformError(err,req){
let body = {
code: err.code,
message: err.message,
data: err.data,
}
if (req._expressDeliverOptions.printErrorStack===true){
body.stack = err.stack
}
if (err.name == 'InternalError' && req._expressDeliverOptions.printInternal... | javascript | function defaultTransformError(err,req){
let body = {
code: err.code,
message: err.message,
data: err.data,
}
if (req._expressDeliverOptions.printErrorStack===true){
body.stack = err.stack
}
if (err.name == 'InternalError' && req._expressDeliverOptions.printInternal... | [
"function",
"defaultTransformError",
"(",
"err",
",",
"req",
")",
"{",
"let",
"body",
"=",
"{",
"code",
":",
"err",
".",
"code",
",",
"message",
":",
"err",
".",
"message",
",",
"data",
":",
"err",
".",
"data",
",",
"}",
"if",
"(",
"req",
".",
"_... | Default error response transformation
@param {Exception} err
@param {Request} req
@return {Object} | [
"Default",
"error",
"response",
"transformation"
] | 895abfaf2e5e48a00b4fef943dccaffcbf244780 | https://github.com/edus44/express-deliver/blob/895abfaf2e5e48a00b4fef943dccaffcbf244780/lib/response/error.js#L68-L87 |
47,209 | pumpumba/Influsion-back-end | machinepack-youtubenodemachines/youtubeAPICalls.js | getChannel | function getChannel(auth, youtube, channelID, callback) {
youtube.channels.list( // Call the Youtube API
{
auth: auth,
part: "snippet, statistics",
order: "date",
id: channelID,
maxResults: 1 // Integer 0-50, default 5
},
function(err, res) {
if (err) {
console.... | javascript | function getChannel(auth, youtube, channelID, callback) {
youtube.channels.list( // Call the Youtube API
{
auth: auth,
part: "snippet, statistics",
order: "date",
id: channelID,
maxResults: 1 // Integer 0-50, default 5
},
function(err, res) {
if (err) {
console.... | [
"function",
"getChannel",
"(",
"auth",
",",
"youtube",
",",
"channelID",
",",
"callback",
")",
"{",
"youtube",
".",
"channels",
".",
"list",
"(",
"// Call the Youtube API",
"{",
"auth",
":",
"auth",
",",
"part",
":",
"\"snippet, statistics\"",
",",
"order",
... | Get a Youtube channel via channel ID | [
"Get",
"a",
"Youtube",
"channel",
"via",
"channel",
"ID"
] | 68ba7a42e415f08eb16551b564ee384011e1918e | https://github.com/pumpumba/Influsion-back-end/blob/68ba7a42e415f08eb16551b564ee384011e1918e/machinepack-youtubenodemachines/youtubeAPICalls.js#L31-L53 |
47,210 | pumpumba/Influsion-back-end | machinepack-youtubenodemachines/youtubeAPICalls.js | getChannelUsername | function getChannelUsername(auth, youtube, username, callback) {
youtube.channels.list( // Call the Youtube API
{
auth: auth,
part: "snippet, statistics",
order: "date",
forUsername: username,
maxResults: 1 // Integer 0-50, default 5
},
function(err, res) {
if (err) {
... | javascript | function getChannelUsername(auth, youtube, username, callback) {
youtube.channels.list( // Call the Youtube API
{
auth: auth,
part: "snippet, statistics",
order: "date",
forUsername: username,
maxResults: 1 // Integer 0-50, default 5
},
function(err, res) {
if (err) {
... | [
"function",
"getChannelUsername",
"(",
"auth",
",",
"youtube",
",",
"username",
",",
"callback",
")",
"{",
"youtube",
".",
"channels",
".",
"list",
"(",
"// Call the Youtube API",
"{",
"auth",
":",
"auth",
",",
"part",
":",
"\"snippet, statistics\"",
",",
"ord... | Get a Youtube channel via channel name | [
"Get",
"a",
"Youtube",
"channel",
"via",
"channel",
"name"
] | 68ba7a42e415f08eb16551b564ee384011e1918e | https://github.com/pumpumba/Influsion-back-end/blob/68ba7a42e415f08eb16551b564ee384011e1918e/machinepack-youtubenodemachines/youtubeAPICalls.js#L56-L78 |
47,211 | pumpumba/Influsion-back-end | machinepack-youtubenodemachines/youtubeAPICalls.js | getVideos | function getVideos(auth, youtube, channel_id, count, callback) {
youtube.search.list( // Call the Youtube API
{
auth: auth,
part: "snippet",
order: "date",
maxResults : count, //integer 0-50, default 5
channelId: channel_id
},
function(err, res) {
if (err) {
console.log("The API re... | javascript | function getVideos(auth, youtube, channel_id, count, callback) {
youtube.search.list( // Call the Youtube API
{
auth: auth,
part: "snippet",
order: "date",
maxResults : count, //integer 0-50, default 5
channelId: channel_id
},
function(err, res) {
if (err) {
console.log("The API re... | [
"function",
"getVideos",
"(",
"auth",
",",
"youtube",
",",
"channel_id",
",",
"count",
",",
"callback",
")",
"{",
"youtube",
".",
"search",
".",
"list",
"(",
"// Call the Youtube API",
"{",
"auth",
":",
"auth",
",",
"part",
":",
"\"snippet\"",
",",
"order"... | Get Youtube videos via channel ID | [
"Get",
"Youtube",
"videos",
"via",
"channel",
"ID"
] | 68ba7a42e415f08eb16551b564ee384011e1918e | https://github.com/pumpumba/Influsion-back-end/blob/68ba7a42e415f08eb16551b564ee384011e1918e/machinepack-youtubenodemachines/youtubeAPICalls.js#L106-L126 |
47,212 | pumpumba/Influsion-back-end | machinepack-youtubenodemachines/youtubeAPICalls.js | getVideoStatistics | function getVideoStatistics(auth, youtube, items, count, callback) {
// Convert the video ID:s of the provided videos to the appropriate format
var IDs = "";
if (Array.isArray(items)) {
for (var i = 0; i < items.length; i++) {
if (i != 0) {
IDs += ", "
}
IDs += items[i].id.videoId;
... | javascript | function getVideoStatistics(auth, youtube, items, count, callback) {
// Convert the video ID:s of the provided videos to the appropriate format
var IDs = "";
if (Array.isArray(items)) {
for (var i = 0; i < items.length; i++) {
if (i != 0) {
IDs += ", "
}
IDs += items[i].id.videoId;
... | [
"function",
"getVideoStatistics",
"(",
"auth",
",",
"youtube",
",",
"items",
",",
"count",
",",
"callback",
")",
"{",
"// Convert the video ID:s of the provided videos to the appropriate format",
"var",
"IDs",
"=",
"\"\"",
";",
"if",
"(",
"Array",
".",
"isArray",
"(... | Get video statistics | [
"Get",
"video",
"statistics"
] | 68ba7a42e415f08eb16551b564ee384011e1918e | https://github.com/pumpumba/Influsion-back-end/blob/68ba7a42e415f08eb16551b564ee384011e1918e/machinepack-youtubenodemachines/youtubeAPICalls.js#L129-L157 |
47,213 | pumpumba/Influsion-back-end | machinepack-youtubenodemachines/youtubeAPICalls.js | formatVideosJson | function formatVideosJson(videos, statistics) {
var formatedVideos = []
if (Array.isArray(videos)) {
for (var i = 0; i < videos.length; i++) {
var video = {
"platform": "Youtube",
"channel_id": videos[i].snippet.channelId,
"channel_url": "",
"channel_title": videos[i].snip... | javascript | function formatVideosJson(videos, statistics) {
var formatedVideos = []
if (Array.isArray(videos)) {
for (var i = 0; i < videos.length; i++) {
var video = {
"platform": "Youtube",
"channel_id": videos[i].snippet.channelId,
"channel_url": "",
"channel_title": videos[i].snip... | [
"function",
"formatVideosJson",
"(",
"videos",
",",
"statistics",
")",
"{",
"var",
"formatedVideos",
"=",
"[",
"]",
"if",
"(",
"Array",
".",
"isArray",
"(",
"videos",
")",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"videos",
".",
"l... | Format the JSON object containing the video data | [
"Format",
"the",
"JSON",
"object",
"containing",
"the",
"video",
"data"
] | 68ba7a42e415f08eb16551b564ee384011e1918e | https://github.com/pumpumba/Influsion-back-end/blob/68ba7a42e415f08eb16551b564ee384011e1918e/machinepack-youtubenodemachines/youtubeAPICalls.js#L190-L231 |
47,214 | nicjansma/breakup.js | lib/breakup.js | function() {
// run iterator for this item
iterator(arr[current], function(err) {
// check for any errors with this element
if (err) {
callback(err, yielded);
} else {
// move onto the next element
... | javascript | function() {
// run iterator for this item
iterator(arr[current], function(err) {
// check for any errors with this element
if (err) {
callback(err, yielded);
} else {
// move onto the next element
... | [
"function",
"(",
")",
"{",
"// run iterator for this item",
"iterator",
"(",
"arr",
"[",
"current",
"]",
",",
"function",
"(",
"err",
")",
"{",
"// check for any errors with this element",
"if",
"(",
"err",
")",
"{",
"callback",
"(",
"err",
",",
"yielded",
")"... | Iteration loop function. Called once for each element | [
"Iteration",
"loop",
"function",
".",
"Called",
"once",
"for",
"each",
"element"
] | d87a35514301ca150109979b814b9a5fc205079c | https://github.com/nicjansma/breakup.js/blob/d87a35514301ca150109979b814b9a5fc205079c/lib/breakup.js#L117-L161 | |
47,215 | reworkcss/rework-plugin-at2x | index.js | combineMediaQuery | function combineMediaQuery(base, additional) {
var finalQuery = [];
base.forEach(function(b) {
additional.forEach(function(a) {
finalQuery.push(b + ' and ' + a);
});
});
return finalQuery.join(', ');
} | javascript | function combineMediaQuery(base, additional) {
var finalQuery = [];
base.forEach(function(b) {
additional.forEach(function(a) {
finalQuery.push(b + ' and ' + a);
});
});
return finalQuery.join(', ');
} | [
"function",
"combineMediaQuery",
"(",
"base",
",",
"additional",
")",
"{",
"var",
"finalQuery",
"=",
"[",
"]",
";",
"base",
".",
"forEach",
"(",
"function",
"(",
"b",
")",
"{",
"additional",
".",
"forEach",
"(",
"function",
"(",
"a",
")",
"{",
"finalQu... | Combines existing media query with 2x media query. | [
"Combines",
"existing",
"media",
"query",
"with",
"2x",
"media",
"query",
"."
] | 404b240e69f7ee3814f100e877732d7281c178d7 | https://github.com/reworkcss/rework-plugin-at2x/blob/404b240e69f7ee3814f100e877732d7281c178d7/index.js#L109-L117 |
47,216 | BlackWaspTech/wasp-graphql | src/query.js | query | function query(url, init) {
// Reject if user provided no arguments
if (!url || typeof url !== 'string') {
return Promise.reject(
"Expected a non-empty string for 'url' but received: " + typeof url
);
}
// Reject if user provided an invalid second argument
if (!init) {
return Prom... | javascript | function query(url, init) {
// Reject if user provided no arguments
if (!url || typeof url !== 'string') {
return Promise.reject(
"Expected a non-empty string for 'url' but received: " + typeof url
);
}
// Reject if user provided an invalid second argument
if (!init) {
return Prom... | [
"function",
"query",
"(",
"url",
",",
"init",
")",
"{",
"// Reject if user provided no arguments\r",
"if",
"(",
"!",
"url",
"||",
"typeof",
"url",
"!==",
"'string'",
")",
"{",
"return",
"Promise",
".",
"reject",
"(",
"\"Expected a non-empty string for 'url' but rece... | Provides a thin, GQL-compliant wrapper over the Fetch API.
Syntax: query(url, init)
@param {string} url - The url for the intended resource
@param {(string|Object)} init - Can be a string of fields or a configuration object
@param {string} [init.fields] - GQL fields: Will be added to the body of the request
@param {O... | [
"Provides",
"a",
"thin",
"GQL",
"-",
"compliant",
"wrapper",
"over",
"the",
"Fetch",
"API",
"."
] | 5857b82b6eda9bb5dea5f0a881cd910b1bb3944a | https://github.com/BlackWaspTech/wasp-graphql/blob/5857b82b6eda9bb5dea5f0a881cd910b1bb3944a/src/query.js#L24-L74 |
47,217 | quorrajs/Positron | lib/http/request.js | function (key, defaultValue) {
var body = self.body || {};
var query = self.query || {};
if (null != body[key]) return body[key];
if (null != query[key]) return query[key];
return defaultValue;
} | javascript | function (key, defaultValue) {
var body = self.body || {};
var query = self.query || {};
if (null != body[key]) return body[key];
if (null != query[key]) return query[key];
return defaultValue;
} | [
"function",
"(",
"key",
",",
"defaultValue",
")",
"{",
"var",
"body",
"=",
"self",
".",
"body",
"||",
"{",
"}",
";",
"var",
"query",
"=",
"self",
".",
"query",
"||",
"{",
"}",
";",
"if",
"(",
"null",
"!=",
"body",
"[",
"key",
"]",
")",
"return"... | Return the value of a request input param `name` when present or `defaultValue`.
- Checks body params, ex: id=12, {"id":12}
- Checks query string params, ex: ?id=12
To utilize request bodies, `req.body`
should be an object. This can be done by enabling
the `bodyParser` middleware.
@param {String} key
@param {*} defa... | [
"Return",
"the",
"value",
"of",
"a",
"request",
"input",
"param",
"name",
"when",
"present",
"or",
"defaultValue",
"."
] | a4bad5a5f581743d1885405c11ae26600fb957af | https://github.com/quorrajs/Positron/blob/a4bad5a5f581743d1885405c11ae26600fb957af/lib/http/request.js#L227-L233 | |
47,218 | quorrajs/Positron | lib/http/request.js | function (key) {
var keys = Array.isArray(key) ? key : arguments;
for (var i = 0; i < keys.length; i++) {
if (isEmptyString(keys[i])) return false;
}
return true;
} | javascript | function (key) {
var keys = Array.isArray(key) ? key : arguments;
for (var i = 0; i < keys.length; i++) {
if (isEmptyString(keys[i])) return false;
}
return true;
} | [
"function",
"(",
"key",
")",
"{",
"var",
"keys",
"=",
"Array",
".",
"isArray",
"(",
"key",
")",
"?",
"key",
":",
"arguments",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"keys",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
... | Determine if the request contains a non-empty value for an input item.
@param {String|Array} key
@return bool | [
"Determine",
"if",
"the",
"request",
"contains",
"a",
"non",
"-",
"empty",
"value",
"for",
"an",
"input",
"item",
"."
] | a4bad5a5f581743d1885405c11ae26600fb957af | https://github.com/quorrajs/Positron/blob/a4bad5a5f581743d1885405c11ae26600fb957af/lib/http/request.js#L241-L249 | |
47,219 | quorrajs/Positron | lib/http/request.js | function (key) {
var keys = Array.isArray(key) ? key : arguments;
var input = self.input.all();
var results = {};
for (var i = 0; i < keys.length; i++) {
results[keys[i]] = input[keys[i]];
}
return results;
} | javascript | function (key) {
var keys = Array.isArray(key) ? key : arguments;
var input = self.input.all();
var results = {};
for (var i = 0; i < keys.length; i++) {
results[keys[i]] = input[keys[i]];
}
return results;
} | [
"function",
"(",
"key",
")",
"{",
"var",
"keys",
"=",
"Array",
".",
"isArray",
"(",
"key",
")",
"?",
"key",
":",
"arguments",
";",
"var",
"input",
"=",
"self",
".",
"input",
".",
"all",
"(",
")",
";",
"var",
"results",
"=",
"{",
"}",
";",
"for"... | Get a subset of the items from the input data.
@param {Array|String} key
@return {Array} | [
"Get",
"a",
"subset",
"of",
"the",
"items",
"from",
"the",
"input",
"data",
"."
] | a4bad5a5f581743d1885405c11ae26600fb957af | https://github.com/quorrajs/Positron/blob/a4bad5a5f581743d1885405c11ae26600fb957af/lib/http/request.js#L265-L276 | |
47,220 | quorrajs/Positron | lib/http/request.js | function (filter, keys) {
if (self.session) {
var flash = isset(filter) ? self.input[filter](keys) : self.input.all();
self.session.flash('_old_input', flash);
}
} | javascript | function (filter, keys) {
if (self.session) {
var flash = isset(filter) ? self.input[filter](keys) : self.input.all();
self.session.flash('_old_input', flash);
}
} | [
"function",
"(",
"filter",
",",
"keys",
")",
"{",
"if",
"(",
"self",
".",
"session",
")",
"{",
"var",
"flash",
"=",
"isset",
"(",
"filter",
")",
"?",
"self",
".",
"input",
"[",
"filter",
"]",
"(",
"keys",
")",
":",
"self",
".",
"input",
".",
"a... | Flash the input for the current request to the session.
@param {String} filter
@param {Object} keys | [
"Flash",
"the",
"input",
"for",
"the",
"current",
"request",
"to",
"the",
"session",
"."
] | a4bad5a5f581743d1885405c11ae26600fb957af | https://github.com/quorrajs/Positron/blob/a4bad5a5f581743d1885405c11ae26600fb957af/lib/http/request.js#L283-L289 | |
47,221 | quorrajs/Positron | lib/http/request.js | function (key, defaultValue) {
var input = self.session.get('_old_input', []);
// Input that is flashed to the session can be easily retrieved by the
// developer, making repopulating old forms and the like much more
// convenient, since the request's previous input is a... | javascript | function (key, defaultValue) {
var input = self.session.get('_old_input', []);
// Input that is flashed to the session can be easily retrieved by the
// developer, making repopulating old forms and the like much more
// convenient, since the request's previous input is a... | [
"function",
"(",
"key",
",",
"defaultValue",
")",
"{",
"var",
"input",
"=",
"self",
".",
"session",
".",
"get",
"(",
"'_old_input'",
",",
"[",
"]",
")",
";",
"// Input that is flashed to the session can be easily retrieved by the",
"// developer, making repopulating old... | Retrieve an old input item.
@param {String} key
@param {*} defaultValue
@return {*} | [
"Retrieve",
"an",
"old",
"input",
"item",
"."
] | a4bad5a5f581743d1885405c11ae26600fb957af | https://github.com/quorrajs/Positron/blob/a4bad5a5f581743d1885405c11ae26600fb957af/lib/http/request.js#L338-L349 | |
47,222 | quorrajs/Positron | lib/http/request.js | function (key) {
if (self.files) {
return self.files[key] ? self.files[key] : null;
}
} | javascript | function (key) {
if (self.files) {
return self.files[key] ? self.files[key] : null;
}
} | [
"function",
"(",
"key",
")",
"{",
"if",
"(",
"self",
".",
"files",
")",
"{",
"return",
"self",
".",
"files",
"[",
"key",
"]",
"?",
"self",
".",
"files",
"[",
"key",
"]",
":",
"null",
";",
"}",
"}"
] | Retrieve a file from the request.
@param {String} key
@return {*} | [
"Retrieve",
"a",
"file",
"from",
"the",
"request",
"."
] | a4bad5a5f581743d1885405c11ae26600fb957af | https://github.com/quorrajs/Positron/blob/a4bad5a5f581743d1885405c11ae26600fb957af/lib/http/request.js#L356-L360 | |
47,223 | edloidas/roll-parser | src/object/Result.js | Result | function Result( notation, value, rolls ) {
this.notation = notation;
this.value = value;
this.rolls = rolls;
} | javascript | function Result( notation, value, rolls ) {
this.notation = notation;
this.value = value;
this.rolls = rolls;
} | [
"function",
"Result",
"(",
"notation",
",",
"value",
",",
"rolls",
")",
"{",
"this",
".",
"notation",
"=",
"notation",
";",
"this",
".",
"value",
"=",
"value",
";",
"this",
".",
"rolls",
"=",
"rolls",
";",
"}"
] | A class that represents a dice roll result
@class
@classdesc A class that represents a dice roll result
@since v2.0.0
@param {String} notation - A roll notation
@param {Number} value - A numeric representation of roll result, like total summ or success count
@param {Array} rolls - An array of rolls dome
@see Roll
@see ... | [
"A",
"class",
"that",
"represents",
"a",
"dice",
"roll",
"result"
] | 38912b298edb0a4d67ba1c796d7ac159ebaf7901 | https://github.com/edloidas/roll-parser/blob/38912b298edb0a4d67ba1c796d7ac159ebaf7901/src/object/Result.js#L13-L17 |
47,224 | Holixus/nano-md5 | md5.js | bytesToWords | function bytesToWords(bytes) {
var bytes_count = bytes.length,
bits_count = bytes_count << 3,
words = new Uint32Array((bytes_count + 64) >>> 6 << 4);
for (var i = 0, n = bytes.length; i < n; ++i)
words[i >>> 2] |= bytes.charCodeAt(i) << ((i & 3) << 3);
words[bytes_count >> 2] |= 0x80 << (bits_count & 31)... | javascript | function bytesToWords(bytes) {
var bytes_count = bytes.length,
bits_count = bytes_count << 3,
words = new Uint32Array((bytes_count + 64) >>> 6 << 4);
for (var i = 0, n = bytes.length; i < n; ++i)
words[i >>> 2] |= bytes.charCodeAt(i) << ((i & 3) << 3);
words[bytes_count >> 2] |= 0x80 << (bits_count & 31)... | [
"function",
"bytesToWords",
"(",
"bytes",
")",
"{",
"var",
"bytes_count",
"=",
"bytes",
".",
"length",
",",
"bits_count",
"=",
"bytes_count",
"<<",
"3",
",",
"words",
"=",
"new",
"Uint32Array",
"(",
"(",
"bytes_count",
"+",
"64",
")",
">>>",
"6",
"<<",
... | converts bytes string to 32-bits words array padded with "1" and zeros and bits_length for MD5 message buffer | [
"converts",
"bytes",
"string",
"to",
"32",
"-",
"bits",
"words",
"array",
"padded",
"with",
"1",
"and",
"zeros",
"and",
"bits_length",
"for",
"MD5",
"message",
"buffer"
] | 058964cfeb6d9c14b0a20c1122f83e1d6b8870f1 | https://github.com/Holixus/nano-md5/blob/058964cfeb6d9c14b0a20c1122f83e1d6b8870f1/md5.js#L43-L52 |
47,225 | clux/tiebreaker | tiebreaker.js | Id | function Id(s, r, m, isSimple) {
this.s = s;
this.r = r;
this.m = m;
Object.defineProperty(this, '_simple', {
value: isSimple
});
} | javascript | function Id(s, r, m, isSimple) {
this.s = s;
this.r = r;
this.m = m;
Object.defineProperty(this, '_simple', {
value: isSimple
});
} | [
"function",
"Id",
"(",
"s",
",",
"r",
",",
"m",
",",
"isSimple",
")",
"{",
"this",
".",
"s",
"=",
"s",
";",
"this",
".",
"r",
"=",
"r",
";",
"this",
".",
"m",
"=",
"m",
";",
"Object",
".",
"defineProperty",
"(",
"this",
",",
"'_simple'",
",",... | for grouped breakers | [
"for",
"grouped",
"breakers"
] | ef5809b6016b544b4d2cbbdaebf73d6aff36a63c | https://github.com/clux/tiebreaker/blob/ef5809b6016b544b4d2cbbdaebf73d6aff36a63c/tiebreaker.js#L6-L13 |
47,226 | clux/tiebreaker | tiebreaker.js | function (seedAry, match) {
var res = $.replicate(seedAry.length, []);
seedAry.forEach(function (xps, x) {
// NB: while we are not writing 1-1 from seedAry to res, we are always
// making sure not to overwrite what we had in previous iterations
if (xps.indexOf(match.p[0]) < 0) {
res[x] = res[x].co... | javascript | function (seedAry, match) {
var res = $.replicate(seedAry.length, []);
seedAry.forEach(function (xps, x) {
// NB: while we are not writing 1-1 from seedAry to res, we are always
// making sure not to overwrite what we had in previous iterations
if (xps.indexOf(match.p[0]) < 0) {
res[x] = res[x].co... | [
"function",
"(",
"seedAry",
",",
"match",
")",
"{",
"var",
"res",
"=",
"$",
".",
"replicate",
"(",
"seedAry",
".",
"length",
",",
"[",
"]",
")",
";",
"seedAry",
".",
"forEach",
"(",
"function",
"(",
"xps",
",",
"x",
")",
"{",
"// NB: while we are not... | split up the posAry entried cluster found in corresponding within section breakers | [
"split",
"up",
"the",
"posAry",
"entried",
"cluster",
"found",
"in",
"corresponding",
"within",
"section",
"breakers"
] | ef5809b6016b544b4d2cbbdaebf73d6aff36a63c | https://github.com/clux/tiebreaker/blob/ef5809b6016b544b4d2cbbdaebf73d6aff36a63c/tiebreaker.js#L107-L123 | |
47,227 | feedhenry-raincatcher/raincatcher-angularjs | packages/angularjs-workorder/lib/workorder-list/workorder-list-controller.js | WorkorderListController | function WorkorderListController($scope, workorderService, workorderFlowService, $q, workorderStatusService) {
var self = this;
var _workorders = [];
self.workorders = [];
function refreshWorkorders() {
// Needs $q.when to trigger angular's change detection
workorderService.list().then(function(workor... | javascript | function WorkorderListController($scope, workorderService, workorderFlowService, $q, workorderStatusService) {
var self = this;
var _workorders = [];
self.workorders = [];
function refreshWorkorders() {
// Needs $q.when to trigger angular's change detection
workorderService.list().then(function(workor... | [
"function",
"WorkorderListController",
"(",
"$scope",
",",
"workorderService",
",",
"workorderFlowService",
",",
"$q",
",",
"workorderStatusService",
")",
"{",
"var",
"self",
"=",
"this",
";",
"var",
"_workorders",
"=",
"[",
"]",
";",
"self",
".",
"workorders",
... | Controller for listing Workorders
@constructor | [
"Controller",
"for",
"listing",
"Workorders"
] | b394689227901e18871ad9edd0ec226c5e6839e1 | https://github.com/feedhenry-raincatcher/raincatcher-angularjs/blob/b394689227901e18871ad9edd0ec226c5e6839e1/packages/angularjs-workorder/lib/workorder-list/workorder-list-controller.js#L10-L93 |
47,228 | jaymell/nodeCf | src/utils.js | fileExists | async function fileExists(f) {
debug(`fileExists called with: ${JSON.stringify(arguments)}`);
try {
await fs.statAsync(f);
return f;
} catch (e) {
throw e;
}
} | javascript | async function fileExists(f) {
debug(`fileExists called with: ${JSON.stringify(arguments)}`);
try {
await fs.statAsync(f);
return f;
} catch (e) {
throw e;
}
} | [
"async",
"function",
"fileExists",
"(",
"f",
")",
"{",
"debug",
"(",
"`",
"${",
"JSON",
".",
"stringify",
"(",
"arguments",
")",
"}",
"`",
")",
";",
"try",
"{",
"await",
"fs",
".",
"statAsync",
"(",
"f",
")",
";",
"return",
"f",
";",
"}",
"catch"... | return filename if exists, else throw | [
"return",
"filename",
"if",
"exists",
"else",
"throw"
] | d0f499a1b0adf5c810c33698a66ef16db6bc590d | https://github.com/jaymell/nodeCf/blob/d0f499a1b0adf5c810c33698a66ef16db6bc590d/src/utils.js#L8-L16 |
47,229 | jaymell/nodeCf | src/utils.js | execTasks | async function execTasks(tasks, taskType) {
debug(`execTasks: called for ${taskType}`);
if (!(_.isEmpty(tasks))) {
if (taskType) console.log(`running ${taskType}...`);
const output = await Promise.mapSeries(tasks, async(task) => {
const result = await execTask(task);
if (_.isString(result.stdout... | javascript | async function execTasks(tasks, taskType) {
debug(`execTasks: called for ${taskType}`);
if (!(_.isEmpty(tasks))) {
if (taskType) console.log(`running ${taskType}...`);
const output = await Promise.mapSeries(tasks, async(task) => {
const result = await execTask(task);
if (_.isString(result.stdout... | [
"async",
"function",
"execTasks",
"(",
"tasks",
",",
"taskType",
")",
"{",
"debug",
"(",
"`",
"${",
"taskType",
"}",
"`",
")",
";",
"if",
"(",
"!",
"(",
"_",
".",
"isEmpty",
"(",
"tasks",
")",
")",
")",
"{",
"if",
"(",
"taskType",
")",
"console",... | exec list of tasks, print stdout and stderr for each | [
"exec",
"list",
"of",
"tasks",
"print",
"stdout",
"and",
"stderr",
"for",
"each"
] | d0f499a1b0adf5c810c33698a66ef16db6bc590d | https://github.com/jaymell/nodeCf/blob/d0f499a1b0adf5c810c33698a66ef16db6bc590d/src/utils.js#L30-L46 |
47,230 | edloidas/roll-parser | src/object/Roll.js | Roll | function Roll( dice = 20, count = 1, modifier = 0 ) {
this.dice = positiveInteger( dice );
this.count = positiveInteger( count );
this.modifier = normalizeInteger( modifier );
} | javascript | function Roll( dice = 20, count = 1, modifier = 0 ) {
this.dice = positiveInteger( dice );
this.count = positiveInteger( count );
this.modifier = normalizeInteger( modifier );
} | [
"function",
"Roll",
"(",
"dice",
"=",
"20",
",",
"count",
"=",
"1",
",",
"modifier",
"=",
"0",
")",
"{",
"this",
".",
"dice",
"=",
"positiveInteger",
"(",
"dice",
")",
";",
"this",
".",
"count",
"=",
"positiveInteger",
"(",
"count",
")",
";",
"this... | A class that represents a dice roll from D&D setting
@class
@classdesc A class that represents a dice roll from D&D setting
@since v2.0.0
@param {Number} dice - A number of dice faces
@param {Number} count - A number of dices
@param {Number} modifier - A modifier, that should be added/sustracted from result
@see WodRol... | [
"A",
"class",
"that",
"represents",
"a",
"dice",
"roll",
"from",
"D&D",
"setting"
] | 38912b298edb0a4d67ba1c796d7ac159ebaf7901 | https://github.com/edloidas/roll-parser/blob/38912b298edb0a4d67ba1c796d7ac159ebaf7901/src/object/Roll.js#L16-L20 |
47,231 | YannickBochatay/JSYG | dist/JSYG.js | function(mtx) {
if (mtx && typeof mtx == "object" && mtx.mtx) mtx = mtx.mtx;
if (!mtx) return new Point(this.x,this.y);
var point = svg.createSVGPoint();
point.x = this.x;
point.y = this.y;
point = point.matrixTransform(mtx);
... | javascript | function(mtx) {
if (mtx && typeof mtx == "object" && mtx.mtx) mtx = mtx.mtx;
if (!mtx) return new Point(this.x,this.y);
var point = svg.createSVGPoint();
point.x = this.x;
point.y = this.y;
point = point.matrixTransform(mtx);
... | [
"function",
"(",
"mtx",
")",
"{",
"if",
"(",
"mtx",
"&&",
"typeof",
"mtx",
"==",
"\"object\"",
"&&",
"mtx",
".",
"mtx",
")",
"mtx",
"=",
"mtx",
".",
"mtx",
";",
"if",
"(",
"!",
"mtx",
")",
"return",
"new",
"Point",
"(",
"this",
".",
"x",
",",
... | Applique une matrice de transformation
@param mtx instance de JSYG.Matrix (ou SVGMatrix)
@returns nouvelle instance | [
"Applique",
"une",
"matrice",
"de",
"transformation"
] | b32a5368b57498b51c0c8261cf9a682e5ed6ff11 | https://github.com/YannickBochatay/JSYG/blob/b32a5368b57498b51c0c8261cf9a682e5ed6ff11/dist/JSYG.js#L623-L634 | |
47,232 | YannickBochatay/JSYG | dist/JSYG.js | Matrix | function Matrix(arg) {
if (arg && arguments.length === 1) {
if (arg instanceof window.SVGMatrix) this.mtx = arg.scale(1);
else if (arg instanceof Matrix) this.mtx = arg.mtx.scale(1);
else if (typeof arg == "string") return Matrix.parse(arg);
else throw new... | javascript | function Matrix(arg) {
if (arg && arguments.length === 1) {
if (arg instanceof window.SVGMatrix) this.mtx = arg.scale(1);
else if (arg instanceof Matrix) this.mtx = arg.mtx.scale(1);
else if (typeof arg == "string") return Matrix.parse(arg);
else throw new... | [
"function",
"Matrix",
"(",
"arg",
")",
"{",
"if",
"(",
"arg",
"&&",
"arguments",
".",
"length",
"===",
"1",
")",
"{",
"if",
"(",
"arg",
"instanceof",
"window",
".",
"SVGMatrix",
")",
"this",
".",
"mtx",
"=",
"arg",
".",
"scale",
"(",
"1",
")",
";... | Constructeur de matrices
@param arg optionnel, si défini reprend les coefficients de l'argument. arg peut être
une instance de SVGMatrix (DOM SVG) ou de Matrix.
On peut également passer 6 arguments numériques pour définir chacun des coefficients.
@returns {Matrix} | [
"Constructeur",
"de",
"matrices"
] | b32a5368b57498b51c0c8261cf9a682e5ed6ff11 | https://github.com/YannickBochatay/JSYG/blob/b32a5368b57498b51c0c8261cf9a682e5ed6ff11/dist/JSYG.js#L766-L781 |
47,233 | YannickBochatay/JSYG | dist/JSYG.js | function(str,tag,content) {
return str.replace(regexpTag(tag),function(str,p1,p2) { content && content.push(p2); return ''; });
} | javascript | function(str,tag,content) {
return str.replace(regexpTag(tag),function(str,p1,p2) { content && content.push(p2); return ''; });
} | [
"function",
"(",
"str",
",",
"tag",
",",
"content",
")",
"{",
"return",
"str",
".",
"replace",
"(",
"regexpTag",
"(",
"tag",
")",
",",
"function",
"(",
"str",
",",
"p1",
",",
"p2",
")",
"{",
"content",
"&&",
"content",
".",
"push",
"(",
"p2",
")"... | Retire les balises et leur contenu
@param {String} str chaîne à analyser
@param {String} tag nom de la balise à supprimer
@param {Array} content tableau qui sera rempli par le contenu des balises trouvées (les tableaux passent par référence)
@@returns {String} | [
"Retire",
"les",
"balises",
"et",
"leur",
"contenu"
] | b32a5368b57498b51c0c8261cf9a682e5ed6ff11 | https://github.com/YannickBochatay/JSYG/blob/b32a5368b57498b51c0c8261cf9a682e5ed6ff11/dist/JSYG.js#L1405-L1407 | |
47,234 | alexyoung/pop | lib/filters.js | function(data) {
data = data.replace(/{% highlight ([^ ]*) %}/g, '<pre class="prettyprint lang-$1">');
data = data.replace(/{% endhighlight %}/g, '</pre>');
return data;
} | javascript | function(data) {
data = data.replace(/{% highlight ([^ ]*) %}/g, '<pre class="prettyprint lang-$1">');
data = data.replace(/{% endhighlight %}/g, '</pre>');
return data;
} | [
"function",
"(",
"data",
")",
"{",
"data",
"=",
"data",
".",
"replace",
"(",
"/",
"{% highlight ([^ ]*) %}",
"/",
"g",
",",
"'<pre class=\"prettyprint lang-$1\">'",
")",
";",
"data",
"=",
"data",
".",
"replace",
"(",
"/",
"{% endhighlight %}",
"/",
"g",
",",... | Replaces liquid tag highlight directives with prettyprint HTML tags.
@param {String} The text for a post
@return {String} | [
"Replaces",
"liquid",
"tag",
"highlight",
"directives",
"with",
"prettyprint",
"HTML",
"tags",
"."
] | 8a0b3f2605cb58e8ae6b34f1373dde00610e9858 | https://github.com/alexyoung/pop/blob/8a0b3f2605cb58e8ae6b34f1373dde00610e9858/lib/filters.js#L14-L18 | |
47,235 | gagle/node-argp | lib/argp.js | function (){
if (!instance._once) return;
//Uncache the files
["index.js", "command.js", "argp.js", "body.js", "error.js", "wrap.js"]
.forEach (function (filename){
delete require.cache[__dirname + path.sep + filename];
});
//The user may have a reference to the instance so it sh... | javascript | function (){
if (!instance._once) return;
//Uncache the files
["index.js", "command.js", "argp.js", "body.js", "error.js", "wrap.js"]
.forEach (function (filename){
delete require.cache[__dirname + path.sep + filename];
});
//The user may have a reference to the instance so it sh... | [
"function",
"(",
")",
"{",
"if",
"(",
"!",
"instance",
".",
"_once",
")",
"return",
";",
"//Uncache the files",
"[",
"\"index.js\"",
",",
"\"command.js\"",
",",
"\"argp.js\"",
",",
"\"body.js\"",
",",
"\"error.js\"",
",",
"\"wrap.js\"",
"]",
".",
"forEach",
... | The Argp and Command instances execute this code | [
"The",
"Argp",
"and",
"Command",
"instances",
"execute",
"this",
"code"
] | e4a5a018c0b9fa8b370498c085e20fe8ff9fad5b | https://github.com/gagle/node-argp/blob/e4a5a018c0b9fa8b370498c085e20fe8ff9fad5b/lib/argp.js#L992-L1009 | |
47,236 | feedhenry-raincatcher/raincatcher-angularjs | packages/angularjs-workflow/lib/workflow-process/workflow-process-begin/workflow-process-begin-controller.js | WorkflowProcessBeginController | function WorkflowProcessBeginController($state, workorderService, wfmService, $stateParams) {
var self = this;
var workorderId = $stateParams.workorderId;
workorderService.read(workorderId).then(function(workorder) {
self.workorder = workorder;
self.workflow = workorder.workflow;
self.results = worko... | javascript | function WorkflowProcessBeginController($state, workorderService, wfmService, $stateParams) {
var self = this;
var workorderId = $stateParams.workorderId;
workorderService.read(workorderId).then(function(workorder) {
self.workorder = workorder;
self.workflow = workorder.workflow;
self.results = worko... | [
"function",
"WorkflowProcessBeginController",
"(",
"$state",
",",
"workorderService",
",",
"wfmService",
",",
"$stateParams",
")",
"{",
"var",
"self",
"=",
"this",
";",
"var",
"workorderId",
"=",
"$stateParams",
".",
"workorderId",
";",
"workorderService",
".",
"r... | Controller for starting a workflow process.
@param $state
@param workflowService
@param $stateParams
@param $timeout
@constructor | [
"Controller",
"for",
"starting",
"a",
"workflow",
"process",
"."
] | b394689227901e18871ad9edd0ec226c5e6839e1 | https://github.com/feedhenry-raincatcher/raincatcher-angularjs/blob/b394689227901e18871ad9edd0ec226c5e6839e1/packages/angularjs-workflow/lib/workflow-process/workflow-process-begin/workflow-process-begin-controller.js#L12-L37 |
47,237 | yaxia/json-edm-parser | parser.js | function (token, value) {
var self = this;
var emitString = false;
function additionalEmit(additionalKey, additionalValue) {
var oldKey = self.internalParser.key;
self.internalParser.key = additionalKey;
self.internalParser.onValue(additionalValue);
self.internalParser.key = oldKey;
}
if (tok... | javascript | function (token, value) {
var self = this;
var emitString = false;
function additionalEmit(additionalKey, additionalValue) {
var oldKey = self.internalParser.key;
self.internalParser.key = additionalKey;
self.internalParser.onValue(additionalValue);
self.internalParser.key = oldKey;
}
if (tok... | [
"function",
"(",
"token",
",",
"value",
")",
"{",
"var",
"self",
"=",
"this",
";",
"var",
"emitString",
"=",
"false",
";",
"function",
"additionalEmit",
"(",
"additionalKey",
",",
"additionalValue",
")",
"{",
"var",
"oldKey",
"=",
"self",
".",
"internalPar... | Handles the EDM types in the JSON object
1. Number will be treated as Edm.Int32 by default
2. Literal value 1.0 will be treated as Edm.Double
3. Others will be handled according to the literal value | [
"Handles",
"the",
"EDM",
"types",
"in",
"the",
"JSON",
"object",
"1",
".",
"Number",
"will",
"be",
"treated",
"as",
"Edm",
".",
"Int32",
"by",
"default",
"2",
".",
"Literal",
"value",
"1",
".",
"0",
"will",
"be",
"treated",
"as",
"Edm",
".",
"Double"... | b50508e0e2bf85f97a1ac281ed1f1425ad769816 | https://github.com/yaxia/json-edm-parser/blob/b50508e0e2bf85f97a1ac281ed1f1425ad769816/parser.js#L47-L82 | |
47,238 | theThings/jailed-node | lib/JailedSite.js | JailedSite | function JailedSite(connection) {
this._interface = {}
this._remote = null
this._remoteUpdateHandler = function() {
}
this._getInterfaceHandler = function() {
}
this._interfaceSetAsRemoteHandler = function() {
}
this._disconnectHandler = function() {
}
this._store = new ReferenceStore
var _this... | javascript | function JailedSite(connection) {
this._interface = {}
this._remote = null
this._remoteUpdateHandler = function() {
}
this._getInterfaceHandler = function() {
}
this._interfaceSetAsRemoteHandler = function() {
}
this._disconnectHandler = function() {
}
this._store = new ReferenceStore
var _this... | [
"function",
"JailedSite",
"(",
"connection",
")",
"{",
"this",
".",
"_interface",
"=",
"{",
"}",
"this",
".",
"_remote",
"=",
"null",
"this",
".",
"_remoteUpdateHandler",
"=",
"function",
"(",
")",
"{",
"}",
"this",
".",
"_getInterfaceHandler",
"=",
"funct... | JailedSite object represents a single site in the
communication protocol between the application and the plugin
@param {Object} connection a special object allowing to send
and receive messages from the opposite site (basically it
should only provide send() and onMessage() methods) | [
"JailedSite",
"object",
"represents",
"a",
"single",
"site",
"in",
"the",
"communication",
"protocol",
"between",
"the",
"application",
"and",
"the",
"plugin"
] | 6e453d97e74fbd1c0b27b982084f6fd7c1aa0173 | https://github.com/theThings/jailed-node/blob/6e453d97e74fbd1c0b27b982084f6fd7c1aa0173/lib/JailedSite.js#L15-L41 |
47,239 | edloidas/roll-parser | src/converter.js | convertToAnyRoll | function convertToAnyRoll( object = {}) {
const { again, success, fail } = object || {};
if ( isAbsent( again ) && isAbsent( success ) && isAbsent( fail )) {
return convertToRoll( object );
} // else
return convertToWodRoll( object );
} | javascript | function convertToAnyRoll( object = {}) {
const { again, success, fail } = object || {};
if ( isAbsent( again ) && isAbsent( success ) && isAbsent( fail )) {
return convertToRoll( object );
} // else
return convertToWodRoll( object );
} | [
"function",
"convertToAnyRoll",
"(",
"object",
"=",
"{",
"}",
")",
"{",
"const",
"{",
"again",
",",
"success",
",",
"fail",
"}",
"=",
"object",
"||",
"{",
"}",
";",
"if",
"(",
"isAbsent",
"(",
"again",
")",
"&&",
"isAbsent",
"(",
"success",
")",
"&... | Converts any arguments to `Roll` or `WodRoll` object.
If passed argument has `again`, `success` or `fail` property, the function will return `WodRoll`.
Otherwise, `Roll` will be returned.
@func
@alias convert
@since v2.1.0
@param {Object} object - `Roll`, `WodRoll` or similar object.
@return {Roll|WodRoll} Result of c... | [
"Converts",
"any",
"arguments",
"to",
"Roll",
"or",
"WodRoll",
"object",
".",
"If",
"passed",
"argument",
"has",
"again",
"success",
"or",
"fail",
"property",
"the",
"function",
"will",
"return",
"WodRoll",
".",
"Otherwise",
"Roll",
"will",
"be",
"returned",
... | 38912b298edb0a4d67ba1c796d7ac159ebaf7901 | https://github.com/edloidas/roll-parser/blob/38912b298edb0a4d67ba1c796d7ac159ebaf7901/src/converter.js#L32-L39 |
47,240 | nightswapping/ng-image-upload | dist/ng-image-upload-template-in.js | imageFilter | function imageFilter (item /*{File|FileLikeObject}*/, options) {
var type = '|' + item.type.slice(item.type.lastIndexOf('/') + 1) + '|';
if ('|jpg|png|jpeg|bmp|gif|'.indexOf(type) === -1) {
var err = new Error('File extension not supported (' + type + ')');
vm.onUploadFinished(err);
... | javascript | function imageFilter (item /*{File|FileLikeObject}*/, options) {
var type = '|' + item.type.slice(item.type.lastIndexOf('/') + 1) + '|';
if ('|jpg|png|jpeg|bmp|gif|'.indexOf(type) === -1) {
var err = new Error('File extension not supported (' + type + ')');
vm.onUploadFinished(err);
... | [
"function",
"imageFilter",
"(",
"item",
"/*{File|FileLikeObject}*/",
",",
"options",
")",
"{",
"var",
"type",
"=",
"'|'",
"+",
"item",
".",
"type",
".",
"slice",
"(",
"item",
".",
"type",
".",
"lastIndexOf",
"(",
"'/'",
")",
"+",
"1",
")",
"+",
"'|'",
... | Set up filters to check that images should be uploaded before uploading them Filters out the items that are not pictures | [
"Set",
"up",
"filters",
"to",
"check",
"that",
"images",
"should",
"be",
"uploaded",
"before",
"uploading",
"them",
"Filters",
"out",
"the",
"items",
"that",
"are",
"not",
"pictures"
] | fd23bdc436651c3caff1917524c461bd7d2482ea | https://github.com/nightswapping/ng-image-upload/blob/fd23bdc436651c3caff1917524c461bd7d2482ea/dist/ng-image-upload-template-in.js#L37-L46 |
47,241 | nightswapping/ng-image-upload | dist/ng-image-upload-template-in.js | sizeFilter | function sizeFilter (item /*{File|FileLikeObject}*/, options) {
var size = item.size,
// Use passed size limit or default to 10MB
sizeLimit = vm.sizeLimit || 10 * 1000 * 1000;
if (size > sizeLimit) {
var err = new Error('File too big (' + size + ')');
vm.onUploadFinished(... | javascript | function sizeFilter (item /*{File|FileLikeObject}*/, options) {
var size = item.size,
// Use passed size limit or default to 10MB
sizeLimit = vm.sizeLimit || 10 * 1000 * 1000;
if (size > sizeLimit) {
var err = new Error('File too big (' + size + ')');
vm.onUploadFinished(... | [
"function",
"sizeFilter",
"(",
"item",
"/*{File|FileLikeObject}*/",
",",
"options",
")",
"{",
"var",
"size",
"=",
"item",
".",
"size",
",",
"// Use passed size limit or default to 10MB",
"sizeLimit",
"=",
"vm",
".",
"sizeLimit",
"||",
"10",
"*",
"1000",
"*",
"10... | Filters out images that are larger than the specified or default limit | [
"Filters",
"out",
"images",
"that",
"are",
"larger",
"than",
"the",
"specified",
"or",
"default",
"limit"
] | fd23bdc436651c3caff1917524c461bd7d2482ea | https://github.com/nightswapping/ng-image-upload/blob/fd23bdc436651c3caff1917524c461bd7d2482ea/dist/ng-image-upload-template-in.js#L49-L59 |
47,242 | nightswapping/ng-image-upload | dist/ng-image-upload-template-in.js | onLoad | function onLoad(event) {
var img = new Image();
img.onload = utils.getDimensions(canvas, vm.$storage);
img.src = event.target.result;
} | javascript | function onLoad(event) {
var img = new Image();
img.onload = utils.getDimensions(canvas, vm.$storage);
img.src = event.target.result;
} | [
"function",
"onLoad",
"(",
"event",
")",
"{",
"var",
"img",
"=",
"new",
"Image",
"(",
")",
";",
"img",
".",
"onload",
"=",
"utils",
".",
"getDimensions",
"(",
"canvas",
",",
"vm",
".",
"$storage",
")",
";",
"img",
".",
"src",
"=",
"event",
".",
"... | Wait for the reader to be loaded to get the right img.src | [
"Wait",
"for",
"the",
"reader",
"to",
"be",
"loaded",
"to",
"get",
"the",
"right",
"img",
".",
"src"
] | fd23bdc436651c3caff1917524c461bd7d2482ea | https://github.com/nightswapping/ng-image-upload/blob/fd23bdc436651c3caff1917524c461bd7d2482ea/dist/ng-image-upload-template-in.js#L131-L135 |
47,243 | nightswapping/ng-image-upload | dist/ng-image-upload-template-in.js | function(file) {
var type = '|' + file.type.slice(file.type.lastIndexOf('/') + 1) + '|';
return '|jpg|png|jpeg|bmp|gif|'.indexOf(type) !== -1;
} | javascript | function(file) {
var type = '|' + file.type.slice(file.type.lastIndexOf('/') + 1) + '|';
return '|jpg|png|jpeg|bmp|gif|'.indexOf(type) !== -1;
} | [
"function",
"(",
"file",
")",
"{",
"var",
"type",
"=",
"'|'",
"+",
"file",
".",
"type",
".",
"slice",
"(",
"file",
".",
"type",
".",
"lastIndexOf",
"(",
"'/'",
")",
"+",
"1",
")",
"+",
"'|'",
";",
"return",
"'|jpg|png|jpeg|bmp|gif|'",
".",
"indexOf",... | Checks if the item is jpg, png, jpeg, bmp or a gif | [
"Checks",
"if",
"the",
"item",
"is",
"jpg",
"png",
"jpeg",
"bmp",
"or",
"a",
"gif"
] | fd23bdc436651c3caff1917524c461bd7d2482ea | https://github.com/nightswapping/ng-image-upload/blob/fd23bdc436651c3caff1917524c461bd7d2482ea/dist/ng-image-upload-template-in.js#L301-L304 | |
47,244 | nightswapping/ng-image-upload | dist/ng-image-upload-template-in.js | function(dataURI) {
var binary = atob(dataURI.split(',')[1]);
var mimeString = dataURI.split(',')[0].split(':')[1].split(';')[0];
var array = [];
for(var i = 0; i < binary.length; i++) {
array.push(binary.charCodeAt(i));
}
return new Blob([ new Uint8Array(arra... | javascript | function(dataURI) {
var binary = atob(dataURI.split(',')[1]);
var mimeString = dataURI.split(',')[0].split(':')[1].split(';')[0];
var array = [];
for(var i = 0; i < binary.length; i++) {
array.push(binary.charCodeAt(i));
}
return new Blob([ new Uint8Array(arra... | [
"function",
"(",
"dataURI",
")",
"{",
"var",
"binary",
"=",
"atob",
"(",
"dataURI",
".",
"split",
"(",
"','",
")",
"[",
"1",
"]",
")",
";",
"var",
"mimeString",
"=",
"dataURI",
".",
"split",
"(",
"','",
")",
"[",
"0",
"]",
".",
"split",
"(",
"'... | Turns the Data URI into a blob so it can be sent over to the server | [
"Turns",
"the",
"Data",
"URI",
"into",
"a",
"blob",
"so",
"it",
"can",
"be",
"sent",
"over",
"to",
"the",
"server"
] | fd23bdc436651c3caff1917524c461bd7d2482ea | https://github.com/nightswapping/ng-image-upload/blob/fd23bdc436651c3caff1917524c461bd7d2482ea/dist/ng-image-upload-template-in.js#L308-L318 | |
47,245 | rlivsey/fireplace | addon/model/promise-model.js | observePromise | function observePromise(proxy, promise) {
promise.then(value => {
set(proxy, 'isFulfilled', true);
value._settingFromFirebase = true;
set(proxy, 'content', value);
value._settingFromFirebase = false;
}, reason => {
set(proxy, 'isRejected', true);
set(proxy, 'reason', reason);
// don't re... | javascript | function observePromise(proxy, promise) {
promise.then(value => {
set(proxy, 'isFulfilled', true);
value._settingFromFirebase = true;
set(proxy, 'content', value);
value._settingFromFirebase = false;
}, reason => {
set(proxy, 'isRejected', true);
set(proxy, 'reason', reason);
// don't re... | [
"function",
"observePromise",
"(",
"proxy",
",",
"promise",
")",
"{",
"promise",
".",
"then",
"(",
"value",
"=>",
"{",
"set",
"(",
"proxy",
",",
"'isFulfilled'",
",",
"true",
")",
";",
"value",
".",
"_settingFromFirebase",
"=",
"true",
";",
"set",
"(",
... | reimplemented private method from Ember, but with setting _settingFromFirebase so we can avoid extra saves down the line | [
"reimplemented",
"private",
"method",
"from",
"Ember",
"but",
"with",
"setting",
"_settingFromFirebase",
"so",
"we",
"can",
"avoid",
"extra",
"saves",
"down",
"the",
"line"
] | 76cb3288dd99fd420b03547322b64b169caf595c | https://github.com/rlivsey/fireplace/blob/76cb3288dd99fd420b03547322b64b169caf595c/addon/model/promise-model.js#L10-L21 |
47,246 | open-nata/apkparser | src/index.js | parse | async function parse(apkPath, target = `${os.tmpdir()}/apktoolDecodes`) {
const cmd = `java -jar ${apktoolPath} d ${apkPath} -f -o ${target}`
await shell(cmd)
const MainfestFilePath = `${target}/AndroidManifest.xml`
const doc = await parseManifest(MainfestFilePath)
return parseDoc(doc)
} | javascript | async function parse(apkPath, target = `${os.tmpdir()}/apktoolDecodes`) {
const cmd = `java -jar ${apktoolPath} d ${apkPath} -f -o ${target}`
await shell(cmd)
const MainfestFilePath = `${target}/AndroidManifest.xml`
const doc = await parseManifest(MainfestFilePath)
return parseDoc(doc)
} | [
"async",
"function",
"parse",
"(",
"apkPath",
",",
"target",
"=",
"`",
"${",
"os",
".",
"tmpdir",
"(",
")",
"}",
"`",
")",
"{",
"const",
"cmd",
"=",
"`",
"${",
"apktoolPath",
"}",
"${",
"apkPath",
"}",
"${",
"target",
"}",
"`",
"await",
"shell",
... | parse apk and return manifest
@param {String} apkPath apk path
@param {String} target target extract dir, default to ${os.tmpdir()}/apktoolDecodes
@return {Promise} resolve manifest | [
"parse",
"apk",
"and",
"return",
"manifest"
] | ca1e7bfc67ecaf094316d1cf949d88b84fd9928d | https://github.com/open-nata/apkparser/blob/ca1e7bfc67ecaf094316d1cf949d88b84fd9928d/src/index.js#L98-L104 |
47,247 | VisionistInc/jibe | lib/models/Room.js | uniquenessValidator | function uniquenessValidator(values) {
if (values.presentAuthors) {
values = values.presentAuthors;
}
values.sort();
for (var i = 0; i < values.length - 1; i++) {
if (values[i] === values[i+1]) {
// can throw error or return false
// error allows supplying more detail
throw new Error(... | javascript | function uniquenessValidator(values) {
if (values.presentAuthors) {
values = values.presentAuthors;
}
values.sort();
for (var i = 0; i < values.length - 1; i++) {
if (values[i] === values[i+1]) {
// can throw error or return false
// error allows supplying more detail
throw new Error(... | [
"function",
"uniquenessValidator",
"(",
"values",
")",
"{",
"if",
"(",
"values",
".",
"presentAuthors",
")",
"{",
"values",
"=",
"values",
".",
"presentAuthors",
";",
"}",
"values",
".",
"sort",
"(",
")",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"... | are all values unique? | [
"are",
"all",
"values",
"unique?"
] | 3a154c0d86a3bcf8980c5104daec099ec738a4e0 | https://github.com/VisionistInc/jibe/blob/3a154c0d86a3bcf8980c5104daec099ec738a4e0/lib/models/Room.js#L59-L74 |
47,248 | alexyoung/pop | lib/pop.js | loadConfig | function loadConfig() {
var root = process.cwd()
, config = readConfig(path.join(root, '_config.json'));
config.root = root;
return config;
} | javascript | function loadConfig() {
var root = process.cwd()
, config = readConfig(path.join(root, '_config.json'));
config.root = root;
return config;
} | [
"function",
"loadConfig",
"(",
")",
"{",
"var",
"root",
"=",
"process",
".",
"cwd",
"(",
")",
",",
"config",
"=",
"readConfig",
"(",
"path",
".",
"join",
"(",
"root",
",",
"'_config.json'",
")",
")",
";",
"config",
".",
"root",
"=",
"root",
";",
"r... | Loads the config script and sets the local variable.
@return {Object} Config object | [
"Loads",
"the",
"config",
"script",
"and",
"sets",
"the",
"local",
"variable",
"."
] | 8a0b3f2605cb58e8ae6b34f1373dde00610e9858 | https://github.com/alexyoung/pop/blob/8a0b3f2605cb58e8ae6b34f1373dde00610e9858/lib/pop.js#L23-L28 |
47,249 | alexyoung/pop | lib/pop.js | loadConfigAndGenerateSite | function loadConfigAndGenerateSite(useServer, port) {
var config = loadConfig();
if (port) config.port = port;
generateSite(config, useServer);
} | javascript | function loadConfigAndGenerateSite(useServer, port) {
var config = loadConfig();
if (port) config.port = port;
generateSite(config, useServer);
} | [
"function",
"loadConfigAndGenerateSite",
"(",
"useServer",
",",
"port",
")",
"{",
"var",
"config",
"=",
"loadConfig",
"(",
")",
";",
"if",
"(",
"port",
")",
"config",
".",
"port",
"=",
"port",
";",
"generateSite",
"(",
"config",
",",
"useServer",
")",
";... | Loads configuration then runs `generateSite`.
@params {Boolean} Use a HTTP sever? | [
"Loads",
"configuration",
"then",
"runs",
"generateSite",
"."
] | 8a0b3f2605cb58e8ae6b34f1373dde00610e9858 | https://github.com/alexyoung/pop/blob/8a0b3f2605cb58e8ae6b34f1373dde00610e9858/lib/pop.js#L35-L39 |
47,250 | alexyoung/pop | lib/pop.js | generateSite | function generateSite(config, useServer) {
var fileMap = new FileMap(config)
, siteBuilder = new SiteBuilder(config)
, server = require(__dirname + '/server')(siteBuilder);
fileMap.walk();
fileMap.on('ready', function() {
siteBuilder.fileMap = fileMap;
siteBuilder.build();
});
siteBuilder.on... | javascript | function generateSite(config, useServer) {
var fileMap = new FileMap(config)
, siteBuilder = new SiteBuilder(config)
, server = require(__dirname + '/server')(siteBuilder);
fileMap.walk();
fileMap.on('ready', function() {
siteBuilder.fileMap = fileMap;
siteBuilder.build();
});
siteBuilder.on... | [
"function",
"generateSite",
"(",
"config",
",",
"useServer",
")",
"{",
"var",
"fileMap",
"=",
"new",
"FileMap",
"(",
"config",
")",
",",
"siteBuilder",
"=",
"new",
"SiteBuilder",
"(",
"config",
")",
",",
"server",
"=",
"require",
"(",
"__dirname",
"+",
"... | Runs `FileMap` and `SiteBuilder` based on the config.
@params {Object} Configuration options
@params {Boolean} Use a HTTP sever?
@return {SiteBuilder} A `SiteBuilder` instance | [
"Runs",
"FileMap",
"and",
"SiteBuilder",
"based",
"on",
"the",
"config",
"."
] | 8a0b3f2605cb58e8ae6b34f1373dde00610e9858 | https://github.com/alexyoung/pop/blob/8a0b3f2605cb58e8ae6b34f1373dde00610e9858/lib/pop.js#L48-L67 |
47,251 | krundru/webdriver-runner | lib/util.js | saveScreenshot | function saveScreenshot(driver, dir, testTitle) {
const data = driver.takeScreenshot()
const fileName = testTitle.replace(/[^a-zA-Z0-9]/g, '_')
.concat('_')
.concat(new Date().getTime())
.concat('.png')
const fullPath = path.resolve(dir, fileName)
fs.writeFileSync(fullPath, data, 'base64')
report... | javascript | function saveScreenshot(driver, dir, testTitle) {
const data = driver.takeScreenshot()
const fileName = testTitle.replace(/[^a-zA-Z0-9]/g, '_')
.concat('_')
.concat(new Date().getTime())
.concat('.png')
const fullPath = path.resolve(dir, fileName)
fs.writeFileSync(fullPath, data, 'base64')
report... | [
"function",
"saveScreenshot",
"(",
"driver",
",",
"dir",
",",
"testTitle",
")",
"{",
"const",
"data",
"=",
"driver",
".",
"takeScreenshot",
"(",
")",
"const",
"fileName",
"=",
"testTitle",
".",
"replace",
"(",
"/",
"[^a-zA-Z0-9]",
"/",
"g",
",",
"'_'",
"... | Saves current screenshot from driver.
fileName is resolved from testTitle and saved under given directory.
And the same is reported to test-result report with `image` type.
Ex:
if (this.currentTest.state !== 'failed') {
wdUtil.saveScreenshot(driver, './', this.currentTest.title)
}
@param {Driver} driver sync'ed webd... | [
"Saves",
"current",
"screenshot",
"from",
"driver",
".",
"fileName",
"is",
"resolved",
"from",
"testTitle",
"and",
"saved",
"under",
"given",
"directory",
"."
] | fb9db651966f546d0f6864b317475f805db86a12 | https://github.com/krundru/webdriver-runner/blob/fb9db651966f546d0f6864b317475f805db86a12/lib/util.js#L19-L33 |
47,252 | cjoudrey/wobot | lib/bot.js | function() {
var self = this;
self.jabber.on('data', function(buffer) {
console.log(' IN > ' + buffer.toString());
});
var origSend = this.jabber.send;
self.jabber.send = function(stanza) {
console.log(' OUT > ' + stanza);
return origSend.call(self.jabber, stanza);
};
} | javascript | function() {
var self = this;
self.jabber.on('data', function(buffer) {
console.log(' IN > ' + buffer.toString());
});
var origSend = this.jabber.send;
self.jabber.send = function(stanza) {
console.log(' OUT > ' + stanza);
return origSend.call(self.jabber, stanza);
};
} | [
"function",
"(",
")",
"{",
"var",
"self",
"=",
"this",
";",
"self",
".",
"jabber",
".",
"on",
"(",
"'data'",
",",
"function",
"(",
"buffer",
")",
"{",
"console",
".",
"log",
"(",
"' IN > '",
"+",
"buffer",
".",
"toString",
"(",
")",
")",
";",
"}... | Helper function that overrides the XMPP `send` method to allow incoming and outgoing debugging. | [
"Helper",
"function",
"that",
"overrides",
"the",
"XMPP",
"send",
"method",
"to",
"allow",
"incoming",
"and",
"outgoing",
"debugging",
"."
] | 7f044ec5e02a0707c637ce9bf5d77028796cda39 | https://github.com/cjoudrey/wobot/blob/7f044ec5e02a0707c637ce9bf5d77028796cda39/lib/bot.js#L38-L50 | |
47,253 | cjoudrey/wobot | lib/bot.js | function() {
var self = this;
this.setAvailability('chat');
this.keepalive = setInterval(function() {
self.jabber.send(new xmpp.Message({}));
self.emit('ping');
}, 30000);
// load our profile to get name
this.getProfile(function(err, data) {
if (err) {
// This isn't t... | javascript | function() {
var self = this;
this.setAvailability('chat');
this.keepalive = setInterval(function() {
self.jabber.send(new xmpp.Message({}));
self.emit('ping');
}, 30000);
// load our profile to get name
this.getProfile(function(err, data) {
if (err) {
// This isn't t... | [
"function",
"(",
")",
"{",
"var",
"self",
"=",
"this",
";",
"this",
".",
"setAvailability",
"(",
"'chat'",
")",
";",
"this",
".",
"keepalive",
"=",
"setInterval",
"(",
"function",
"(",
")",
"{",
"self",
".",
"jabber",
".",
"send",
"(",
"new",
"xmpp",... | Whenever an XMPP connection is made, this function is responsible for triggering the `connect` event and starting the 30s anti-idle. It will also set the availability of the bot to `chat`. | [
"Whenever",
"an",
"XMPP",
"connection",
"is",
"made",
"this",
"function",
"is",
"responsible",
"for",
"triggering",
"the",
"connect",
"event",
"and",
"starting",
"the",
"30s",
"anti",
"-",
"idle",
".",
"It",
"will",
"also",
"set",
"the",
"availability",
"of"... | 7f044ec5e02a0707c637ce9bf5d77028796cda39 | https://github.com/cjoudrey/wobot/blob/7f044ec5e02a0707c637ce9bf5d77028796cda39/lib/bot.js#L61-L88 | |
47,254 | cjoudrey/wobot | lib/bot.js | function(stanza) {
this.emit('data', stanza);
if (stanza.is('message') && stanza.attrs.type === 'groupchat') {
var body = stanza.getChildText('body');
if (!body) return;
// Ignore chat history
if (stanza.getChild('delay')) return;
var fromJid = new xmpp.JID(stanza.attrs.from);
... | javascript | function(stanza) {
this.emit('data', stanza);
if (stanza.is('message') && stanza.attrs.type === 'groupchat') {
var body = stanza.getChildText('body');
if (!body) return;
// Ignore chat history
if (stanza.getChild('delay')) return;
var fromJid = new xmpp.JID(stanza.attrs.from);
... | [
"function",
"(",
"stanza",
")",
"{",
"this",
".",
"emit",
"(",
"'data'",
",",
"stanza",
")",
";",
"if",
"(",
"stanza",
".",
"is",
"(",
"'message'",
")",
"&&",
"stanza",
".",
"attrs",
".",
"type",
"===",
"'groupchat'",
")",
"{",
"var",
"body",
"=",
... | This function is responsible for handling incoming XMPP messages. The `data` event will be triggered with the message for custom XMPP handling. The bot will parse the message and trigger the `message` event when it is a group chat message or the `privateMessage` event when it is a private message. | [
"This",
"function",
"is",
"responsible",
"for",
"handling",
"incoming",
"XMPP",
"messages",
".",
"The",
"data",
"event",
"will",
"be",
"triggered",
"with",
"the",
"message",
"for",
"custom",
"XMPP",
"handling",
".",
"The",
"bot",
"will",
"parse",
"the",
"mes... | 7f044ec5e02a0707c637ce9bf5d77028796cda39 | https://github.com/cjoudrey/wobot/blob/7f044ec5e02a0707c637ce9bf5d77028796cda39/lib/bot.js#L97-L153 | |
47,255 | SLaks/csrf-crypto | csrf-crypto.js | getCookieToken | function getCookieToken(res) {
var value = res.req.cookies[cookieName(res.req)];
if (!value)
return false;
var parts = value.split('|');
// If the existing cookie is invalid, reject it.
if (parts.length !== 3)
return false;
// If the user data doesn't match this request's user, reject the cookie
... | javascript | function getCookieToken(res) {
var value = res.req.cookies[cookieName(res.req)];
if (!value)
return false;
var parts = value.split('|');
// If the existing cookie is invalid, reject it.
if (parts.length !== 3)
return false;
// If the user data doesn't match this request's user, reject the cookie
... | [
"function",
"getCookieToken",
"(",
"res",
")",
"{",
"var",
"value",
"=",
"res",
".",
"req",
".",
"cookies",
"[",
"cookieName",
"(",
"res",
".",
"req",
")",
"]",
";",
"if",
"(",
"!",
"value",
")",
"return",
"false",
";",
"var",
"parts",
"=",
"value"... | Private function that finds an existing cookie token and returns its salt value | [
"Private",
"function",
"that",
"finds",
"an",
"existing",
"cookie",
"token",
"and",
"returns",
"its",
"salt",
"value"
] | d6b7cfa76652be74d3692b2080ad668b08556892 | https://github.com/SLaks/csrf-crypto/blob/d6b7cfa76652be74d3692b2080ad668b08556892/csrf-crypto.js#L96-L121 |
47,256 | SLaks/csrf-crypto | csrf-crypto.js | getFormToken | function getFormToken() {
/*jshint validthis:true */
if (this._csrfFormToken)
return this._csrfFormToken;
checkSecure(this.req);
var cookieToken = getCookieToken(this) || createCookie(this);
var salt = base64Random(saltSize);
var hasher = crypto.createHmac(options.algorithm, formKey);
hasher.update(c... | javascript | function getFormToken() {
/*jshint validthis:true */
if (this._csrfFormToken)
return this._csrfFormToken;
checkSecure(this.req);
var cookieToken = getCookieToken(this) || createCookie(this);
var salt = base64Random(saltSize);
var hasher = crypto.createHmac(options.algorithm, formKey);
hasher.update(c... | [
"function",
"getFormToken",
"(",
")",
"{",
"/*jshint validthis:true */",
"if",
"(",
"this",
".",
"_csrfFormToken",
")",
"return",
"this",
".",
"_csrfFormToken",
";",
"checkSecure",
"(",
"this",
".",
"req",
")",
";",
"var",
"cookieToken",
"=",
"getCookieToken",
... | Gets a new form token for the current response.
This function must be called on the response object.
@returns {String} An opaque token to include with new requests. | [
"Gets",
"a",
"new",
"form",
"token",
"for",
"the",
"current",
"response",
".",
"This",
"function",
"must",
"be",
"called",
"on",
"the",
"response",
"object",
"."
] | d6b7cfa76652be74d3692b2080ad668b08556892 | https://github.com/SLaks/csrf-crypto/blob/d6b7cfa76652be74d3692b2080ad668b08556892/csrf-crypto.js#L140-L156 |
47,257 | SLaks/csrf-crypto | csrf-crypto.js | verifyFormToken | function verifyFormToken(formToken) {
/*jshint validthis:true */
checkSecure(this);
// If we already cached this token, we know that it's valid.
// If we validate two different tokens for the same request,
// this won't incorrectly skip the second one.
if (this.res._csrfFormToken && this.res._csrfFormToken... | javascript | function verifyFormToken(formToken) {
/*jshint validthis:true */
checkSecure(this);
// If we already cached this token, we know that it's valid.
// If we validate two different tokens for the same request,
// this won't incorrectly skip the second one.
if (this.res._csrfFormToken && this.res._csrfFormToken... | [
"function",
"verifyFormToken",
"(",
"formToken",
")",
"{",
"/*jshint validthis:true */",
"checkSecure",
"(",
"this",
")",
";",
"// If we already cached this token, we know that it's valid.",
"// If we validate two different tokens for the same request,",
"// this won't incorrectly skip t... | Verifies a form token submitted with the current request.
This function must be called on the request object.
@returns {Boolean} True if the form token matches the cookie in the request. | [
"Verifies",
"a",
"form",
"token",
"submitted",
"with",
"the",
"current",
"request",
".",
"This",
"function",
"must",
"be",
"called",
"on",
"the",
"request",
"object",
"."
] | d6b7cfa76652be74d3692b2080ad668b08556892 | https://github.com/SLaks/csrf-crypto/blob/d6b7cfa76652be74d3692b2080ad668b08556892/csrf-crypto.js#L164-L201 |
47,258 | jaymell/nodeCf | src/nodeCf.js | getTemplateFile | async function getTemplateFile(templateDir, stackName) {
const f = await Promise.any(
_.map(['.yml', '.yaml', '.json', ''], async(ext) =>
await utils.fileExists(`${path.join(templateDir, stackName)}${ext}`)));
if (f) {
return f;
}
throw new Error(`Stack template "${stackName}" not found!`);
} | javascript | async function getTemplateFile(templateDir, stackName) {
const f = await Promise.any(
_.map(['.yml', '.yaml', '.json', ''], async(ext) =>
await utils.fileExists(`${path.join(templateDir, stackName)}${ext}`)));
if (f) {
return f;
}
throw new Error(`Stack template "${stackName}" not found!`);
} | [
"async",
"function",
"getTemplateFile",
"(",
"templateDir",
",",
"stackName",
")",
"{",
"const",
"f",
"=",
"await",
"Promise",
".",
"any",
"(",
"_",
".",
"map",
"(",
"[",
"'.yml'",
",",
"'.yaml'",
",",
"'.json'",
",",
"''",
"]",
",",
"async",
"(",
"e... | look for template having multiple possible file extensions | [
"look",
"for",
"template",
"having",
"multiple",
"possible",
"file",
"extensions"
] | d0f499a1b0adf5c810c33698a66ef16db6bc590d | https://github.com/jaymell/nodeCf/blob/d0f499a1b0adf5c810c33698a66ef16db6bc590d/src/nodeCf.js#L239-L247 |
47,259 | fti-technology/node-skytap | lib/skytap.js | Skytap | function Skytap () {
this.audit = new Audit(this);
this.environments = new Environments(this);
this.ips = new Ips(this);
this.networks = new Networks(this);
this.projects = new Projects(this);
this.templates = new Templates(this);
this.usage = new Usage(this);
this.... | javascript | function Skytap () {
this.audit = new Audit(this);
this.environments = new Environments(this);
this.ips = new Ips(this);
this.networks = new Networks(this);
this.projects = new Projects(this);
this.templates = new Templates(this);
this.usage = new Usage(this);
this.... | [
"function",
"Skytap",
"(",
")",
"{",
"this",
".",
"audit",
"=",
"new",
"Audit",
"(",
"this",
")",
";",
"this",
".",
"environments",
"=",
"new",
"Environments",
"(",
"this",
")",
";",
"this",
".",
"ips",
"=",
"new",
"Ips",
"(",
"this",
")",
";",
"... | Skytap API Library
@param {Object} config | [
"Skytap",
"API",
"Library"
] | 1d5af43ee26aabfebe52627ea09f291c99923a49 | https://github.com/fti-technology/node-skytap/blob/1d5af43ee26aabfebe52627ea09f291c99923a49/lib/skytap.js#L23-L38 |
47,260 | goliney/coderoom | lib/utils.js | readTemplate | function readTemplate() {
return fs.readFileSync(path.resolve.apply(null, [__dirname, settings.paths.templates, ...arguments]), 'utf8');
} | javascript | function readTemplate() {
return fs.readFileSync(path.resolve.apply(null, [__dirname, settings.paths.templates, ...arguments]), 'utf8');
} | [
"function",
"readTemplate",
"(",
")",
"{",
"return",
"fs",
".",
"readFileSync",
"(",
"path",
".",
"resolve",
".",
"apply",
"(",
"null",
",",
"[",
"__dirname",
",",
"settings",
".",
"paths",
".",
"templates",
",",
"...",
"arguments",
"]",
")",
",",
"'ut... | Synchronously read file from templates folder.
@param {...string} variative number of paths that form relative path to template
@returns {string} | [
"Synchronously",
"read",
"file",
"from",
"templates",
"folder",
"."
] | a8c30d45ae724dfc87348ffba5474cf62c10911c | https://github.com/goliney/coderoom/blob/a8c30d45ae724dfc87348ffba5474cf62c10911c/lib/utils.js#L27-L29 |
47,261 | YR/component | src/index.js | shouldBeStateless | function shouldBeStateless(definition, preferStateless) {
if (!preferStateless) {
return false;
}
if (runtime.isServer && (definition.getChildContext === undefined && definition.init === undefined)) {
return true;
}
// Not stateless if contains anything more than render and static properties
for (... | javascript | function shouldBeStateless(definition, preferStateless) {
if (!preferStateless) {
return false;
}
if (runtime.isServer && (definition.getChildContext === undefined && definition.init === undefined)) {
return true;
}
// Not stateless if contains anything more than render and static properties
for (... | [
"function",
"shouldBeStateless",
"(",
"definition",
",",
"preferStateless",
")",
"{",
"if",
"(",
"!",
"preferStateless",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"runtime",
".",
"isServer",
"&&",
"(",
"definition",
".",
"getChildContext",
"===",
"un... | Determine if 'definition' is stateless
@param {Object} definition
@param {Boolean} preferStateless
@returns {Boolean} | [
"Determine",
"if",
"definition",
"is",
"stateless"
] | 688a381f9478f75aed00032cae78df3f20d3a6dd | https://github.com/YR/component/blob/688a381f9478f75aed00032cae78df3f20d3a6dd/src/index.js#L98-L115 |
47,262 | freshout-dev/thulium | etc/EJS/ejs_fulljslint.js | quit | function quit(m, l, ch) {
throw {
name: 'JSLintError',
line: l,
character: ch,
message: m + " (" + Math.floor((l / lines.length) * 100) +
"% scanned)."
};
} | javascript | function quit(m, l, ch) {
throw {
name: 'JSLintError',
line: l,
character: ch,
message: m + " (" + Math.floor((l / lines.length) * 100) +
"% scanned)."
};
} | [
"function",
"quit",
"(",
"m",
",",
"l",
",",
"ch",
")",
"{",
"throw",
"{",
"name",
":",
"'JSLintError'",
",",
"line",
":",
"l",
",",
"character",
":",
"ch",
",",
"message",
":",
"m",
"+",
"\" (\"",
"+",
"Math",
".",
"floor",
"(",
"(",
"l",
"/",... | Produce an error warning. | [
"Produce",
"an",
"error",
"warning",
"."
] | ba3173e700fbe810ce13063e7ad46e9b05bb49e7 | https://github.com/freshout-dev/thulium/blob/ba3173e700fbe810ce13063e7ad46e9b05bb49e7/etc/EJS/ejs_fulljslint.js#L560-L568 |
47,263 | freshout-dev/thulium | etc/EJS/ejs_fulljslint.js | parse | function parse(rbp, initial) {
var left;
var o;
if (nexttoken.id === '(end)') {
error("Unexpected early end of program.", token);
}
advance();
if (option.adsafe && token.value === 'ADSAFE') {
if (nexttoken.id !== '.' || !(peek(0).identifier) ||
... | javascript | function parse(rbp, initial) {
var left;
var o;
if (nexttoken.id === '(end)') {
error("Unexpected early end of program.", token);
}
advance();
if (option.adsafe && token.value === 'ADSAFE') {
if (nexttoken.id !== '.' || !(peek(0).identifier) ||
... | [
"function",
"parse",
"(",
"rbp",
",",
"initial",
")",
"{",
"var",
"left",
";",
"var",
"o",
";",
"if",
"(",
"nexttoken",
".",
"id",
"===",
"'(end)'",
")",
"{",
"error",
"(",
"\"Unexpected early end of program.\"",
",",
"token",
")",
";",
"}",
"advance",
... | .nud Null denotation .fud First null denotation .led Left denotation lbp Left binding power rbp Right binding power They are key to the parsing method called Top Down Operator Precedence. | [
".",
"nud",
"Null",
"denotation",
".",
"fud",
"First",
"null",
"denotation",
".",
"led",
"Left",
"denotation",
"lbp",
"Left",
"binding",
"power",
"rbp",
"Right",
"binding",
"power",
"They",
"are",
"key",
"to",
"the",
"parsing",
"method",
"called",
"Top",
"... | ba3173e700fbe810ce13063e7ad46e9b05bb49e7 | https://github.com/freshout-dev/thulium/blob/ba3173e700fbe810ce13063e7ad46e9b05bb49e7/etc/EJS/ejs_fulljslint.js#L1428-L1483 |
47,264 | freshout-dev/thulium | etc/EJS/ejs_fulljslint.js | symbol | function symbol(s, p) {
var x = syntax[s];
if (!x || typeof x !== 'object') {
syntax[s] = x = {
id: s,
lbp: p,
value: s
};
}
return x;
} | javascript | function symbol(s, p) {
var x = syntax[s];
if (!x || typeof x !== 'object') {
syntax[s] = x = {
id: s,
lbp: p,
value: s
};
}
return x;
} | [
"function",
"symbol",
"(",
"s",
",",
"p",
")",
"{",
"var",
"x",
"=",
"syntax",
"[",
"s",
"]",
";",
"if",
"(",
"!",
"x",
"||",
"typeof",
"x",
"!==",
"'object'",
")",
"{",
"syntax",
"[",
"s",
"]",
"=",
"x",
"=",
"{",
"id",
":",
"s",
",",
"l... | Parasitic constructors for making the symbols that will be inherited by tokens. | [
"Parasitic",
"constructors",
"for",
"making",
"the",
"symbols",
"that",
"will",
"be",
"inherited",
"by",
"tokens",
"."
] | ba3173e700fbe810ce13063e7ad46e9b05bb49e7 | https://github.com/freshout-dev/thulium/blob/ba3173e700fbe810ce13063e7ad46e9b05bb49e7/etc/EJS/ejs_fulljslint.js#L1543-L1553 |
47,265 | freshout-dev/thulium | etc/EJS/ejs_fulljslint.js | function (s, o) {
if (o) {
if (o.adsafe) {
o.browser = false;
o.debug = false;
o.eqeqeq = true;
o.evil = false;
o.forin = false;
o.on = false;
o.rhino = false;
... | javascript | function (s, o) {
if (o) {
if (o.adsafe) {
o.browser = false;
o.debug = false;
o.eqeqeq = true;
o.evil = false;
o.forin = false;
o.on = false;
o.rhino = false;
... | [
"function",
"(",
"s",
",",
"o",
")",
"{",
"if",
"(",
"o",
")",
"{",
"if",
"(",
"o",
".",
"adsafe",
")",
"{",
"o",
".",
"browser",
"=",
"false",
";",
"o",
".",
"debug",
"=",
"false",
";",
"o",
".",
"eqeqeq",
"=",
"true",
";",
"o",
".",
"ev... | The actual JSLINT function itself. | [
"The",
"actual",
"JSLINT",
"function",
"itself",
"."
] | ba3173e700fbe810ce13063e7ad46e9b05bb49e7 | https://github.com/freshout-dev/thulium/blob/ba3173e700fbe810ce13063e7ad46e9b05bb49e7/etc/EJS/ejs_fulljslint.js#L3584-L3647 | |
47,266 | angular-translate/angular-translate-extractor | index.js | function (objSrc, objDest) {
if (_.isObject(objDest)) {
Object.getOwnPropertyNames(objDest).forEach(function (index) {
if (_.isObject(objDest[index])) {
objDest[index] = _recurseExtend(objSrc[index], objDest[index]);
}
else {
... | javascript | function (objSrc, objDest) {
if (_.isObject(objDest)) {
Object.getOwnPropertyNames(objDest).forEach(function (index) {
if (_.isObject(objDest[index])) {
objDest[index] = _recurseExtend(objSrc[index], objDest[index]);
}
else {
... | [
"function",
"(",
"objSrc",
",",
"objDest",
")",
"{",
"if",
"(",
"_",
".",
"isObject",
"(",
"objDest",
")",
")",
"{",
"Object",
".",
"getOwnPropertyNames",
"(",
"objDest",
")",
".",
"forEach",
"(",
"function",
"(",
"index",
")",
"{",
"if",
"(",
"_",
... | Merge recursively objDest into objSrc | [
"Merge",
"recursively",
"objDest",
"into",
"objSrc"
] | e635405c8061df6594660fcb8c7f83927687c99e | https://github.com/angular-translate/angular-translate-extractor/blob/e635405c8061df6594660fcb8c7f83927687c99e/index.js#L299-L311 | |
47,267 | teux/webpack-koa-middleware | index.js | sendStats | function sendStats(socket, stats, force) {
if (!socket || !stats) return;
if (!force && stats && stats.assets && stats.assets.every(function (asset) {
return !asset.emitted;
})) return;
socket.emit("hash", stats.hash);
if (stats.errors.length > 0)
socket.emit("errors", stats.errors);... | javascript | function sendStats(socket, stats, force) {
if (!socket || !stats) return;
if (!force && stats && stats.assets && stats.assets.every(function (asset) {
return !asset.emitted;
})) return;
socket.emit("hash", stats.hash);
if (stats.errors.length > 0)
socket.emit("errors", stats.errors);... | [
"function",
"sendStats",
"(",
"socket",
",",
"stats",
",",
"force",
")",
"{",
"if",
"(",
"!",
"socket",
"||",
"!",
"stats",
")",
"return",
";",
"if",
"(",
"!",
"force",
"&&",
"stats",
"&&",
"stats",
".",
"assets",
"&&",
"stats",
".",
"assets",
".",... | Sends signals and stats in socket
@param {WebSocket} socket
@param {Object} stats Webpack generated stats
@param {Boolean} force | [
"Sends",
"signals",
"and",
"stats",
"in",
"socket"
] | 557a979eb7b6dd0da40dadc465bc45024aadc20b | https://github.com/teux/webpack-koa-middleware/blob/557a979eb7b6dd0da40dadc465bc45024aadc20b/index.js#L42-L54 |
47,268 | teux/webpack-koa-middleware | index.js | function (url) {
return new Promise(function (resolve, reject) {
middleware(new MockReq(url), new MockRes(url, resolve), reject);
});
} | javascript | function (url) {
return new Promise(function (resolve, reject) {
middleware(new MockReq(url), new MockRes(url, resolve), reject);
});
} | [
"function",
"(",
"url",
")",
"{",
"return",
"new",
"Promise",
"(",
"function",
"(",
"resolve",
",",
"reject",
")",
"{",
"middleware",
"(",
"new",
"MockReq",
"(",
"url",
")",
",",
"new",
"MockRes",
"(",
"url",
",",
"resolve",
")",
",",
"reject",
")",
... | Calls webpack middleware in express manner.
@param {String} url
@returns {Promise} | [
"Calls",
"webpack",
"middleware",
"in",
"express",
"manner",
"."
] | 557a979eb7b6dd0da40dadc465bc45024aadc20b | https://github.com/teux/webpack-koa-middleware/blob/557a979eb7b6dd0da40dadc465bc45024aadc20b/index.js#L99-L103 | |
47,269 | alexyoung/pop | lib/site_builder.js | SiteBuilder | function SiteBuilder(config, fileMap) {
this.config = config;
this.root = config.root;
var helperFile = path.join(this.root, '_lib', 'helpers.js');
if (existsSync(helperFile)) {
userHelpers = require(helperFile);
}
var filterFile = path.join(this.root, '_lib', 'filters.js');
if (existsSync(filterFil... | javascript | function SiteBuilder(config, fileMap) {
this.config = config;
this.root = config.root;
var helperFile = path.join(this.root, '_lib', 'helpers.js');
if (existsSync(helperFile)) {
userHelpers = require(helperFile);
}
var filterFile = path.join(this.root, '_lib', 'filters.js');
if (existsSync(filterFil... | [
"function",
"SiteBuilder",
"(",
"config",
",",
"fileMap",
")",
"{",
"this",
".",
"config",
"=",
"config",
";",
"this",
".",
"root",
"=",
"config",
".",
"root",
";",
"var",
"helperFile",
"=",
"path",
".",
"join",
"(",
"this",
".",
"root",
",",
"'_lib'... | Initialize `SiteBuilder` with a config object and `FileMap`.
@param {Object} Config options
@param {FileMap} A `FileMap` object
@api public | [
"Initialize",
"SiteBuilder",
"with",
"a",
"config",
"object",
"and",
"FileMap",
"."
] | 8a0b3f2605cb58e8ae6b34f1373dde00610e9858 | https://github.com/alexyoung/pop/blob/8a0b3f2605cb58e8ae6b34f1373dde00610e9858/lib/site_builder.js#L35-L62 |
47,270 | JanitorTechnology/selfapi | selfapi.js | API | function API (parameters) {
// Own API resource prefix (e.g. '/resource').
this.path = parameters.path || null;
// Own documentation.
this.title = parameters.title || null;
this.description = parameters.description || null;
// Own test setup functions.
this.beforeEachTest = parameters.beforeEachTest || ... | javascript | function API (parameters) {
// Own API resource prefix (e.g. '/resource').
this.path = parameters.path || null;
// Own documentation.
this.title = parameters.title || null;
this.description = parameters.description || null;
// Own test setup functions.
this.beforeEachTest = parameters.beforeEachTest || ... | [
"function",
"API",
"(",
"parameters",
")",
"{",
"// Own API resource prefix (e.g. '/resource').",
"this",
".",
"path",
"=",
"parameters",
".",
"path",
"||",
"null",
";",
"// Own documentation.",
"this",
".",
"title",
"=",
"parameters",
".",
"title",
"||",
"null",
... | Simple, self-documenting and self-testing API system. | [
"Simple",
"self",
"-",
"documenting",
"and",
"self",
"-",
"testing",
"API",
"system",
"."
] | 8d6bbea299c9a8acef92a9c476b941660d0ef982 | https://github.com/JanitorTechnology/selfapi/blob/8d6bbea299c9a8acef92a9c476b941660d0ef982/selfapi.js#L15-L35 |
47,271 | JanitorTechnology/selfapi | selfapi.js | function (method, path, parameters) {
if (!this.parent) {
return;
}
var fullPath = normalizePath(path, this.path);
this.parent.exportHandler(method, fullPath, parameters);
} | javascript | function (method, path, parameters) {
if (!this.parent) {
return;
}
var fullPath = normalizePath(path, this.path);
this.parent.exportHandler(method, fullPath, parameters);
} | [
"function",
"(",
"method",
",",
"path",
",",
"parameters",
")",
"{",
"if",
"(",
"!",
"this",
".",
"parent",
")",
"{",
"return",
";",
"}",
"var",
"fullPath",
"=",
"normalizePath",
"(",
"path",
",",
"this",
".",
"path",
")",
";",
"this",
".",
"parent... | Backpropagate a new request handler up the API resource tree in order to register it at the root. | [
"Backpropagate",
"a",
"new",
"request",
"handler",
"up",
"the",
"API",
"resource",
"tree",
"in",
"order",
"to",
"register",
"it",
"at",
"the",
"root",
"."
] | 8d6bbea299c9a8acef92a9c476b941660d0ef982 | https://github.com/JanitorTechnology/selfapi/blob/8d6bbea299c9a8acef92a9c476b941660d0ef982/selfapi.js#L106-L112 | |
47,272 | JanitorTechnology/selfapi | selfapi.js | function (baseUrl, callback) {
var self = this;
var tests = [];
// Export own request handler examples as test functions.
for (var method in self.handlers) {
var handler = self.handlers[method];
if (!handler.examples) {
throw (
'Handler ' + method.toUpperCase() + ' ' + thi... | javascript | function (baseUrl, callback) {
var self = this;
var tests = [];
// Export own request handler examples as test functions.
for (var method in self.handlers) {
var handler = self.handlers[method];
if (!handler.examples) {
throw (
'Handler ' + method.toUpperCase() + ' ' + thi... | [
"function",
"(",
"baseUrl",
",",
"callback",
")",
"{",
"var",
"self",
"=",
"this",
";",
"var",
"tests",
"=",
"[",
"]",
";",
"// Export own request handler examples as test functions.",
"for",
"(",
"var",
"method",
"in",
"self",
".",
"handlers",
")",
"{",
"va... | Export all request handler examples as self-test functions. | [
"Export",
"all",
"request",
"handler",
"examples",
"as",
"self",
"-",
"test",
"functions",
"."
] | 8d6bbea299c9a8acef92a9c476b941660d0ef982 | https://github.com/JanitorTechnology/selfapi/blob/8d6bbea299c9a8acef92a9c476b941660d0ef982/selfapi.js#L129-L169 | |
47,273 | JanitorTechnology/selfapi | selfapi.js | function (baseUrl) {
var fullUrl = url.parse(String(baseUrl || '/'));
fullUrl.pathname = normalizePath(this.path, fullUrl.pathname);
fullUrl = url.format(fullUrl);
var routes = {};
Object.keys(this.children).forEach(function (child) {
routes[child.replace(/^\//, '')] = nodepath.join(fullUrl, ... | javascript | function (baseUrl) {
var fullUrl = url.parse(String(baseUrl || '/'));
fullUrl.pathname = normalizePath(this.path, fullUrl.pathname);
fullUrl = url.format(fullUrl);
var routes = {};
Object.keys(this.children).forEach(function (child) {
routes[child.replace(/^\//, '')] = nodepath.join(fullUrl, ... | [
"function",
"(",
"baseUrl",
")",
"{",
"var",
"fullUrl",
"=",
"url",
".",
"parse",
"(",
"String",
"(",
"baseUrl",
"||",
"'/'",
")",
")",
";",
"fullUrl",
".",
"pathname",
"=",
"normalizePath",
"(",
"this",
".",
"path",
",",
"fullUrl",
".",
"pathname",
... | Build index routes. | [
"Build",
"index",
"routes",
"."
] | 8d6bbea299c9a8acef92a9c476b941660d0ef982 | https://github.com/JanitorTechnology/selfapi/blob/8d6bbea299c9a8acef92a9c476b941660d0ef982/selfapi.js#L394-L404 | |
47,274 | JanitorTechnology/selfapi | selfapi.js | function (basePath, anchors) {
var fullPath = normalizePath(this.path, basePath) || '/';
anchors = anchors || [];
function getAnchor (title) {
var anchor = String(title).toLowerCase()
.replace(/[\s\-]+/g, ' ')
.replace(/[^a-z0-9 ]/g, '')
.trim()
.replace(/ /g, '-');
... | javascript | function (basePath, anchors) {
var fullPath = normalizePath(this.path, basePath) || '/';
anchors = anchors || [];
function getAnchor (title) {
var anchor = String(title).toLowerCase()
.replace(/[\s\-]+/g, ' ')
.replace(/[^a-z0-9 ]/g, '')
.trim()
.replace(/ /g, '-');
... | [
"function",
"(",
"basePath",
",",
"anchors",
")",
"{",
"var",
"fullPath",
"=",
"normalizePath",
"(",
"this",
".",
"path",
",",
"basePath",
")",
"||",
"'/'",
";",
"anchors",
"=",
"anchors",
"||",
"[",
"]",
";",
"function",
"getAnchor",
"(",
"title",
")"... | Export API documentation as HTML. | [
"Export",
"API",
"documentation",
"as",
"HTML",
"."
] | 8d6bbea299c9a8acef92a9c476b941660d0ef982 | https://github.com/JanitorTechnology/selfapi/blob/8d6bbea299c9a8acef92a9c476b941660d0ef982/selfapi.js#L407-L505 | |
47,275 | JanitorTechnology/selfapi | selfapi.js | function (basePath) {
var fullPath = normalizePath(this.path, basePath) || '/';
var markdown = '';
if (this.title) {
markdown += '# ' + this.title + '\n\n';
}
if (this.description) {
markdown += this.description + '\n\n';
}
// Export own request handlers.
for (var method in... | javascript | function (basePath) {
var fullPath = normalizePath(this.path, basePath) || '/';
var markdown = '';
if (this.title) {
markdown += '# ' + this.title + '\n\n';
}
if (this.description) {
markdown += this.description + '\n\n';
}
// Export own request handlers.
for (var method in... | [
"function",
"(",
"basePath",
")",
"{",
"var",
"fullPath",
"=",
"normalizePath",
"(",
"this",
".",
"path",
",",
"basePath",
")",
"||",
"'/'",
";",
"var",
"markdown",
"=",
"''",
";",
"if",
"(",
"this",
".",
"title",
")",
"{",
"markdown",
"+=",
"'# '",
... | Export API documentation as Markdown. | [
"Export",
"API",
"documentation",
"as",
"Markdown",
"."
] | 8d6bbea299c9a8acef92a9c476b941660d0ef982 | https://github.com/JanitorTechnology/selfapi/blob/8d6bbea299c9a8acef92a9c476b941660d0ef982/selfapi.js#L508-L589 | |
47,276 | JanitorTechnology/selfapi | selfapi.js | isServerApp | function isServerApp (app) {
return !!(app && (app.use || app.handle) && app.get && app.post);
} | javascript | function isServerApp (app) {
return !!(app && (app.use || app.handle) && app.get && app.post);
} | [
"function",
"isServerApp",
"(",
"app",
")",
"{",
"return",
"!",
"!",
"(",
"app",
"&&",
"(",
"app",
".",
"use",
"||",
"app",
".",
"handle",
")",
"&&",
"app",
".",
"get",
"&&",
"app",
".",
"post",
")",
";",
"}"
] | Detect if `app` is an express-like server. | [
"Detect",
"if",
"app",
"is",
"an",
"express",
"-",
"like",
"server",
"."
] | 8d6bbea299c9a8acef92a9c476b941660d0ef982 | https://github.com/JanitorTechnology/selfapi/blob/8d6bbea299c9a8acef92a9c476b941660d0ef982/selfapi.js#L608-L610 |
47,277 | JanitorTechnology/selfapi | selfapi.js | getHandlerExporter | function getHandlerExporter (app) {
if (!isServerApp(app)) {
return null;
}
// `app` is an express-like server app.
return function (method, path, parameters) {
// Support restify.
if (method === 'del' && ('delete' in app)) {
method = 'delete';
}
app[method](path, parameters.handler);... | javascript | function getHandlerExporter (app) {
if (!isServerApp(app)) {
return null;
}
// `app` is an express-like server app.
return function (method, path, parameters) {
// Support restify.
if (method === 'del' && ('delete' in app)) {
method = 'delete';
}
app[method](path, parameters.handler);... | [
"function",
"getHandlerExporter",
"(",
"app",
")",
"{",
"if",
"(",
"!",
"isServerApp",
"(",
"app",
")",
")",
"{",
"return",
"null",
";",
"}",
"// `app` is an express-like server app.",
"return",
"function",
"(",
"method",
",",
"path",
",",
"parameters",
")",
... | Try to create a handler exporter function for a given server app. | [
"Try",
"to",
"create",
"a",
"handler",
"exporter",
"function",
"for",
"a",
"given",
"server",
"app",
"."
] | 8d6bbea299c9a8acef92a9c476b941660d0ef982 | https://github.com/JanitorTechnology/selfapi/blob/8d6bbea299c9a8acef92a9c476b941660d0ef982/selfapi.js#L613-L626 |
47,278 | JanitorTechnology/selfapi | selfapi.js | jsonStringifyWithFunctions | function jsonStringifyWithFunctions (value) {
function replacer (key, value) {
if (typeof value === 'function') {
// Stringify this function, and slightly minify it.
value = String(value).replace(/\s+/g, ' ');
}
return options.jsonStringifyReplacer(key, value);
}
return JSON.stringify(valu... | javascript | function jsonStringifyWithFunctions (value) {
function replacer (key, value) {
if (typeof value === 'function') {
// Stringify this function, and slightly minify it.
value = String(value).replace(/\s+/g, ' ');
}
return options.jsonStringifyReplacer(key, value);
}
return JSON.stringify(valu... | [
"function",
"jsonStringifyWithFunctions",
"(",
"value",
")",
"{",
"function",
"replacer",
"(",
"key",
",",
"value",
")",
"{",
"if",
"(",
"typeof",
"value",
"===",
"'function'",
")",
"{",
"// Stringify this function, and slightly minify it.",
"value",
"=",
"String",
... | Stringify everything, including Function bodies. | [
"Stringify",
"everything",
"including",
"Function",
"bodies",
"."
] | 8d6bbea299c9a8acef92a9c476b941660d0ef982 | https://github.com/JanitorTechnology/selfapi/blob/8d6bbea299c9a8acef92a9c476b941660d0ef982/selfapi.js#L651-L660 |
47,279 | 3rd-Eden/shrinkwrap | module.js | Module | function Module(data, range, depth) {
this._id = data.name +'@'+ range; // An unique id that identifies this module.
this.released = data.released; // The date this version go released.
this.licenses = data.licenses; // The licensing.
this.version = data.version; // The version of the... | javascript | function Module(data, range, depth) {
this._id = data.name +'@'+ range; // An unique id that identifies this module.
this.released = data.released; // The date this version go released.
this.licenses = data.licenses; // The licensing.
this.version = data.version; // The version of the... | [
"function",
"Module",
"(",
"data",
",",
"range",
",",
"depth",
")",
"{",
"this",
".",
"_id",
"=",
"data",
".",
"name",
"+",
"'@'",
"+",
"range",
";",
"// An unique id that identifies this module.",
"this",
".",
"released",
"=",
"data",
".",
"released",
";"... | The representation of a single module.
@constructor
@param {Object} data The module data.
@param {String} range The semver range used to get this version.
@param {Number} depth How deeply nested was this module.
@api private | [
"The",
"representation",
"of",
"a",
"single",
"module",
"."
] | 60e0004e4092896e9ba6bd0d83bdc22a973812da | https://github.com/3rd-Eden/shrinkwrap/blob/60e0004e4092896e9ba6bd0d83bdc22a973812da/module.js#L14-L26 |
47,280 | dominictarr/level-scuttlebutt | index.js | checkOld | function checkOld (id, ts) {
return false
if(sources[id] && sources[id] >= ts) return true
sources[id] = ts
} | javascript | function checkOld (id, ts) {
return false
if(sources[id] && sources[id] >= ts) return true
sources[id] = ts
} | [
"function",
"checkOld",
"(",
"id",
",",
"ts",
")",
"{",
"return",
"false",
"if",
"(",
"sources",
"[",
"id",
"]",
"&&",
"sources",
"[",
"id",
"]",
">=",
"ts",
")",
"return",
"true",
"sources",
"[",
"id",
"]",
"=",
"ts",
"}"
] | WHY DID I DO THIS? - remove this and it works. but it seems to be problem with r-array... | [
"WHY",
"DID",
"I",
"DO",
"THIS?",
"-",
"remove",
"this",
"and",
"it",
"works",
".",
"but",
"it",
"seems",
"to",
"be",
"problem",
"with",
"r",
"-",
"array",
"..."
] | fe0f9b68579b391e6995a5ca250ebc54a7fa93a3 | https://github.com/dominictarr/level-scuttlebutt/blob/fe0f9b68579b391e6995a5ca250ebc54a7fa93a3/index.js#L39-L43 |
47,281 | dominictarr/level-scuttlebutt | index.js | onUpdate | function onUpdate (update) {
var value = update[0], ts = update[1], id = update[2]
insertBatch (id, key, ts, JSON.stringify(value), scuttlebutt)
} | javascript | function onUpdate (update) {
var value = update[0], ts = update[1], id = update[2]
insertBatch (id, key, ts, JSON.stringify(value), scuttlebutt)
} | [
"function",
"onUpdate",
"(",
"update",
")",
"{",
"var",
"value",
"=",
"update",
"[",
"0",
"]",
",",
"ts",
"=",
"update",
"[",
"1",
"]",
",",
"id",
"=",
"update",
"[",
"2",
"]",
"insertBatch",
"(",
"id",
",",
"key",
",",
"ts",
",",
"JSON",
".",
... | write the update twice, the first time, to store the document. maybe change scuttlebutt so that value is always a string? If i write a bunch of batches, will they come out in order? because I think updates are expected in order, or it will break. | [
"write",
"the",
"update",
"twice",
"the",
"first",
"time",
"to",
"store",
"the",
"document",
".",
"maybe",
"change",
"scuttlebutt",
"so",
"that",
"value",
"is",
"always",
"a",
"string?",
"If",
"i",
"write",
"a",
"bunch",
"of",
"batches",
"will",
"they",
... | fe0f9b68579b391e6995a5ca250ebc54a7fa93a3 | https://github.com/dominictarr/level-scuttlebutt/blob/fe0f9b68579b391e6995a5ca250ebc54a7fa93a3/index.js#L188-L191 |
47,282 | sfrdmn/node-route-order | index.js | freeVariableWeight | function freeVariableWeight(sliced) {
return sliced.reduce(function(acc, part, i) {
// If is bound part
if (!/^:.+$/.test(part)) {
// Weight is positively correlated to indexes of bound parts
acc += Math.pow(i + 1, sliced.length)
}
return acc
}, 0)
} | javascript | function freeVariableWeight(sliced) {
return sliced.reduce(function(acc, part, i) {
// If is bound part
if (!/^:.+$/.test(part)) {
// Weight is positively correlated to indexes of bound parts
acc += Math.pow(i + 1, sliced.length)
}
return acc
}, 0)
} | [
"function",
"freeVariableWeight",
"(",
"sliced",
")",
"{",
"return",
"sliced",
".",
"reduce",
"(",
"function",
"(",
"acc",
",",
"part",
",",
"i",
")",
"{",
"// If is bound part",
"if",
"(",
"!",
"/",
"^:.+$",
"/",
".",
"test",
"(",
"part",
")",
")",
... | Takes a sliced path and returns an integer representing the
"weight" of its free variables. More specific routes are heavier
Intuitively: when a free variable is at the base of a path e.g.
'/:resource', this is more generic than '/resourceName/:id' and thus has
a lower weight
Weight can only be used to compare paths ... | [
"Takes",
"a",
"sliced",
"path",
"and",
"returns",
"an",
"integer",
"representing",
"the",
"weight",
"of",
"its",
"free",
"variables",
".",
"More",
"specific",
"routes",
"are",
"heavier"
] | b0d695a3096968729b38e045cd9f7dc03148da6d | https://github.com/sfrdmn/node-route-order/blob/b0d695a3096968729b38e045cd9f7dc03148da6d/index.js#L54-L63 |
47,283 | theThings/jailed-node | lib/Connection.js | BasicConnection | function BasicConnection() {
var _this = this
this._disconnected = false
this._messageHandler = function() {
}
this._disconnectHandler = function() {
}
var childArgs = []
process.execArgv.forEach(function(arg) {
if (arg.indexOf('--debug-brk') !== -1) {
var _debugPort = parseInt(arg.substr(1... | javascript | function BasicConnection() {
var _this = this
this._disconnected = false
this._messageHandler = function() {
}
this._disconnectHandler = function() {
}
var childArgs = []
process.execArgv.forEach(function(arg) {
if (arg.indexOf('--debug-brk') !== -1) {
var _debugPort = parseInt(arg.substr(1... | [
"function",
"BasicConnection",
"(",
")",
"{",
"var",
"_this",
"=",
"this",
"this",
".",
"_disconnected",
"=",
"false",
"this",
".",
"_messageHandler",
"=",
"function",
"(",
")",
"{",
"}",
"this",
".",
"_disconnectHandler",
"=",
"function",
"(",
")",
"{",
... | Platform-dependent implementation of the BasicConnection
object, initializes the plugin site and provides the basic
messaging-based connection with it
For Node.js the plugin is created as a forked process | [
"Platform",
"-",
"dependent",
"implementation",
"of",
"the",
"BasicConnection",
"object",
"initializes",
"the",
"plugin",
"site",
"and",
"provides",
"the",
"basic",
"messaging",
"-",
"based",
"connection",
"with",
"it"
] | 6e453d97e74fbd1c0b27b982084f6fd7c1aa0173 | https://github.com/theThings/jailed-node/blob/6e453d97e74fbd1c0b27b982084f6fd7c1aa0173/lib/Connection.js#L21-L56 |
47,284 | thlorenz/6bit-encoder | 6bit-encoder.js | decode2 | function decode2(s) {
assert.equal(s.length, 2)
const [ upper, lower ] = s
return (decode(upper) << 6) | decode(lower)
} | javascript | function decode2(s) {
assert.equal(s.length, 2)
const [ upper, lower ] = s
return (decode(upper) << 6) | decode(lower)
} | [
"function",
"decode2",
"(",
"s",
")",
"{",
"assert",
".",
"equal",
"(",
"s",
".",
"length",
",",
"2",
")",
"const",
"[",
"upper",
",",
"lower",
"]",
"=",
"s",
"return",
"(",
"decode",
"(",
"upper",
")",
"<<",
"6",
")",
"|",
"decode",
"(",
"lowe... | Decodes two chars into a 12 bit number
@name decode2
@param {String} s the chars to decode
@returns {Number} a 12 bit number | [
"Decodes",
"two",
"chars",
"into",
"a",
"12",
"bit",
"number"
] | ea0449137b3c155dcd59bc37c852efa35240dddd | https://github.com/thlorenz/6bit-encoder/blob/ea0449137b3c155dcd59bc37c852efa35240dddd/6bit-encoder.js#L82-L86 |
47,285 | thlorenz/6bit-encoder | 6bit-encoder.js | decode3 | function decode3(s) {
assert.equal(s.length, 3)
const [ upper, mid, lower ] = s
return (decode(upper) << 12) | (decode(mid) << 6) | decode(lower)
} | javascript | function decode3(s) {
assert.equal(s.length, 3)
const [ upper, mid, lower ] = s
return (decode(upper) << 12) | (decode(mid) << 6) | decode(lower)
} | [
"function",
"decode3",
"(",
"s",
")",
"{",
"assert",
".",
"equal",
"(",
"s",
".",
"length",
",",
"3",
")",
"const",
"[",
"upper",
",",
"mid",
",",
"lower",
"]",
"=",
"s",
"return",
"(",
"decode",
"(",
"upper",
")",
"<<",
"12",
")",
"|",
"(",
... | Decodes three chars into an 18 bit number
@name decode3
@param {String} s the chars to decode
@returns {Number} an 18 bit number | [
"Decodes",
"three",
"chars",
"into",
"an",
"18",
"bit",
"number"
] | ea0449137b3c155dcd59bc37c852efa35240dddd | https://github.com/thlorenz/6bit-encoder/blob/ea0449137b3c155dcd59bc37c852efa35240dddd/6bit-encoder.js#L96-L100 |
47,286 | thlorenz/6bit-encoder | 6bit-encoder.js | decode4 | function decode4(s) {
assert.equal(s.length, 4)
const [ upper, belowUpper, aboveLower, lower ] = s
return (decode(upper) << 18) | (decode(belowUpper) << 12)
| (decode(aboveLower) << 6) | decode(lower)
} | javascript | function decode4(s) {
assert.equal(s.length, 4)
const [ upper, belowUpper, aboveLower, lower ] = s
return (decode(upper) << 18) | (decode(belowUpper) << 12)
| (decode(aboveLower) << 6) | decode(lower)
} | [
"function",
"decode4",
"(",
"s",
")",
"{",
"assert",
".",
"equal",
"(",
"s",
".",
"length",
",",
"4",
")",
"const",
"[",
"upper",
",",
"belowUpper",
",",
"aboveLower",
",",
"lower",
"]",
"=",
"s",
"return",
"(",
"decode",
"(",
"upper",
")",
"<<",
... | Decodes four chars into an 24 bit number
@name decode4
@param {String} s the chars to decode
@returns {Number} a 24 bit number | [
"Decodes",
"four",
"chars",
"into",
"an",
"24",
"bit",
"number"
] | ea0449137b3c155dcd59bc37c852efa35240dddd | https://github.com/thlorenz/6bit-encoder/blob/ea0449137b3c155dcd59bc37c852efa35240dddd/6bit-encoder.js#L110-L115 |
47,287 | thlorenz/6bit-encoder | 6bit-encoder.js | decode5 | function decode5(s) {
assert.equal(s.length, 5)
const [ upper, belowUpper, mid, aboveLower, lower ] = s
return (decode(upper) << 24) | (decode(belowUpper) << 18)
| (decode(mid) << 12) | (decode(aboveLower) << 6) | decode(lower)
} | javascript | function decode5(s) {
assert.equal(s.length, 5)
const [ upper, belowUpper, mid, aboveLower, lower ] = s
return (decode(upper) << 24) | (decode(belowUpper) << 18)
| (decode(mid) << 12) | (decode(aboveLower) << 6) | decode(lower)
} | [
"function",
"decode5",
"(",
"s",
")",
"{",
"assert",
".",
"equal",
"(",
"s",
".",
"length",
",",
"5",
")",
"const",
"[",
"upper",
",",
"belowUpper",
",",
"mid",
",",
"aboveLower",
",",
"lower",
"]",
"=",
"s",
"return",
"(",
"decode",
"(",
"upper",
... | Decodes five chars into an 30 bit number
@name decode5
@param {String} s the chars to decode
@returns {Number} a 30 bit number | [
"Decodes",
"five",
"chars",
"into",
"an",
"30",
"bit",
"number"
] | ea0449137b3c155dcd59bc37c852efa35240dddd | https://github.com/thlorenz/6bit-encoder/blob/ea0449137b3c155dcd59bc37c852efa35240dddd/6bit-encoder.js#L125-L130 |
47,288 | thlorenz/6bit-encoder | 6bit-encoder.js | encode2 | function encode2(n) {
assert(0 <= n && n <= 0xfff, ENCODE_OUTOFBOUNDS + n)
// 12 bits -> 2 digits
const lower = isolate(n, 0, 6)
const upper = isolate(n, 6, 6)
return encode(upper) + encode(lower)
} | javascript | function encode2(n) {
assert(0 <= n && n <= 0xfff, ENCODE_OUTOFBOUNDS + n)
// 12 bits -> 2 digits
const lower = isolate(n, 0, 6)
const upper = isolate(n, 6, 6)
return encode(upper) + encode(lower)
} | [
"function",
"encode2",
"(",
"n",
")",
"{",
"assert",
"(",
"0",
"<=",
"n",
"&&",
"n",
"<=",
"0xfff",
",",
"ENCODE_OUTOFBOUNDS",
"+",
"n",
")",
"// 12 bits -> 2 digits",
"const",
"lower",
"=",
"isolate",
"(",
"n",
",",
"0",
",",
"6",
")",
"const",
"upp... | Encodes a 12 bit number into two URL safe chars
@name encode2
@param {Number} n a 12 bit number
@returns {String} the chars | [
"Encodes",
"a",
"12",
"bit",
"number",
"into",
"two",
"URL",
"safe",
"chars"
] | ea0449137b3c155dcd59bc37c852efa35240dddd | https://github.com/thlorenz/6bit-encoder/blob/ea0449137b3c155dcd59bc37c852efa35240dddd/6bit-encoder.js#L154-L160 |
47,289 | thlorenz/6bit-encoder | 6bit-encoder.js | encode3 | function encode3(n) {
assert(0 <= n && n <= 0x3ffff, ENCODE_OUTOFBOUNDS + n)
// 18 bits -> 3 digits
const lower = isolate(n, 0, 6)
const mid = isolate(n, 6, 6)
const upper = isolate(n, 12, 6)
return encode(upper) + encode(mid) + encode(lower)
} | javascript | function encode3(n) {
assert(0 <= n && n <= 0x3ffff, ENCODE_OUTOFBOUNDS + n)
// 18 bits -> 3 digits
const lower = isolate(n, 0, 6)
const mid = isolate(n, 6, 6)
const upper = isolate(n, 12, 6)
return encode(upper) + encode(mid) + encode(lower)
} | [
"function",
"encode3",
"(",
"n",
")",
"{",
"assert",
"(",
"0",
"<=",
"n",
"&&",
"n",
"<=",
"0x3ffff",
",",
"ENCODE_OUTOFBOUNDS",
"+",
"n",
")",
"// 18 bits -> 3 digits",
"const",
"lower",
"=",
"isolate",
"(",
"n",
",",
"0",
",",
"6",
")",
"const",
"m... | Encodes a 18 bit number into three URL safe chars
@name encode3
@param {Number} n a 18 bit number
@returns {String} the chars | [
"Encodes",
"a",
"18",
"bit",
"number",
"into",
"three",
"URL",
"safe",
"chars"
] | ea0449137b3c155dcd59bc37c852efa35240dddd | https://github.com/thlorenz/6bit-encoder/blob/ea0449137b3c155dcd59bc37c852efa35240dddd/6bit-encoder.js#L170-L177 |
47,290 | thlorenz/6bit-encoder | 6bit-encoder.js | encode4 | function encode4(n) {
assert(0 <= n && n <= 0xffffff, ENCODE_OUTOFBOUNDS + n)
// 24 bits -> 4 digits
const lower = isolate(n, 0, 6)
const aboveLower = isolate(n, 6, 6)
const belowUpper = isolate(n, 12, 6)
const upper = isolate(n, 18, 6)
return encode(upper) + encode(belowUpper)
+ encode(aboveLower) + ... | javascript | function encode4(n) {
assert(0 <= n && n <= 0xffffff, ENCODE_OUTOFBOUNDS + n)
// 24 bits -> 4 digits
const lower = isolate(n, 0, 6)
const aboveLower = isolate(n, 6, 6)
const belowUpper = isolate(n, 12, 6)
const upper = isolate(n, 18, 6)
return encode(upper) + encode(belowUpper)
+ encode(aboveLower) + ... | [
"function",
"encode4",
"(",
"n",
")",
"{",
"assert",
"(",
"0",
"<=",
"n",
"&&",
"n",
"<=",
"0xffffff",
",",
"ENCODE_OUTOFBOUNDS",
"+",
"n",
")",
"// 24 bits -> 4 digits",
"const",
"lower",
"=",
"isolate",
"(",
"n",
",",
"0",
",",
"6",
")",
"const",
"... | Encodes a 24 bit number into four URL safe chars
@name encode4
@param {Number} n a 24 bit number
@returns {String} the chars | [
"Encodes",
"a",
"24",
"bit",
"number",
"into",
"four",
"URL",
"safe",
"chars"
] | ea0449137b3c155dcd59bc37c852efa35240dddd | https://github.com/thlorenz/6bit-encoder/blob/ea0449137b3c155dcd59bc37c852efa35240dddd/6bit-encoder.js#L187-L196 |
47,291 | thlorenz/6bit-encoder | 6bit-encoder.js | encode5 | function encode5(n) {
assert(0 <= n && n <= 0x3fffffff, ENCODE_OUTOFBOUNDS + n)
// 30 bits -> 5 digits
const lower = isolate(n, 0, 6)
const aboveLower = isolate(n, 6, 6)
const mid = isolate(n, 12, 6)
const belowUpper = isolate(n, 18, 6)
const upper = isolate(n, 24, 6)
return encode(upper) + encode(below... | javascript | function encode5(n) {
assert(0 <= n && n <= 0x3fffffff, ENCODE_OUTOFBOUNDS + n)
// 30 bits -> 5 digits
const lower = isolate(n, 0, 6)
const aboveLower = isolate(n, 6, 6)
const mid = isolate(n, 12, 6)
const belowUpper = isolate(n, 18, 6)
const upper = isolate(n, 24, 6)
return encode(upper) + encode(below... | [
"function",
"encode5",
"(",
"n",
")",
"{",
"assert",
"(",
"0",
"<=",
"n",
"&&",
"n",
"<=",
"0x3fffffff",
",",
"ENCODE_OUTOFBOUNDS",
"+",
"n",
")",
"// 30 bits -> 5 digits",
"const",
"lower",
"=",
"isolate",
"(",
"n",
",",
"0",
",",
"6",
")",
"const",
... | Encodes a 30 bit number into five URL safe chars
@name encode5
@param {Number} n a 30 bit number
@returns {String} the chars | [
"Encodes",
"a",
"30",
"bit",
"number",
"into",
"five",
"URL",
"safe",
"chars"
] | ea0449137b3c155dcd59bc37c852efa35240dddd | https://github.com/thlorenz/6bit-encoder/blob/ea0449137b3c155dcd59bc37c852efa35240dddd/6bit-encoder.js#L206-L216 |
47,292 | thlorenz/6bit-encoder | 6bit-encoder.js | decodeFor | function decodeFor(n) {
return (
n === 1 ? decode
: n === 2 ? decode2
: n === 3 ? decode3
: n === 4 ? decode4
: decode5
)
} | javascript | function decodeFor(n) {
return (
n === 1 ? decode
: n === 2 ? decode2
: n === 3 ? decode3
: n === 4 ? decode4
: decode5
)
} | [
"function",
"decodeFor",
"(",
"n",
")",
"{",
"return",
"(",
"n",
"===",
"1",
"?",
"decode",
":",
"n",
"===",
"2",
"?",
"decode2",
":",
"n",
"===",
"3",
"?",
"decode3",
":",
"n",
"===",
"4",
"?",
"decode4",
":",
"decode5",
")",
"}"
] | Get a decode function to decode n chars
@name decodeFor
@param {Number} n the number of chars to decode
@returns {function} the matching decoding function | [
"Get",
"a",
"decode",
"function",
"to",
"decode",
"n",
"chars"
] | ea0449137b3c155dcd59bc37c852efa35240dddd | https://github.com/thlorenz/6bit-encoder/blob/ea0449137b3c155dcd59bc37c852efa35240dddd/6bit-encoder.js#L226-L234 |
47,293 | jakubchadim/nightmare-react-utils | src/actions.js | function (selector, done) {
this.evaluate_now((selector) => {
let element = document.querySelector(selector)
if (!element) {
return false
}
for (let key in element) {
if (key.startsWith('__reactInternalInstance$')) {
return true
}
}
return false
}, done, selector)... | javascript | function (selector, done) {
this.evaluate_now((selector) => {
let element = document.querySelector(selector)
if (!element) {
return false
}
for (let key in element) {
if (key.startsWith('__reactInternalInstance$')) {
return true
}
}
return false
}, done, selector)... | [
"function",
"(",
"selector",
",",
"done",
")",
"{",
"this",
".",
"evaluate_now",
"(",
"(",
"selector",
")",
"=>",
"{",
"let",
"element",
"=",
"document",
".",
"querySelector",
"(",
"selector",
")",
"if",
"(",
"!",
"element",
")",
"{",
"return",
"false"... | Check if react element exists
@param {String} selector
@param {Function} done
@return {Boolean} | [
"Check",
"if",
"react",
"element",
"exists"
] | b36cf50e0016f59fdd4a53cc57f5b0e239394ce6 | https://github.com/jakubchadim/nightmare-react-utils/blob/b36cf50e0016f59fdd4a53cc57f5b0e239394ce6/src/actions.js#L13-L28 | |
47,294 | jakubchadim/nightmare-react-utils | src/actions.js | function (selector, done) {
this.evaluate_now((selector) => {
let element = document.querySelector(selector)
if (!element) {
return null
}
for (let key in element) {
if (key.startsWith('__reactInternalInstance$')) {
const compInternals = element[key]._currentElement
const ... | javascript | function (selector, done) {
this.evaluate_now((selector) => {
let element = document.querySelector(selector)
if (!element) {
return null
}
for (let key in element) {
if (key.startsWith('__reactInternalInstance$')) {
const compInternals = element[key]._currentElement
const ... | [
"function",
"(",
"selector",
",",
"done",
")",
"{",
"this",
".",
"evaluate_now",
"(",
"(",
"selector",
")",
"=>",
"{",
"let",
"element",
"=",
"document",
".",
"querySelector",
"(",
"selector",
")",
"if",
"(",
"!",
"element",
")",
"{",
"return",
"null",... | Find react element by selector and return his values
@param {String} selector
@param {Function} done
@return {{state: Object, props: Object, context: Object}} | [
"Find",
"react",
"element",
"by",
"selector",
"and",
"return",
"his",
"values"
] | b36cf50e0016f59fdd4a53cc57f5b0e239394ce6 | https://github.com/jakubchadim/nightmare-react-utils/blob/b36cf50e0016f59fdd4a53cc57f5b0e239394ce6/src/actions.js#L37-L59 | |
47,295 | jakubchadim/nightmare-react-utils | src/actions.js | function (selector, done) {
this.evaluate_now((selector) => {
let elements = document.querySelectorAll(selector)
if (!elements.length) {
return []
}
elements = [].slice.call(elements) // Convert to array
return elements.map(element => {
for (let key in element) {
if (key.star... | javascript | function (selector, done) {
this.evaluate_now((selector) => {
let elements = document.querySelectorAll(selector)
if (!elements.length) {
return []
}
elements = [].slice.call(elements) // Convert to array
return elements.map(element => {
for (let key in element) {
if (key.star... | [
"function",
"(",
"selector",
",",
"done",
")",
"{",
"this",
".",
"evaluate_now",
"(",
"(",
"selector",
")",
"=>",
"{",
"let",
"elements",
"=",
"document",
".",
"querySelectorAll",
"(",
"selector",
")",
"if",
"(",
"!",
"elements",
".",
"length",
")",
"{... | Find all react elements by selector and return their values
@param {String} selector
@param {Function} done
@return {Array} | [
"Find",
"all",
"react",
"elements",
"by",
"selector",
"and",
"return",
"their",
"values"
] | b36cf50e0016f59fdd4a53cc57f5b0e239394ce6 | https://github.com/jakubchadim/nightmare-react-utils/blob/b36cf50e0016f59fdd4a53cc57f5b0e239394ce6/src/actions.js#L68-L92 | |
47,296 | jakubchadim/nightmare-react-utils | src/actions.js | waitfn | function waitfn () {
const softTimeout = this.timeout || null
const callback = this.callback
let executionTimer
let softTimeoutTimer
let self = arguments[0]
let args = sliced(arguments)
let done = args[args.length - 1]
let timeoutTimer = setTimeout(function () {
clearTimeout(executionTimer)
cl... | javascript | function waitfn () {
const softTimeout = this.timeout || null
const callback = this.callback
let executionTimer
let softTimeoutTimer
let self = arguments[0]
let args = sliced(arguments)
let done = args[args.length - 1]
let timeoutTimer = setTimeout(function () {
clearTimeout(executionTimer)
cl... | [
"function",
"waitfn",
"(",
")",
"{",
"const",
"softTimeout",
"=",
"this",
".",
"timeout",
"||",
"null",
"const",
"callback",
"=",
"this",
".",
"callback",
"let",
"executionTimer",
"let",
"softTimeoutTimer",
"let",
"self",
"=",
"arguments",
"[",
"0",
"]",
"... | Wait until evaluated function returns true.
@param {Nightmare} self
@param {Function} fn
@param {...} args
@param {Function} done | [
"Wait",
"until",
"evaluated",
"function",
"returns",
"true",
"."
] | b36cf50e0016f59fdd4a53cc57f5b0e239394ce6 | https://github.com/jakubchadim/nightmare-react-utils/blob/b36cf50e0016f59fdd4a53cc57f5b0e239394ce6/src/actions.js#L146-L193 |
47,297 | jakubchadim/nightmare-react-utils | src/actions.js | waitelem | function waitelem (self, selector, done) {
let elementPresent
eval('elementPresent = function() {' + // eslint-disable-line
` var element = document.querySelector('${selector}');` +
' if (!element) { return null }' +
' for (let key in element) {' +
' if (key.startsWith(\'__reactInternalInstanc... | javascript | function waitelem (self, selector, done) {
let elementPresent
eval('elementPresent = function() {' + // eslint-disable-line
` var element = document.querySelector('${selector}');` +
' if (!element) { return null }' +
' for (let key in element) {' +
' if (key.startsWith(\'__reactInternalInstanc... | [
"function",
"waitelem",
"(",
"self",
",",
"selector",
",",
"done",
")",
"{",
"let",
"elementPresent",
"eval",
"(",
"'elementPresent = function() {'",
"+",
"// eslint-disable-line",
"`",
"${",
"selector",
"}",
"`",
"+",
"' if (!element) { return null }'",
"+",
"' f... | Wait for a specified selector to exist.
@param {Nightmare} self
@param {String} selector
@param {Function} done | [
"Wait",
"for",
"a",
"specified",
"selector",
"to",
"exist",
"."
] | b36cf50e0016f59fdd4a53cc57f5b0e239394ce6 | https://github.com/jakubchadim/nightmare-react-utils/blob/b36cf50e0016f59fdd4a53cc57f5b0e239394ce6/src/actions.js#L202-L218 |
47,298 | VisionistInc/jibe | app.js | function(io) {
// chat routes
router.use('/chat', chatRoutes);
// ops routes
router.use('/ops', opsRoutes);
// ShareJS built-in REST routes
router.use('/docs', shareRoutes);
if(io) {
io.of('/chat').on('connection', chatHandler);
}
router.use('/lib', expr... | javascript | function(io) {
// chat routes
router.use('/chat', chatRoutes);
// ops routes
router.use('/ops', opsRoutes);
// ShareJS built-in REST routes
router.use('/docs', shareRoutes);
if(io) {
io.of('/chat').on('connection', chatHandler);
}
router.use('/lib', expr... | [
"function",
"(",
"io",
")",
"{",
"// chat routes",
"router",
".",
"use",
"(",
"'/chat'",
",",
"chatRoutes",
")",
";",
"// ops routes",
"router",
".",
"use",
"(",
"'/ops'",
",",
"opsRoutes",
")",
";",
"// ShareJS built-in REST routes",
"router",
".",
"use",
"... | This function creates and returns an Express 4 Router.
As a side effect, creates the necessary socket channels using the given
socketIO object.
Example usage:
var express = require('express'),
app = express(),
server = require('http').createServer(app),
io = require('socket.io').listen(server);
var jibe = require('... | [
"This",
"function",
"creates",
"and",
"returns",
"an",
"Express",
"4",
"Router",
"."
] | 3a154c0d86a3bcf8980c5104daec099ec738a4e0 | https://github.com/VisionistInc/jibe/blob/3a154c0d86a3bcf8980c5104daec099ec738a4e0/app.js#L62-L80 | |
47,299 | oscmejia/libs | lib/libs/format.js | decimal | function decimal(_num, _precision) {
// If _num is undefined, assing 0
if(_num === undefined) _num = 0;
// If _precision is undefined, assigned 2
if(_precision === undefined) _num = 2;
n = Math.abs(_num);
var sign = '';
if(_num < 0)
sign = '-';
return sign + n.toFixed(_precision... | javascript | function decimal(_num, _precision) {
// If _num is undefined, assing 0
if(_num === undefined) _num = 0;
// If _precision is undefined, assigned 2
if(_precision === undefined) _num = 2;
n = Math.abs(_num);
var sign = '';
if(_num < 0)
sign = '-';
return sign + n.toFixed(_precision... | [
"function",
"decimal",
"(",
"_num",
",",
"_precision",
")",
"{",
"// If _num is undefined, assing 0\t",
"if",
"(",
"_num",
"===",
"undefined",
")",
"_num",
"=",
"0",
";",
"// If _precision is undefined, assigned 2",
"if",
"(",
"_precision",
"===",
"undefined",
")",
... | Returns a string of a number with the given presicion.
@param {Number} _num
@param {int} _precision
@api public | [
"Returns",
"a",
"string",
"of",
"a",
"number",
"with",
"the",
"given",
"presicion",
"."
] | 81f8654af6ee922963e6cc3f6cda96ffa75142cf | https://github.com/oscmejia/libs/blob/81f8654af6ee922963e6cc3f6cda96ffa75142cf/lib/libs/format.js#L25-L40 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.