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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
15,300 | byteball/ocore | my_witnesses.js | replaceWitness | function replaceWitness(old_witness, new_witness, handleResult){
if (!ValidationUtils.isValidAddress(new_witness))
return handleResult("new witness address is invalid");
readMyWitnesses(function(arrWitnesses){
if (arrWitnesses.indexOf(old_witness) === -1)
return handleResult("old witness not known");
if (arr... | javascript | function replaceWitness(old_witness, new_witness, handleResult){
if (!ValidationUtils.isValidAddress(new_witness))
return handleResult("new witness address is invalid");
readMyWitnesses(function(arrWitnesses){
if (arrWitnesses.indexOf(old_witness) === -1)
return handleResult("old witness not known");
if (arr... | [
"function",
"replaceWitness",
"(",
"old_witness",
",",
"new_witness",
",",
"handleResult",
")",
"{",
"if",
"(",
"!",
"ValidationUtils",
".",
"isValidAddress",
"(",
"new_witness",
")",
")",
"return",
"handleResult",
"(",
"\"new witness address is invalid\"",
")",
";"... | replaces old_witness with new_witness | [
"replaces",
"old_witness",
"with",
"new_witness"
] | 17e82e31517d62c456c04d898423dc9ab01d96a6 | https://github.com/byteball/ocore/blob/17e82e31517d62c456c04d898423dc9ab01d96a6/my_witnesses.js#L38-L67 |
15,301 | byteball/ocore | wallet.js | sendSignature | function sendSignature(device_address, signed_text, signature, signing_path, address){
device.sendMessageToDevice(device_address, "signature", {signed_text: signed_text, signature: signature, signing_path: signing_path, address: address});
} | javascript | function sendSignature(device_address, signed_text, signature, signing_path, address){
device.sendMessageToDevice(device_address, "signature", {signed_text: signed_text, signature: signature, signing_path: signing_path, address: address});
} | [
"function",
"sendSignature",
"(",
"device_address",
",",
"signed_text",
",",
"signature",
",",
"signing_path",
",",
"address",
")",
"{",
"device",
".",
"sendMessageToDevice",
"(",
"device_address",
",",
"\"signature\"",
",",
"{",
"signed_text",
":",
"signed_text",
... | called from UI after user confirms signing request initiated from another device, initiator device being the recipient of this message | [
"called",
"from",
"UI",
"after",
"user",
"confirms",
"signing",
"request",
"initiated",
"from",
"another",
"device",
"initiator",
"device",
"being",
"the",
"recipient",
"of",
"this",
"message"
] | 17e82e31517d62c456c04d898423dc9ab01d96a6 | https://github.com/byteball/ocore/blob/17e82e31517d62c456c04d898423dc9ab01d96a6/wallet.js#L147-L149 |
15,302 | byteball/ocore | wallet.js | function(){
console.log("handleOnlinePrivatePayment queued, will wait for "+key);
eventBus.once(key, function(bValid){
if (!bValid)
return cancelAllKeys();
assocValidatedByKey[key] = true;
if (bParsingComplete)
checkIfAllValidated();
else
console.log('parsing incom... | javascript | function(){
console.log("handleOnlinePrivatePayment queued, will wait for "+key);
eventBus.once(key, function(bValid){
if (!bValid)
return cancelAllKeys();
assocValidatedByKey[key] = true;
if (bParsingComplete)
checkIfAllValidated();
else
console.log('parsing incom... | [
"function",
"(",
")",
"{",
"console",
".",
"log",
"(",
"\"handleOnlinePrivatePayment queued, will wait for \"",
"+",
"key",
")",
";",
"eventBus",
".",
"once",
"(",
"key",
",",
"function",
"(",
"bValid",
")",
"{",
"if",
"(",
"!",
"bValid",
")",
"return",
"c... | this is the most likely outcome for light clients | [
"this",
"is",
"the",
"most",
"likely",
"outcome",
"for",
"light",
"clients"
] | 17e82e31517d62c456c04d898423dc9ab01d96a6 | https://github.com/byteball/ocore/blob/17e82e31517d62c456c04d898423dc9ab01d96a6/wallet.js#L670-L682 | |
15,303 | byteball/ocore | wallet.js | readFundedAndSigningAddresses | function readFundedAndSigningAddresses(
asset, wallet, estimated_amount, spend_unconfirmed, fee_paying_wallet,
arrSigningAddresses, arrSigningDeviceAddresses, handleFundedAndSigningAddresses)
{
readFundedAddresses(asset, wallet, estimated_amount, spend_unconfirmed, function(arrFundedAddresses){
if (arrFundedAddr... | javascript | function readFundedAndSigningAddresses(
asset, wallet, estimated_amount, spend_unconfirmed, fee_paying_wallet,
arrSigningAddresses, arrSigningDeviceAddresses, handleFundedAndSigningAddresses)
{
readFundedAddresses(asset, wallet, estimated_amount, spend_unconfirmed, function(arrFundedAddresses){
if (arrFundedAddr... | [
"function",
"readFundedAndSigningAddresses",
"(",
"asset",
",",
"wallet",
",",
"estimated_amount",
",",
"spend_unconfirmed",
",",
"fee_paying_wallet",
",",
"arrSigningAddresses",
",",
"arrSigningDeviceAddresses",
",",
"handleFundedAndSigningAddresses",
")",
"{",
"readFundedAd... | fee_paying_wallet is used only if there are no bytes on the asset wallet, it is a sort of fallback wallet for fees | [
"fee_paying_wallet",
"is",
"used",
"only",
"if",
"there",
"are",
"no",
"bytes",
"on",
"the",
"asset",
"wallet",
"it",
"is",
"a",
"sort",
"of",
"fallback",
"wallet",
"for",
"fees"
] | 17e82e31517d62c456c04d898423dc9ab01d96a6 | https://github.com/byteball/ocore/blob/17e82e31517d62c456c04d898423dc9ab01d96a6/wallet.js#L1401-L1429 |
15,304 | byteball/ocore | wallet.js | checkStability | function checkStability() {
db.query(
"SELECT is_stable, asset, SUM(amount) AS `amount` \n\
FROM outputs JOIN units USING(unit) WHERE address=? AND sequence='good' AND is_spent=0 GROUP BY asset ORDER BY asset DESC LIMIT 1",
[addrInfo.address],
function(rows){
if (rows.length === 0) {
cb("This te... | javascript | function checkStability() {
db.query(
"SELECT is_stable, asset, SUM(amount) AS `amount` \n\
FROM outputs JOIN units USING(unit) WHERE address=? AND sequence='good' AND is_spent=0 GROUP BY asset ORDER BY asset DESC LIMIT 1",
[addrInfo.address],
function(rows){
if (rows.length === 0) {
cb("This te... | [
"function",
"checkStability",
"(",
")",
"{",
"db",
".",
"query",
"(",
"\"SELECT is_stable, asset, SUM(amount) AS `amount` \\n\\\n\t\t\tFROM outputs JOIN units USING(unit) WHERE address=? AND sequence='good' AND is_spent=0 GROUP BY asset ORDER BY asset DESC LIMIT 1\"",
",",
"[",
"addrInfo",
... | check stability of payingAddresses | [
"check",
"stability",
"of",
"payingAddresses"
] | 17e82e31517d62c456c04d898423dc9ab01d96a6 | https://github.com/byteball/ocore/blob/17e82e31517d62c456c04d898423dc9ab01d96a6/wallet.js#L2031-L2075 |
15,305 | byteball/ocore | wallet.js | claimBackOldTextcoins | function claimBackOldTextcoins(to_address, days){
db.query(
"SELECT mnemonic FROM sent_mnemonics LEFT JOIN unit_authors USING(address) \n\
WHERE mnemonic!='' AND unit_authors.address IS NULL AND creation_date<"+db.addTime("-"+days+" DAYS"),
function(rows){
async.eachSeries(
rows,
function(row, cb){
... | javascript | function claimBackOldTextcoins(to_address, days){
db.query(
"SELECT mnemonic FROM sent_mnemonics LEFT JOIN unit_authors USING(address) \n\
WHERE mnemonic!='' AND unit_authors.address IS NULL AND creation_date<"+db.addTime("-"+days+" DAYS"),
function(rows){
async.eachSeries(
rows,
function(row, cb){
... | [
"function",
"claimBackOldTextcoins",
"(",
"to_address",
",",
"days",
")",
"{",
"db",
".",
"query",
"(",
"\"SELECT mnemonic FROM sent_mnemonics LEFT JOIN unit_authors USING(address) \\n\\\n\t\tWHERE mnemonic!='' AND unit_authors.address IS NULL AND creation_date<\"",
"+",
"db",
".",
"... | if a textcoin was not claimed for 'days' days, claims it back | [
"if",
"a",
"textcoin",
"was",
"not",
"claimed",
"for",
"days",
"days",
"claims",
"it",
"back"
] | 17e82e31517d62c456c04d898423dc9ab01d96a6 | https://github.com/byteball/ocore/blob/17e82e31517d62c456c04d898423dc9ab01d96a6/wallet.js#L2079-L2098 |
15,306 | googleapis/cloud-profiler-nodejs | proto/profiler.js | CreateProfileRequest | function CreateProfileRequest(properties) {
this.profileType = [];
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
... | javascript | function CreateProfileRequest(properties) {
this.profileType = [];
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
... | [
"function",
"CreateProfileRequest",
"(",
"properties",
")",
"{",
"this",
".",
"profileType",
"=",
"[",
"]",
";",
"if",
"(",
"properties",
")",
"for",
"(",
"var",
"keys",
"=",
"Object",
".",
"keys",
"(",
"properties",
")",
",",
"i",
"=",
"0",
";",
"i"... | Properties of a CreateProfileRequest.
@memberof google.devtools.cloudprofiler.v2
@interface ICreateProfileRequest
@property {google.devtools.cloudprofiler.v2.IDeployment} [deployment] CreateProfileRequest deployment
@property {Array.<google.devtools.cloudprofiler.v2.ProfileType>} [profileType] CreateProfileRequest prof... | [
"Properties",
"of",
"a",
"CreateProfileRequest",
"."
] | 59429e72b51e655e9524c274c442824810907d0b | https://github.com/googleapis/cloud-profiler-nodejs/blob/59429e72b51e655e9524c274c442824810907d0b/proto/profiler.js#L167-L173 |
15,307 | googleapis/cloud-profiler-nodejs | proto/profiler.js | UpdateProfileRequest | function UpdateProfileRequest(properties) {
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
... | javascript | function UpdateProfileRequest(properties) {
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
... | [
"function",
"UpdateProfileRequest",
"(",
"properties",
")",
"{",
"if",
"(",
"properties",
")",
"for",
"(",
"var",
"keys",
"=",
"Object",
".",
"keys",
"(",
"properties",
")",
",",
"i",
"=",
"0",
";",
"i",
"<",
"keys",
".",
"length",
";",
"++",
"i",
... | Properties of an UpdateProfileRequest.
@memberof google.devtools.cloudprofiler.v2
@interface IUpdateProfileRequest
@property {google.devtools.cloudprofiler.v2.IProfile} [profile] UpdateProfileRequest profile
Constructs a new UpdateProfileRequest.
@memberof google.devtools.cloudprofiler.v2
@classdesc Represents an Upd... | [
"Properties",
"of",
"an",
"UpdateProfileRequest",
"."
] | 59429e72b51e655e9524c274c442824810907d0b | https://github.com/googleapis/cloud-profiler-nodejs/blob/59429e72b51e655e9524c274c442824810907d0b/proto/profiler.js#L466-L471 |
15,308 | googleapis/cloud-profiler-nodejs | proto/profiler.js | Deployment | function Deployment(properties) {
this.labels = {};
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[... | javascript | function Deployment(properties) {
this.labels = {};
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[... | [
"function",
"Deployment",
"(",
"properties",
")",
"{",
"this",
".",
"labels",
"=",
"{",
"}",
";",
"if",
"(",
"properties",
")",
"for",
"(",
"var",
"keys",
"=",
"Object",
".",
"keys",
"(",
"properties",
")",
",",
"i",
"=",
"0",
";",
"i",
"<",
"key... | Properties of a Deployment.
@memberof google.devtools.cloudprofiler.v2
@interface IDeployment
@property {string} [projectId] Deployment projectId
@property {string} [target] Deployment target
@property {Object.<string,string>} [labels] Deployment labels
Constructs a new Deployment.
@memberof google.devtools.cloudprof... | [
"Properties",
"of",
"a",
"Deployment",
"."
] | 59429e72b51e655e9524c274c442824810907d0b | https://github.com/googleapis/cloud-profiler-nodejs/blob/59429e72b51e655e9524c274c442824810907d0b/proto/profiler.js#L1024-L1030 |
15,309 | googleapis/cloud-profiler-nodejs | proto/profile.js | ValueType | function ValueType(properties) {
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
} | javascript | function ValueType(properties) {
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
} | [
"function",
"ValueType",
"(",
"properties",
")",
"{",
"if",
"(",
"properties",
")",
"for",
"(",
"var",
"keys",
"=",
"Object",
".",
"keys",
"(",
"properties",
")",
",",
"i",
"=",
"0",
";",
"i",
"<",
"keys",
".",
"length",
";",
"++",
"i",
")",
"if"... | Properties of a ValueType.
@memberof perftools.profiles
@interface IValueType
@property {number|Long} [type] ValueType type
@property {number|Long} [unit] ValueType unit
Constructs a new ValueType.
@memberof perftools.profiles
@classdesc Represents a ValueType.
@constructor
@param {perftools.profiles.IValueType=} [pr... | [
"Properties",
"of",
"a",
"ValueType",
"."
] | 59429e72b51e655e9524c274c442824810907d0b | https://github.com/googleapis/cloud-profiler-nodejs/blob/59429e72b51e655e9524c274c442824810907d0b/proto/profile.js#L766-L771 |
15,310 | googleapis/cloud-profiler-nodejs | proto/profile.js | Sample | function Sample(properties) {
this.locationId = [];
this.value = [];
this.label = [];
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
... | javascript | function Sample(properties) {
this.locationId = [];
this.value = [];
this.label = [];
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
... | [
"function",
"Sample",
"(",
"properties",
")",
"{",
"this",
".",
"locationId",
"=",
"[",
"]",
";",
"this",
".",
"value",
"=",
"[",
"]",
";",
"this",
".",
"label",
"=",
"[",
"]",
";",
"if",
"(",
"properties",
")",
"for",
"(",
"var",
"keys",
"=",
... | Properties of a Sample.
@memberof perftools.profiles
@interface ISample
@property {Array.<number|Long>} [locationId] Sample locationId
@property {Array.<number|Long>} [value] Sample value
@property {Array.<perftools.profiles.ILabel>} [label] Sample label
Constructs a new Sample.
@memberof perftools.profiles
@classdes... | [
"Properties",
"of",
"a",
"Sample",
"."
] | 59429e72b51e655e9524c274c442824810907d0b | https://github.com/googleapis/cloud-profiler-nodejs/blob/59429e72b51e655e9524c274c442824810907d0b/proto/profile.js#L1004-L1012 |
15,311 | googleapis/cloud-profiler-nodejs | proto/profile.js | Label | function Label(properties) {
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
} | javascript | function Label(properties) {
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
} | [
"function",
"Label",
"(",
"properties",
")",
"{",
"if",
"(",
"properties",
")",
"for",
"(",
"var",
"keys",
"=",
"Object",
".",
"keys",
"(",
"properties",
")",
",",
"i",
"=",
"0",
";",
"i",
"<",
"keys",
".",
"length",
";",
"++",
"i",
")",
"if",
... | Properties of a Label.
@memberof perftools.profiles
@interface ILabel
@property {number|Long} [key] Label key
@property {number|Long} [str] Label str
@property {number|Long} [num] Label num
@property {number|Long} [numUnit] Label numUnit
Constructs a new Label.
@memberof perftools.profiles
@classdesc Represents a Lab... | [
"Properties",
"of",
"a",
"Label",
"."
] | 59429e72b51e655e9524c274c442824810907d0b | https://github.com/googleapis/cloud-profiler-nodejs/blob/59429e72b51e655e9524c274c442824810907d0b/proto/profile.js#L1325-L1330 |
15,312 | googleapis/cloud-profiler-nodejs | proto/profile.js | Mapping | function Mapping(properties) {
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
} | javascript | function Mapping(properties) {
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
} | [
"function",
"Mapping",
"(",
"properties",
")",
"{",
"if",
"(",
"properties",
")",
"for",
"(",
"var",
"keys",
"=",
"Object",
".",
"keys",
"(",
"properties",
")",
",",
"i",
"=",
"0",
";",
"i",
"<",
"keys",
".",
"length",
";",
"++",
"i",
")",
"if",
... | Properties of a Mapping.
@memberof perftools.profiles
@interface IMapping
@property {number|Long} [id] Mapping id
@property {number|Long} [memoryStart] Mapping memoryStart
@property {number|Long} [memoryLimit] Mapping memoryLimit
@property {number|Long} [fileOffset] Mapping fileOffset
@property {number|Long} [filename]... | [
"Properties",
"of",
"a",
"Mapping",
"."
] | 59429e72b51e655e9524c274c442824810907d0b | https://github.com/googleapis/cloud-profiler-nodejs/blob/59429e72b51e655e9524c274c442824810907d0b/proto/profile.js#L1640-L1645 |
15,313 | googleapis/cloud-profiler-nodejs | proto/profile.js | Line | function Line(properties) {
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
} | javascript | function Line(properties) {
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
} | [
"function",
"Line",
"(",
"properties",
")",
"{",
"if",
"(",
"properties",
")",
"for",
"(",
"var",
"keys",
"=",
"Object",
".",
"keys",
"(",
"properties",
")",
",",
"i",
"=",
"0",
";",
"i",
"<",
"keys",
".",
"length",
";",
"++",
"i",
")",
"if",
"... | Properties of a Line.
@memberof perftools.profiles
@interface ILine
@property {number|Long} [functionId] Line functionId
@property {number|Long} [line] Line line
Constructs a new Line.
@memberof perftools.profiles
@classdesc Represents a Line.
@constructor
@param {perftools.profiles.ILine=} [properties] Properties to... | [
"Properties",
"of",
"a",
"Line",
"."
] | 59429e72b51e655e9524c274c442824810907d0b | https://github.com/googleapis/cloud-profiler-nodejs/blob/59429e72b51e655e9524c274c442824810907d0b/proto/profile.js#L2418-L2423 |
15,314 | googleapis/cloud-profiler-nodejs | proto/profile.js | Function | function Function(properties) {
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
} | javascript | function Function(properties) {
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
} | [
"function",
"Function",
"(",
"properties",
")",
"{",
"if",
"(",
"properties",
")",
"for",
"(",
"var",
"keys",
"=",
"Object",
".",
"keys",
"(",
"properties",
")",
",",
"i",
"=",
"0",
";",
"i",
"<",
"keys",
".",
"length",
";",
"++",
"i",
")",
"if",... | Properties of a Function.
@memberof perftools.profiles
@interface IFunction
@property {number|Long} [id] Function id
@property {number|Long} [name] Function name
@property {number|Long} [systemName] Function systemName
@property {number|Long} [filename] Function filename
@property {number|Long} [startLine] Function sta... | [
"Properties",
"of",
"a",
"Function",
"."
] | 59429e72b51e655e9524c274c442824810907d0b | https://github.com/googleapis/cloud-profiler-nodejs/blob/59429e72b51e655e9524c274c442824810907d0b/proto/profile.js#L2658-L2663 |
15,315 | node-modules/agentkeepalive | lib/agent.js | onTimeout | function onTimeout() {
const listenerCount = socket.listeners('timeout').length;
debug('%s(requests: %s, finished: %s) timeout after %sms, listeners %s',
socket[SOCKET_NAME], socket[SOCKET_REQUEST_COUNT], socket[SOCKET_REQUEST_FINISHED_COUNT],
getSocketTimeout(socket), listenerCount);
agent.time... | javascript | function onTimeout() {
const listenerCount = socket.listeners('timeout').length;
debug('%s(requests: %s, finished: %s) timeout after %sms, listeners %s',
socket[SOCKET_NAME], socket[SOCKET_REQUEST_COUNT], socket[SOCKET_REQUEST_FINISHED_COUNT],
getSocketTimeout(socket), listenerCount);
agent.time... | [
"function",
"onTimeout",
"(",
")",
"{",
"const",
"listenerCount",
"=",
"socket",
".",
"listeners",
"(",
"'timeout'",
")",
".",
"length",
";",
"debug",
"(",
"'%s(requests: %s, finished: %s) timeout after %sms, listeners %s'",
",",
"socket",
"[",
"SOCKET_NAME",
"]",
"... | start socket timeout handler | [
"start",
"socket",
"timeout",
"handler"
] | 48e01a4d3e15888d396d2a45305d976f654afdb7 | https://github.com/node-modules/agentkeepalive/blob/48e01a4d3e15888d396d2a45305d976f654afdb7/lib/agent.js#L279-L314 |
15,316 | avh4/elm-format | parser/bench/src/Native/Benchmark.js | runWithProgress | function runWithProgress(maybeTaskFn, inSuite)
{
return Task.asyncFunction(function(callback) {
var bjsSuite = new Benchmark.Suite;
var benchArray;
var retData = [];
var finalString = "";
var numCompleted = 0;
... | javascript | function runWithProgress(maybeTaskFn, inSuite)
{
return Task.asyncFunction(function(callback) {
var bjsSuite = new Benchmark.Suite;
var benchArray;
var retData = [];
var finalString = "";
var numCompleted = 0;
... | [
"function",
"runWithProgress",
"(",
"maybeTaskFn",
",",
"inSuite",
")",
"{",
"return",
"Task",
".",
"asyncFunction",
"(",
"function",
"(",
"callback",
")",
"{",
"var",
"bjsSuite",
"=",
"new",
"Benchmark",
".",
"Suite",
";",
"var",
"benchArray",
";",
"var",
... | Generate the task for running a benchmark suite Possibly updating a given mailbox with a string describing Our progress of running the benchmarks so far | [
"Generate",
"the",
"task",
"for",
"running",
"a",
"benchmark",
"suite",
"Possibly",
"updating",
"a",
"given",
"mailbox",
"with",
"a",
"string",
"describing",
"Our",
"progress",
"of",
"running",
"the",
"benchmarks",
"so",
"far"
] | 68f0fc0b595ceee32bf94538154d4cf7766817f6 | https://github.com/avh4/elm-format/blob/68f0fc0b595ceee32bf94538154d4cf7766817f6/parser/bench/src/Native/Benchmark.js#L26-L94 |
15,317 | Microsoft/tsiclient | pages/windApp/windApp.js | getOverallBarChart | function getOverallBarChart(){
var contextMenuActions = [{
name: 'Explore windmill',
action: function(ae, splitBy, timestamp) {
explore(splitBy);
}
}]
var endDate = new Date(Math.floor((new Date()).valueOf()/(1000*60*60*24))*(1000*60*60*24));
var startDat... | javascript | function getOverallBarChart(){
var contextMenuActions = [{
name: 'Explore windmill',
action: function(ae, splitBy, timestamp) {
explore(splitBy);
}
}]
var endDate = new Date(Math.floor((new Date()).valueOf()/(1000*60*60*24))*(1000*60*60*24));
var startDat... | [
"function",
"getOverallBarChart",
"(",
")",
"{",
"var",
"contextMenuActions",
"=",
"[",
"{",
"name",
":",
"'Explore windmill'",
",",
"action",
":",
"function",
"(",
"ae",
",",
"splitBy",
",",
"timestamp",
")",
"{",
"explore",
"(",
"splitBy",
")",
";",
"}",... | Bar chart for overall production | [
"Bar",
"chart",
"for",
"overall",
"production"
] | a242d08fd1b0fc09bae118d71eea9530c40d47f7 | https://github.com/Microsoft/tsiclient/blob/a242d08fd1b0fc09bae118d71eea9530c40d47f7/pages/windApp/windApp.js#L59-L78 |
15,318 | Microsoft/tsiclient | pages/windApp/windApp.js | function (response) {
document.getElementById("windmillWeather").innerHTML = "<div>Current conditions</div>" + '<img class="icon" src="https://openweathermap.org/img/w/' + response.weather[0].icon + '.png' + '"><span>' + response.weather[0].main + ", Temp: " + response.main.temp + "'c, Wind: " + response.wind... | javascript | function (response) {
document.getElementById("windmillWeather").innerHTML = "<div>Current conditions</div>" + '<img class="icon" src="https://openweathermap.org/img/w/' + response.weather[0].icon + '.png' + '"><span>' + response.weather[0].main + ", Temp: " + response.main.temp + "'c, Wind: " + response.wind... | [
"function",
"(",
"response",
")",
"{",
"document",
".",
"getElementById",
"(",
"\"windmillWeather\"",
")",
".",
"innerHTML",
"=",
"\"<div>Current conditions</div>\"",
"+",
"'<img class=\"icon\" src=\"https://openweathermap.org/img/w/'",
"+",
"response",
".",
"weather",
"[",... | work with the response | [
"work",
"with",
"the",
"response"
] | a242d08fd1b0fc09bae118d71eea9530c40d47f7 | https://github.com/Microsoft/tsiclient/blob/a242d08fd1b0fc09bae118d71eea9530c40d47f7/pages/windApp/windApp.js#L196-L198 | |
15,319 | NativeScript/nativescript-dev-webpack | lib/utils.js | getUpdatedEmittedFiles | function getUpdatedEmittedFiles(emittedFiles, webpackRuntimeFiles) {
let fallbackFiles = [];
let hotHash;
if (emittedFiles.some(x => x.endsWith('.hot-update.json'))) {
let result = emittedFiles.slice();
const hotUpdateScripts = emittedFiles.filter(x => x.endsWith('.hot-update.js'));
... | javascript | function getUpdatedEmittedFiles(emittedFiles, webpackRuntimeFiles) {
let fallbackFiles = [];
let hotHash;
if (emittedFiles.some(x => x.endsWith('.hot-update.json'))) {
let result = emittedFiles.slice();
const hotUpdateScripts = emittedFiles.filter(x => x.endsWith('.hot-update.js'));
... | [
"function",
"getUpdatedEmittedFiles",
"(",
"emittedFiles",
",",
"webpackRuntimeFiles",
")",
"{",
"let",
"fallbackFiles",
"=",
"[",
"]",
";",
"let",
"hotHash",
";",
"if",
"(",
"emittedFiles",
".",
"some",
"(",
"x",
"=>",
"x",
".",
"endsWith",
"(",
"'.hot-upda... | Checks if there's a file in the following pattern 5e0326f3bb50f9f26cf0.hot-update.json
if yes this is a HMR update and remove all bundle files as we don't need them to be synced,
but only the update chunks | [
"Checks",
"if",
"there",
"s",
"a",
"file",
"in",
"the",
"following",
"pattern",
"5e0326f3bb50f9f26cf0",
".",
"hot",
"-",
"update",
".",
"json",
"if",
"yes",
"this",
"is",
"a",
"HMR",
"update",
"and",
"remove",
"all",
"bundle",
"files",
"as",
"we",
"don",... | 269308bb99e37f92ac214d45b57a0399f96c6ce7 | https://github.com/NativeScript/nativescript-dev-webpack/blob/269308bb99e37f92ac214d45b57a0399f96c6ce7/lib/utils.js#L37-L60 |
15,320 | NativeScript/nativescript-dev-webpack | lib/utils.js | parseHotUpdateChunkName | function parseHotUpdateChunkName(name) {
const matcher = /^(.+)\.(.+)\.hot-update/gm;
const matches = matcher.exec(name);
return {
name: matches[1] || "",
hash: matches[2] || "",
};
} | javascript | function parseHotUpdateChunkName(name) {
const matcher = /^(.+)\.(.+)\.hot-update/gm;
const matches = matcher.exec(name);
return {
name: matches[1] || "",
hash: matches[2] || "",
};
} | [
"function",
"parseHotUpdateChunkName",
"(",
"name",
")",
"{",
"const",
"matcher",
"=",
"/",
"^(.+)\\.(.+)\\.hot-update",
"/",
"gm",
";",
"const",
"matches",
"=",
"matcher",
".",
"exec",
"(",
"name",
")",
";",
"return",
"{",
"name",
":",
"matches",
"[",
"1"... | Parse the filename of the hot update chunk.
@param name bundle.deccb264c01d6d42416c.hot-update.js
@returns { name: string, hash: string } { name: 'bundle', hash: 'deccb264c01d6d42416c' } | [
"Parse",
"the",
"filename",
"of",
"the",
"hot",
"update",
"chunk",
"."
] | 269308bb99e37f92ac214d45b57a0399f96c6ce7 | https://github.com/NativeScript/nativescript-dev-webpack/blob/269308bb99e37f92ac214d45b57a0399f96c6ce7/lib/utils.js#L67-L74 |
15,321 | mapbox/hubdb | index.js | remove | function remove(id, callback) {
repo.contents(id).fetch({
ref: options.branch
}, function(err, info) {
if (err) return callback(err);
repo.contents(id).remove({
branch: options.branch,
sha: info.sha,
message: '-'
... | javascript | function remove(id, callback) {
repo.contents(id).fetch({
ref: options.branch
}, function(err, info) {
if (err) return callback(err);
repo.contents(id).remove({
branch: options.branch,
sha: info.sha,
message: '-'
... | [
"function",
"remove",
"(",
"id",
",",
"callback",
")",
"{",
"repo",
".",
"contents",
"(",
"id",
")",
".",
"fetch",
"(",
"{",
"ref",
":",
"options",
".",
"branch",
"}",
",",
"function",
"(",
"err",
",",
"info",
")",
"{",
"if",
"(",
"err",
")",
"... | Remove an item from the database given its id and a callback.
@param {String} id
@param {Function} callback called with (err, result, id) | [
"Remove",
"an",
"item",
"from",
"the",
"database",
"given",
"its",
"id",
"and",
"a",
"callback",
"."
] | 2cf6ff4327f3d68c3f539d86a5361f0143b3a91c | https://github.com/mapbox/hubdb/blob/2cf6ff4327f3d68c3f539d86a5361f0143b3a91c/index.js#L111-L124 |
15,322 | mapbox/hubdb | index.js | get | function get(id, callback) {
_getSHA(id, function(err, sha) {
if (err) return callback(err);
repo.git.blobs(sha).fetch(function(err, res) {
if (err) return callback(err);
callback(err, JSON.parse(atob(res.content)));
});
});
} | javascript | function get(id, callback) {
_getSHA(id, function(err, sha) {
if (err) return callback(err);
repo.git.blobs(sha).fetch(function(err, res) {
if (err) return callback(err);
callback(err, JSON.parse(atob(res.content)));
});
});
} | [
"function",
"get",
"(",
"id",
",",
"callback",
")",
"{",
"_getSHA",
"(",
"id",
",",
"function",
"(",
"err",
",",
"sha",
")",
"{",
"if",
"(",
"err",
")",
"return",
"callback",
"(",
"err",
")",
";",
"repo",
".",
"git",
".",
"blobs",
"(",
"sha",
"... | Get an item from the database given its id and a callback.
@param {String} id
@param {Function} callback called with (err, contents): contents
are given as parsed JSON | [
"Get",
"an",
"item",
"from",
"the",
"database",
"given",
"its",
"id",
"and",
"a",
"callback",
"."
] | 2cf6ff4327f3d68c3f539d86a5361f0143b3a91c | https://github.com/mapbox/hubdb/blob/2cf6ff4327f3d68c3f539d86a5361f0143b3a91c/index.js#L133-L141 |
15,323 | mapbox/hubdb | index.js | _getSHA | function _getSHA(id, callback) {
repo.contents("").fetch({
ref: options.branch
}, function(err, res) {
if (err) return callback(err);
var sha = res.reduce(function(previousValue, item) {
return item.name === id ? item.sha : previousValue;
}... | javascript | function _getSHA(id, callback) {
repo.contents("").fetch({
ref: options.branch
}, function(err, res) {
if (err) return callback(err);
var sha = res.reduce(function(previousValue, item) {
return item.name === id ? item.sha : previousValue;
}... | [
"function",
"_getSHA",
"(",
"id",
",",
"callback",
")",
"{",
"repo",
".",
"contents",
"(",
"\"\"",
")",
".",
"fetch",
"(",
"{",
"ref",
":",
"options",
".",
"branch",
"}",
",",
"function",
"(",
"err",
",",
"res",
")",
"{",
"if",
"(",
"err",
")",
... | get the SHA corresponding to id at the HEAD of options.branch
@access private
@param {String} id
@param {Function} callback called with (err, result) | [
"get",
"the",
"SHA",
"corresponding",
"to",
"id",
"at",
"the",
"HEAD",
"of",
"options",
".",
"branch"
] | 2cf6ff4327f3d68c3f539d86a5361f0143b3a91c | https://github.com/mapbox/hubdb/blob/2cf6ff4327f3d68c3f539d86a5361f0143b3a91c/index.js#L173-L183 |
15,324 | confluentinc/kafka-rest-node | examples/console_producer.js | processInput | function processInput(buffer, cb) {
if (buffer.length == 0) return buffer;
var split_char = '\n';
var lines = buffer.split(split_char);
// If there are any line splits, the below logic always works, but if there are none we need to detect this and skip
// any processing.
if (lines[0].length == b... | javascript | function processInput(buffer, cb) {
if (buffer.length == 0) return buffer;
var split_char = '\n';
var lines = buffer.split(split_char);
// If there are any line splits, the below logic always works, but if there are none we need to detect this and skip
// any processing.
if (lines[0].length == b... | [
"function",
"processInput",
"(",
"buffer",
",",
"cb",
")",
"{",
"if",
"(",
"buffer",
".",
"length",
"==",
"0",
")",
"return",
"buffer",
";",
"var",
"split_char",
"=",
"'\\n'",
";",
"var",
"lines",
"=",
"buffer",
".",
"split",
"(",
"split_char",
")",
... | Splits input by lines into individual messages and passes them to the producer. Tracks stats to print at exit. | [
"Splits",
"input",
"by",
"lines",
"into",
"individual",
"messages",
"and",
"passes",
"them",
"to",
"the",
"producer",
".",
"Tracks",
"stats",
"to",
"print",
"at",
"exit",
"."
] | 2169a8888e93e0d6565fbae037f95aefb64aaedd | https://github.com/confluentinc/kafka-rest-node/blob/2169a8888e93e0d6565fbae037f95aefb64aaedd/examples/console_producer.js#L98-L127 |
15,325 | confluentinc/kafka-rest-node | examples/console_producer.js | handleProduceResponse | function handleProduceResponse(cb, err, res) {
num_responses += 1;
if (err) {
console.log("Error producing message: " + err);
} else {
num_messages_acked += 1;
}
// We can only indicate were done if stdin was closed and we have no outstanding messages.
checkSendingComplete(cb);
... | javascript | function handleProduceResponse(cb, err, res) {
num_responses += 1;
if (err) {
console.log("Error producing message: " + err);
} else {
num_messages_acked += 1;
}
// We can only indicate were done if stdin was closed and we have no outstanding messages.
checkSendingComplete(cb);
... | [
"function",
"handleProduceResponse",
"(",
"cb",
",",
"err",
",",
"res",
")",
"{",
"num_responses",
"+=",
"1",
";",
"if",
"(",
"err",
")",
"{",
"console",
".",
"log",
"(",
"\"Error producing message: \"",
"+",
"err",
")",
";",
"}",
"else",
"{",
"num_messa... | Handles produce responses | [
"Handles",
"produce",
"responses"
] | 2169a8888e93e0d6565fbae037f95aefb64aaedd | https://github.com/confluentinc/kafka-rest-node/blob/2169a8888e93e0d6565fbae037f95aefb64aaedd/examples/console_producer.js#L132-L142 |
15,326 | ecomfe/veui | packages/veui-loader/src/index.js | getParts | function getParts (component, options) {
let {
modules = [],
package: pack,
path: packPath = COMPONENTS_DIRNAME,
transform,
fileName,
locale,
global = []
} = options
if (pack && fileName) {
modules.push({ package: pack, path: packPath, transform, fileName })
}
if (locale !== ... | javascript | function getParts (component, options) {
let {
modules = [],
package: pack,
path: packPath = COMPONENTS_DIRNAME,
transform,
fileName,
locale,
global = []
} = options
if (pack && fileName) {
modules.push({ package: pack, path: packPath, transform, fileName })
}
if (locale !== ... | [
"function",
"getParts",
"(",
"component",
",",
"options",
")",
"{",
"let",
"{",
"modules",
"=",
"[",
"]",
",",
"package",
":",
"pack",
",",
"path",
":",
"packPath",
"=",
"COMPONENTS_DIRNAME",
",",
"transform",
",",
"fileName",
",",
"locale",
",",
"global... | Extract potentially dependent parts for a component
@param {string} component Component name
@param {Object} options veui-loader options
@returns {Object} Extracted parts metadata | [
"Extract",
"potentially",
"dependent",
"parts",
"for",
"a",
"component"
] | e3a47275cd2b631455f1fa1c25bc92e4588cf284 | https://github.com/ecomfe/veui/blob/e3a47275cd2b631455f1fa1c25bc92e4588cf284/packages/veui-loader/src/index.js#L125-L190 |
15,327 | ecomfe/veui | packages/veui-loader/src/index.js | patchContent | function patchContent (content, parts) {
return Object.keys(parts).reduce((content, type) => {
let paths = parts[type].filter(({ valid }) => valid).map(({ path }) => path)
return patchType(content, type, paths)
}, content)
} | javascript | function patchContent (content, parts) {
return Object.keys(parts).reduce((content, type) => {
let paths = parts[type].filter(({ valid }) => valid).map(({ path }) => path)
return patchType(content, type, paths)
}, content)
} | [
"function",
"patchContent",
"(",
"content",
",",
"parts",
")",
"{",
"return",
"Object",
".",
"keys",
"(",
"parts",
")",
".",
"reduce",
"(",
"(",
"content",
",",
"type",
")",
"=>",
"{",
"let",
"paths",
"=",
"parts",
"[",
"type",
"]",
".",
"filter",
... | Patch content with extracted parts metadata
@param {string} content Module content
@param {Object} parts Extracted parts metadata | [
"Patch",
"content",
"with",
"extracted",
"parts",
"metadata"
] | e3a47275cd2b631455f1fa1c25bc92e4588cf284 | https://github.com/ecomfe/veui/blob/e3a47275cd2b631455f1fa1c25bc92e4588cf284/packages/veui-loader/src/index.js#L198-L203 |
15,328 | ecomfe/veui | packages/veui-loader/src/index.js | pushPart | function pushPart (parts, file) {
let ext = getExtname(file.path)
let type = Object.keys(EXT_TYPES).find(key => {
return EXT_TYPES[key].includes(ext)
})
parts[type.toLowerCase()].push(file)
} | javascript | function pushPart (parts, file) {
let ext = getExtname(file.path)
let type = Object.keys(EXT_TYPES).find(key => {
return EXT_TYPES[key].includes(ext)
})
parts[type.toLowerCase()].push(file)
} | [
"function",
"pushPart",
"(",
"parts",
",",
"file",
")",
"{",
"let",
"ext",
"=",
"getExtname",
"(",
"file",
".",
"path",
")",
"let",
"type",
"=",
"Object",
".",
"keys",
"(",
"EXT_TYPES",
")",
".",
"find",
"(",
"key",
"=>",
"{",
"return",
"EXT_TYPES",
... | Push peer file dependency into collected parts.
@param {Object} parts Collected parts containing scripts and styles
@param {Object} file The file to be appended | [
"Push",
"peer",
"file",
"dependency",
"into",
"collected",
"parts",
"."
] | e3a47275cd2b631455f1fa1c25bc92e4588cf284 | https://github.com/ecomfe/veui/blob/e3a47275cd2b631455f1fa1c25bc92e4588cf284/packages/veui-loader/src/index.js#L210-L216 |
15,329 | ecomfe/veui | packages/veui-loader/src/index.js | patchType | function patchType (content, type, peerPaths) {
let normalizedPaths = peerPaths.map(path => slash(normalize(path)))
switch (type) {
case 'script':
let scriptImports = normalizedPaths.map(path => `import '${path}'\n`)
content = content.replace(RE_SCRIPT, match => {
return `${match}\n${scriptI... | javascript | function patchType (content, type, peerPaths) {
let normalizedPaths = peerPaths.map(path => slash(normalize(path)))
switch (type) {
case 'script':
let scriptImports = normalizedPaths.map(path => `import '${path}'\n`)
content = content.replace(RE_SCRIPT, match => {
return `${match}\n${scriptI... | [
"function",
"patchType",
"(",
"content",
",",
"type",
",",
"peerPaths",
")",
"{",
"let",
"normalizedPaths",
"=",
"peerPaths",
".",
"map",
"(",
"path",
"=>",
"slash",
"(",
"normalize",
"(",
"path",
")",
")",
")",
"switch",
"(",
"type",
")",
"{",
"case",... | Patch file content according to a given type.
@param {string} content Original content
@param {string} type Peer type, can be `script` or `style`
@param {Array<string>} peerPaths Peer module paths
@returns {string} The patched content | [
"Patch",
"file",
"content",
"according",
"to",
"a",
"given",
"type",
"."
] | e3a47275cd2b631455f1fa1c25bc92e4588cf284 | https://github.com/ecomfe/veui/blob/e3a47275cd2b631455f1fa1c25bc92e4588cf284/packages/veui-loader/src/index.js#L239-L264 |
15,330 | ecomfe/veui | packages/veui-loader/src/index.js | assurePath | async function assurePath (modulePath, resolve) {
if (resolveCache[modulePath] === false) {
return false
} else if (!(modulePath in resolveCache)) {
if (typeof resolve === 'function') {
try {
resolveCache[modulePath] = !!(await resolve(modulePath))
} catch (e) {
resolveCache[modu... | javascript | async function assurePath (modulePath, resolve) {
if (resolveCache[modulePath] === false) {
return false
} else if (!(modulePath in resolveCache)) {
if (typeof resolve === 'function') {
try {
resolveCache[modulePath] = !!(await resolve(modulePath))
} catch (e) {
resolveCache[modu... | [
"async",
"function",
"assurePath",
"(",
"modulePath",
",",
"resolve",
")",
"{",
"if",
"(",
"resolveCache",
"[",
"modulePath",
"]",
"===",
"false",
")",
"{",
"return",
"false",
"}",
"else",
"if",
"(",
"!",
"(",
"modulePath",
"in",
"resolveCache",
")",
")"... | To test the target peer path exists or not.
@param {string} modulePath Peer module path
@param {function} resolve webpack module resolver
@returns {Promise<boolean>} A promise resolved with true if the target peer path exists | [
"To",
"test",
"the",
"target",
"peer",
"path",
"exists",
"or",
"not",
"."
] | e3a47275cd2b631455f1fa1c25bc92e4588cf284 | https://github.com/ecomfe/veui/blob/e3a47275cd2b631455f1fa1c25bc92e4588cf284/packages/veui-loader/src/index.js#L272-L286 |
15,331 | ecomfe/veui | packages/veui-loader/src/index.js | assurePathSync | function assurePathSync (modulePath, resolveSync) {
if (resolveCache[modulePath] === false) {
return false
} else if (!(modulePath in resolveCache)) {
if (typeof resolveSync === 'function') {
try {
resolveCache[modulePath] = !!resolveSync(modulePath)
} catch (e) {
resolveCache[mo... | javascript | function assurePathSync (modulePath, resolveSync) {
if (resolveCache[modulePath] === false) {
return false
} else if (!(modulePath in resolveCache)) {
if (typeof resolveSync === 'function') {
try {
resolveCache[modulePath] = !!resolveSync(modulePath)
} catch (e) {
resolveCache[mo... | [
"function",
"assurePathSync",
"(",
"modulePath",
",",
"resolveSync",
")",
"{",
"if",
"(",
"resolveCache",
"[",
"modulePath",
"]",
"===",
"false",
")",
"{",
"return",
"false",
"}",
"else",
"if",
"(",
"!",
"(",
"modulePath",
"in",
"resolveCache",
")",
")",
... | To test the target peer path exists or not synchronously.
@param {string} modulePath Peer module path
@param {function} resolveSync webpack module resolver
@returns {boolean} True if the target peer path exists | [
"To",
"test",
"the",
"target",
"peer",
"path",
"exists",
"or",
"not",
"synchronously",
"."
] | e3a47275cd2b631455f1fa1c25bc92e4588cf284 | https://github.com/ecomfe/veui/blob/e3a47275cd2b631455f1fa1c25bc92e4588cf284/packages/veui-loader/src/index.js#L294-L308 |
15,332 | ecomfe/veui | packages/veui-loader/src/index.js | getPeerFilename | function getPeerFilename (
name,
{ transform = 'kebab-case', template = '{module}.css' }
) {
if (!name) {
return null
}
switch (transform) {
case 'kebab-case':
name = kebabCase(name)
break
case 'camelCase':
name = camelCase(name)
break
case 'PascalCase':
name = p... | javascript | function getPeerFilename (
name,
{ transform = 'kebab-case', template = '{module}.css' }
) {
if (!name) {
return null
}
switch (transform) {
case 'kebab-case':
name = kebabCase(name)
break
case 'camelCase':
name = camelCase(name)
break
case 'PascalCase':
name = p... | [
"function",
"getPeerFilename",
"(",
"name",
",",
"{",
"transform",
"=",
"'kebab-case'",
",",
"template",
"=",
"'{module}.css'",
"}",
")",
"{",
"if",
"(",
"!",
"name",
")",
"{",
"return",
"null",
"}",
"switch",
"(",
"transform",
")",
"{",
"case",
"'kebab-... | Convert a component name according to file name template.
@param {string} name Peer module file
@param {Object} options Transform options
@param {string} options.transform Transform type for base name
@param {string} options.template File name template
@returns {string} Peer module file name | [
"Convert",
"a",
"component",
"name",
"according",
"to",
"file",
"name",
"template",
"."
] | e3a47275cd2b631455f1fa1c25bc92e4588cf284 | https://github.com/ecomfe/veui/blob/e3a47275cd2b631455f1fa1c25bc92e4588cf284/packages/veui-loader/src/index.js#L318-L342 |
15,333 | ubilabs/geocomplete | jquery.geocomplete.js | GeoComplete | function GeoComplete(input, options) {
this.options = $.extend(true, {}, defaults, options);
// This is a fix to allow types:[] not to be overridden by defaults
// so search results includes everything
if (options && options.types) {
this.options.types = options.types;
}
this.input = in... | javascript | function GeoComplete(input, options) {
this.options = $.extend(true, {}, defaults, options);
// This is a fix to allow types:[] not to be overridden by defaults
// so search results includes everything
if (options && options.types) {
this.options.types = options.types;
}
this.input = in... | [
"function",
"GeoComplete",
"(",
"input",
",",
"options",
")",
"{",
"this",
".",
"options",
"=",
"$",
".",
"extend",
"(",
"true",
",",
"{",
"}",
",",
"defaults",
",",
"options",
")",
";",
"// This is a fix to allow types:[] not to be overridden by defaults",
"// ... | The actual plugin constructor. | [
"The",
"actual",
"plugin",
"constructor",
"."
] | 7ce2f83ac4b621b6816f85eaede8f03595e58c9a | https://github.com/ubilabs/geocomplete/blob/7ce2f83ac4b621b6816f85eaede8f03595e58c9a/jquery.geocomplete.js#L84-L101 |
15,334 | ubilabs/geocomplete | jquery.geocomplete.js | function(){
if (!this.options.map){ return; }
if (typeof this.options.map.setCenter == "function"){
this.map = this.options.map;
return;
}
this.map = new google.maps.Map(
$(this.options.map)[0],
this.options.mapOptions
);
// add click event listener... | javascript | function(){
if (!this.options.map){ return; }
if (typeof this.options.map.setCenter == "function"){
this.map = this.options.map;
return;
}
this.map = new google.maps.Map(
$(this.options.map)[0],
this.options.mapOptions
);
// add click event listener... | [
"function",
"(",
")",
"{",
"if",
"(",
"!",
"this",
".",
"options",
".",
"map",
")",
"{",
"return",
";",
"}",
"if",
"(",
"typeof",
"this",
".",
"options",
".",
"map",
".",
"setCenter",
"==",
"\"function\"",
")",
"{",
"this",
".",
"map",
"=",
"this... | Initialize the map but only if the option `map` was set. This will create a `map` within the given container using the provided `mapOptions` or link to the existing map instance. | [
"Initialize",
"the",
"map",
"but",
"only",
"if",
"the",
"option",
"map",
"was",
"set",
".",
"This",
"will",
"create",
"a",
"map",
"within",
"the",
"given",
"container",
"using",
"the",
"provided",
"mapOptions",
"or",
"link",
"to",
"the",
"existing",
"map",... | 7ce2f83ac4b621b6816f85eaede8f03595e58c9a | https://github.com/ubilabs/geocomplete/blob/7ce2f83ac4b621b6816f85eaede8f03595e58c9a/jquery.geocomplete.js#L116-L155 | |
15,335 | ubilabs/geocomplete | jquery.geocomplete.js | function(){
if (!this.map){ return; }
var options = $.extend(this.options.markerOptions, { map: this.map });
if (options.disabled){ return; }
this.marker = new google.maps.Marker(options);
google.maps.event.addListener(
this.marker,
'dragend',
$.proxy(this.marker... | javascript | function(){
if (!this.map){ return; }
var options = $.extend(this.options.markerOptions, { map: this.map });
if (options.disabled){ return; }
this.marker = new google.maps.Marker(options);
google.maps.event.addListener(
this.marker,
'dragend',
$.proxy(this.marker... | [
"function",
"(",
")",
"{",
"if",
"(",
"!",
"this",
".",
"map",
")",
"{",
"return",
";",
"}",
"var",
"options",
"=",
"$",
".",
"extend",
"(",
"this",
".",
"options",
".",
"markerOptions",
",",
"{",
"map",
":",
"this",
".",
"map",
"}",
")",
";",
... | Add a marker with the provided `markerOptions` but only if the option was set. Additionally it listens for the `dragend` event to notify the plugin about changes. | [
"Add",
"a",
"marker",
"with",
"the",
"provided",
"markerOptions",
"but",
"only",
"if",
"the",
"option",
"was",
"set",
".",
"Additionally",
"it",
"listens",
"for",
"the",
"dragend",
"event",
"to",
"notify",
"the",
"plugin",
"about",
"changes",
"."
] | 7ce2f83ac4b621b6816f85eaede8f03595e58c9a | https://github.com/ubilabs/geocomplete/blob/7ce2f83ac4b621b6816f85eaede8f03595e58c9a/jquery.geocomplete.js#L160-L173 | |
15,336 | ubilabs/geocomplete | jquery.geocomplete.js | function(){
// Indicates is user did select a result from the dropdown.
var selected = false;
var options = {
types: this.options.types,
bounds: this.options.bounds === true ? null : this.options.bounds,
componentRestrictions: this.options.componentRestrictions,
stric... | javascript | function(){
// Indicates is user did select a result from the dropdown.
var selected = false;
var options = {
types: this.options.types,
bounds: this.options.bounds === true ? null : this.options.bounds,
componentRestrictions: this.options.componentRestrictions,
stric... | [
"function",
"(",
")",
"{",
"// Indicates is user did select a result from the dropdown.",
"var",
"selected",
"=",
"false",
";",
"var",
"options",
"=",
"{",
"types",
":",
"this",
".",
"options",
".",
"types",
",",
"bounds",
":",
"this",
".",
"options",
".",
"bo... | Associate the input with the autocompleter and create a geocoder to fall back when the autocompleter does not return a value. | [
"Associate",
"the",
"input",
"with",
"the",
"autocompleter",
"and",
"create",
"a",
"geocoder",
"to",
"fall",
"back",
"when",
"the",
"autocompleter",
"does",
"not",
"return",
"a",
"value",
"."
] | 7ce2f83ac4b621b6816f85eaede8f03595e58c9a | https://github.com/ubilabs/geocomplete/blob/7ce2f83ac4b621b6816f85eaede8f03595e58c9a/jquery.geocomplete.js#L177-L252 | |
15,337 | ubilabs/geocomplete | jquery.geocomplete.js | function(){
if (!this.options.details){ return; }
if(this.options.detailsScope) {
var $details = $(this.input).parents(this.options.detailsScope).find(this.options.details);
} else {
var $details = $(this.options.details);
}
var attribute = this.options.detailsAttribute,
... | javascript | function(){
if (!this.options.details){ return; }
if(this.options.detailsScope) {
var $details = $(this.input).parents(this.options.detailsScope).find(this.options.details);
} else {
var $details = $(this.options.details);
}
var attribute = this.options.detailsAttribute,
... | [
"function",
"(",
")",
"{",
"if",
"(",
"!",
"this",
".",
"options",
".",
"details",
")",
"{",
"return",
";",
"}",
"if",
"(",
"this",
".",
"options",
".",
"detailsScope",
")",
"{",
"var",
"$details",
"=",
"$",
"(",
"this",
".",
"input",
")",
".",
... | Prepare a given DOM structure to be populated when we got some data. This will cycle through the list of component types and map the corresponding elements. | [
"Prepare",
"a",
"given",
"DOM",
"structure",
"to",
"be",
"populated",
"when",
"we",
"got",
"some",
"data",
".",
"This",
"will",
"cycle",
"through",
"the",
"list",
"of",
"component",
"types",
"and",
"map",
"the",
"corresponding",
"elements",
"."
] | 7ce2f83ac4b621b6816f85eaede8f03595e58c9a | https://github.com/ubilabs/geocomplete/blob/7ce2f83ac4b621b6816f85eaede8f03595e58c9a/jquery.geocomplete.js#L257-L284 | |
15,338 | ubilabs/geocomplete | jquery.geocomplete.js | function() {
var location = this.options.location, latLng;
if (!location) { return; }
if (typeof location == 'string') {
this.find(location);
return;
}
if (location instanceof Array) {
latLng = new google.maps.LatLng(location[0], location[1]);
}
if ... | javascript | function() {
var location = this.options.location, latLng;
if (!location) { return; }
if (typeof location == 'string') {
this.find(location);
return;
}
if (location instanceof Array) {
latLng = new google.maps.LatLng(location[0], location[1]);
}
if ... | [
"function",
"(",
")",
"{",
"var",
"location",
"=",
"this",
".",
"options",
".",
"location",
",",
"latLng",
";",
"if",
"(",
"!",
"location",
")",
"{",
"return",
";",
"}",
"if",
"(",
"typeof",
"location",
"==",
"'string'",
")",
"{",
"this",
".",
"fin... | Set the initial location of the plugin if the `location` options was set. This method will care about converting the value into the right format. | [
"Set",
"the",
"initial",
"location",
"of",
"the",
"plugin",
"if",
"the",
"location",
"options",
"was",
"set",
".",
"This",
"method",
"will",
"care",
"about",
"converting",
"the",
"value",
"into",
"the",
"right",
"format",
"."
] | 7ce2f83ac4b621b6816f85eaede8f03595e58c9a | https://github.com/ubilabs/geocomplete/blob/7ce2f83ac4b621b6816f85eaede8f03595e58c9a/jquery.geocomplete.js#L288-L311 | |
15,339 | ubilabs/geocomplete | jquery.geocomplete.js | function(request){
// Don't geocode if the requested address is empty
if (!request.address) {
return;
}
if (this.options.bounds && !request.bounds){
if (this.options.bounds === true){
request.bounds = this.map && this.map.getBounds();
} else {
request.... | javascript | function(request){
// Don't geocode if the requested address is empty
if (!request.address) {
return;
}
if (this.options.bounds && !request.bounds){
if (this.options.bounds === true){
request.bounds = this.map && this.map.getBounds();
} else {
request.... | [
"function",
"(",
"request",
")",
"{",
"// Don't geocode if the requested address is empty",
"if",
"(",
"!",
"request",
".",
"address",
")",
"{",
"return",
";",
"}",
"if",
"(",
"this",
".",
"options",
".",
"bounds",
"&&",
"!",
"request",
".",
"bounds",
")",
... | Requests details about a given location. Additionally it will bias the requests to the provided bounds. | [
"Requests",
"details",
"about",
"a",
"given",
"location",
".",
"Additionally",
"it",
"will",
"bias",
"the",
"requests",
"to",
"the",
"provided",
"bounds",
"."
] | 7ce2f83ac4b621b6816f85eaede8f03595e58c9a | https://github.com/ubilabs/geocomplete/blob/7ce2f83ac4b621b6816f85eaede8f03595e58c9a/jquery.geocomplete.js#L337-L355 | |
15,340 | ubilabs/geocomplete | jquery.geocomplete.js | function() {
//$(".pac-container").hide();
var selected = '';
// Check if any result is selected.
if ($(".pac-item-selected")[0]) {
selected = '-selected';
}
// Get the first suggestion's text.
var $span1 = $(".pac-container:visible .pac-item" + selected + ":first spa... | javascript | function() {
//$(".pac-container").hide();
var selected = '';
// Check if any result is selected.
if ($(".pac-item-selected")[0]) {
selected = '-selected';
}
// Get the first suggestion's text.
var $span1 = $(".pac-container:visible .pac-item" + selected + ":first spa... | [
"function",
"(",
")",
"{",
"//$(\".pac-container\").hide();",
"var",
"selected",
"=",
"''",
";",
"// Check if any result is selected.",
"if",
"(",
"$",
"(",
"\".pac-item-selected\"",
")",
"[",
"0",
"]",
")",
"{",
"selected",
"=",
"'-selected'",
";",
"}",
"// Get... | Get the selected result. If no result is selected on the list, then get the first result from the list. | [
"Get",
"the",
"selected",
"result",
".",
"If",
"no",
"result",
"is",
"selected",
"on",
"the",
"list",
"then",
"get",
"the",
"first",
"result",
"from",
"the",
"list",
"."
] | 7ce2f83ac4b621b6816f85eaede8f03595e58c9a | https://github.com/ubilabs/geocomplete/blob/7ce2f83ac4b621b6816f85eaede8f03595e58c9a/jquery.geocomplete.js#L359-L381 | |
15,341 | ubilabs/geocomplete | jquery.geocomplete.js | function(geometry){
if (geometry.viewport){
this.map.fitBounds(geometry.viewport);
if (this.map.getZoom() > this.options.maxZoom){
this.map.setZoom(this.options.maxZoom);
}
} else {
this.map.setZoom(this.options.maxZoom);
this.map.setCenter(geometry.location... | javascript | function(geometry){
if (geometry.viewport){
this.map.fitBounds(geometry.viewport);
if (this.map.getZoom() > this.options.maxZoom){
this.map.setZoom(this.options.maxZoom);
}
} else {
this.map.setZoom(this.options.maxZoom);
this.map.setCenter(geometry.location... | [
"function",
"(",
"geometry",
")",
"{",
"if",
"(",
"geometry",
".",
"viewport",
")",
"{",
"this",
".",
"map",
".",
"fitBounds",
"(",
"geometry",
".",
"viewport",
")",
";",
"if",
"(",
"this",
".",
"map",
".",
"getZoom",
"(",
")",
">",
"this",
".",
... | Set the map to a new center by passing a `geometry`. If the geometry has a viewport, the map zooms out to fit the bounds. Additionally it updates the marker position. | [
"Set",
"the",
"map",
"to",
"a",
"new",
"center",
"by",
"passing",
"a",
"geometry",
".",
"If",
"the",
"geometry",
"has",
"a",
"viewport",
"the",
"map",
"zooms",
"out",
"to",
"fit",
"the",
"bounds",
".",
"Additionally",
"it",
"updates",
"the",
"marker",
... | 7ce2f83ac4b621b6816f85eaede8f03595e58c9a | https://github.com/ubilabs/geocomplete/blob/7ce2f83ac4b621b6816f85eaede8f03595e58c9a/jquery.geocomplete.js#L414-L429 | |
15,342 | ubilabs/geocomplete | jquery.geocomplete.js | function(result){
var data = {},
geometry = result.geometry,
viewport = geometry.viewport,
bounds = geometry.bounds;
// Create a simplified version of the address components.
$.each(result.address_components, function(index, object){
var name = object.types[0];
... | javascript | function(result){
var data = {},
geometry = result.geometry,
viewport = geometry.viewport,
bounds = geometry.bounds;
// Create a simplified version of the address components.
$.each(result.address_components, function(index, object){
var name = object.types[0];
... | [
"function",
"(",
"result",
")",
"{",
"var",
"data",
"=",
"{",
"}",
",",
"geometry",
"=",
"result",
".",
"geometry",
",",
"viewport",
"=",
"geometry",
".",
"viewport",
",",
"bounds",
"=",
"geometry",
".",
"bounds",
";",
"// Create a simplified version of the ... | Populate the provided elements with new `result` data. This will lookup all elements that has an attribute with the given component type. | [
"Populate",
"the",
"provided",
"elements",
"with",
"new",
"result",
"data",
".",
"This",
"will",
"lookup",
"all",
"elements",
"that",
"has",
"an",
"attribute",
"with",
"the",
"given",
"component",
"type",
"."
] | 7ce2f83ac4b621b6816f85eaede8f03595e58c9a | https://github.com/ubilabs/geocomplete/blob/7ce2f83ac4b621b6816f85eaede8f03595e58c9a/jquery.geocomplete.js#L449-L489 | |
15,343 | ubilabs/geocomplete | jquery.geocomplete.js | function(){
this.marker.setPosition(this.data.location);
this.setDetail(this.details.lat, this.data.location.lat());
this.setDetail(this.details.lng, this.data.location.lng());
} | javascript | function(){
this.marker.setPosition(this.data.location);
this.setDetail(this.details.lat, this.data.location.lat());
this.setDetail(this.details.lng, this.data.location.lng());
} | [
"function",
"(",
")",
"{",
"this",
".",
"marker",
".",
"setPosition",
"(",
"this",
".",
"data",
".",
"location",
")",
";",
"this",
".",
"setDetail",
"(",
"this",
".",
"details",
".",
"lat",
",",
"this",
".",
"data",
".",
"location",
".",
"lat",
"("... | Restore the old position of the marker to the last knwon location. | [
"Restore",
"the",
"old",
"position",
"of",
"the",
"marker",
"to",
"the",
"last",
"knwon",
"location",
"."
] | 7ce2f83ac4b621b6816f85eaede8f03595e58c9a | https://github.com/ubilabs/geocomplete/blob/7ce2f83ac4b621b6816f85eaede8f03595e58c9a/jquery.geocomplete.js#L533-L537 | |
15,344 | ubilabs/geocomplete | jquery.geocomplete.js | function(){
var place = this.autocomplete.getPlace();
this.selected = true;
if (!place.geometry){
if (this.options.autoselect) {
// Automatically selects the highlighted item or the first item from the
// suggestions list.
var autoSelection = this.selectFirstResu... | javascript | function(){
var place = this.autocomplete.getPlace();
this.selected = true;
if (!place.geometry){
if (this.options.autoselect) {
// Automatically selects the highlighted item or the first item from the
// suggestions list.
var autoSelection = this.selectFirstResu... | [
"function",
"(",
")",
"{",
"var",
"place",
"=",
"this",
".",
"autocomplete",
".",
"getPlace",
"(",
")",
";",
"this",
".",
"selected",
"=",
"true",
";",
"if",
"(",
"!",
"place",
".",
"geometry",
")",
"{",
"if",
"(",
"this",
".",
"options",
".",
"a... | Update the plugin after the user has selected an autocomplete entry. If the place has no geometry it passes it to the geocoder. | [
"Update",
"the",
"plugin",
"after",
"the",
"user",
"has",
"selected",
"an",
"autocomplete",
"entry",
".",
"If",
"the",
"place",
"has",
"no",
"geometry",
"it",
"passes",
"it",
"to",
"the",
"geocoder",
"."
] | 7ce2f83ac4b621b6816f85eaede8f03595e58c9a | https://github.com/ubilabs/geocomplete/blob/7ce2f83ac4b621b6816f85eaede8f03595e58c9a/jquery.geocomplete.js#L541-L556 | |
15,345 | assemble/assemble | support/docs/src/assets/js/docs.js | function(req, res) {
if (!searchIdx) return res();
var results = searchIdx.search(req.term)
.map(function(result) {
return {
label: files[result.ref].title,
value: files[result.ref]
};
});
res(results);
} | javascript | function(req, res) {
if (!searchIdx) return res();
var results = searchIdx.search(req.term)
.map(function(result) {
return {
label: files[result.ref].title,
value: files[result.ref]
};
});
res(results);
} | [
"function",
"(",
"req",
",",
"res",
")",
"{",
"if",
"(",
"!",
"searchIdx",
")",
"return",
"res",
"(",
")",
";",
"var",
"results",
"=",
"searchIdx",
".",
"search",
"(",
"req",
".",
"term",
")",
".",
"map",
"(",
"function",
"(",
"result",
")",
"{",... | use lunr search index to find a page based on specified search term | [
"use",
"lunr",
"search",
"index",
"to",
"find",
"a",
"page",
"based",
"on",
"specified",
"search",
"term"
] | b5053ee061151e3850580606df525766b4b97357 | https://github.com/assemble/assemble/blob/b5053ee061151e3850580606df525766b4b97357/support/docs/src/assets/js/docs.js#L85-L96 | |
15,346 | assemble/assemble | support/docs/src/assets/js/docs.js | function(event, ui) {
search.val('');
window.location = ui.item.value.url.replace('_gh_pages', '');
return false;
} | javascript | function(event, ui) {
search.val('');
window.location = ui.item.value.url.replace('_gh_pages', '');
return false;
} | [
"function",
"(",
"event",
",",
"ui",
")",
"{",
"search",
".",
"val",
"(",
"''",
")",
";",
"window",
".",
"location",
"=",
"ui",
".",
"item",
".",
"value",
".",
"url",
".",
"replace",
"(",
"'_gh_pages'",
",",
"''",
")",
";",
"return",
"false",
";"... | when selected, clear the sarch box and navigate to the selected page | [
"when",
"selected",
"clear",
"the",
"sarch",
"box",
"and",
"navigate",
"to",
"the",
"selected",
"page"
] | b5053ee061151e3850580606df525766b4b97357 | https://github.com/assemble/assemble/blob/b5053ee061151e3850580606df525766b4b97357/support/docs/src/assets/js/docs.js#L104-L108 | |
15,347 | assemble/assemble | examples/drafts-plugin/index.js | plugin | function plugin(name) {
return function(app) {
var files = app.getViews(name);
for (var file in files) {
if (files[file].data.draft) delete files[file];
}
};
} | javascript | function plugin(name) {
return function(app) {
var files = app.getViews(name);
for (var file in files) {
if (files[file].data.draft) delete files[file];
}
};
} | [
"function",
"plugin",
"(",
"name",
")",
"{",
"return",
"function",
"(",
"app",
")",
"{",
"var",
"files",
"=",
"app",
".",
"getViews",
"(",
"name",
")",
";",
"for",
"(",
"var",
"file",
"in",
"files",
")",
"{",
"if",
"(",
"files",
"[",
"file",
"]",... | Assemble plugin to remove files marked as `draft` from a collection.
@return {Function} | [
"Assemble",
"plugin",
"to",
"remove",
"files",
"marked",
"as",
"draft",
"from",
"a",
"collection",
"."
] | b5053ee061151e3850580606df525766b4b97357 | https://github.com/assemble/assemble/blob/b5053ee061151e3850580606df525766b4b97357/examples/drafts-plugin/index.js#L14-L21 |
15,348 | assemble/assemble | bin/cli.js | handleError | function handleError(err) {
if (typeof err === 'string' && errors[err]) {
console.error(errors[err]);
} else {
if (argv.verbose) {
console.error(err.stack);
} else {
console.error(err.message);
}
}
process.exit(1);
} | javascript | function handleError(err) {
if (typeof err === 'string' && errors[err]) {
console.error(errors[err]);
} else {
if (argv.verbose) {
console.error(err.stack);
} else {
console.error(err.message);
}
}
process.exit(1);
} | [
"function",
"handleError",
"(",
"err",
")",
"{",
"if",
"(",
"typeof",
"err",
"===",
"'string'",
"&&",
"errors",
"[",
"err",
"]",
")",
"{",
"console",
".",
"error",
"(",
"errors",
"[",
"err",
"]",
")",
";",
"}",
"else",
"{",
"if",
"(",
"argv",
"."... | Handle CLI errors | [
"Handle",
"CLI",
"errors"
] | b5053ee061151e3850580606df525766b4b97357 | https://github.com/assemble/assemble/blob/b5053ee061151e3850580606df525766b4b97357/bin/cli.js#L160-L171 |
15,349 | assemble/assemble | examples/build-tool/build.js | concat | function concat(app) {
var files = app.views.files;
var css = '';
for (var file in files) {
if ('.css' != path.extname(file)) continue;
css += files[file].contents.toString();
delete files[file];
}
css = myth(css);
app.files.addView('index.css', {
contents: new Buffer(css)
});
} | javascript | function concat(app) {
var files = app.views.files;
var css = '';
for (var file in files) {
if ('.css' != path.extname(file)) continue;
css += files[file].contents.toString();
delete files[file];
}
css = myth(css);
app.files.addView('index.css', {
contents: new Buffer(css)
});
} | [
"function",
"concat",
"(",
"app",
")",
"{",
"var",
"files",
"=",
"app",
".",
"views",
".",
"files",
";",
"var",
"css",
"=",
"''",
";",
"for",
"(",
"var",
"file",
"in",
"files",
")",
"{",
"if",
"(",
"'.css'",
"!=",
"path",
".",
"extname",
"(",
"... | Concat plugin.
@param {Object} `app` Assemble instance | [
"Concat",
"plugin",
"."
] | b5053ee061151e3850580606df525766b4b97357 | https://github.com/assemble/assemble/blob/b5053ee061151e3850580606df525766b4b97357/examples/build-tool/build.js#L23-L37 |
15,350 | assemble/assemble | examples/boilerplate/assemblefile.js | rename | function rename(files) {
return function(file) {
var base = path.relative(path.resolve(file.cwd), file.base);
var destBase = files.options.destBase;
file.dirname = path.resolve(path.join(destBase, base));
return file.base;
};
} | javascript | function rename(files) {
return function(file) {
var base = path.relative(path.resolve(file.cwd), file.base);
var destBase = files.options.destBase;
file.dirname = path.resolve(path.join(destBase, base));
return file.base;
};
} | [
"function",
"rename",
"(",
"files",
")",
"{",
"return",
"function",
"(",
"file",
")",
"{",
"var",
"base",
"=",
"path",
".",
"relative",
"(",
"path",
".",
"resolve",
"(",
"file",
".",
"cwd",
")",
",",
"file",
".",
"base",
")",
";",
"var",
"destBase"... | Custom rename function | [
"Custom",
"rename",
"function"
] | b5053ee061151e3850580606df525766b4b97357 | https://github.com/assemble/assemble/blob/b5053ee061151e3850580606df525766b4b97357/examples/boilerplate/assemblefile.js#L84-L91 |
15,351 | assemble/assemble | index.js | Assemble | function Assemble(options) {
if (!(this instanceof Assemble)) {
return new Assemble(options);
}
Core.call(this, options);
this.is('assemble');
this.initAssemble();
} | javascript | function Assemble(options) {
if (!(this instanceof Assemble)) {
return new Assemble(options);
}
Core.call(this, options);
this.is('assemble');
this.initAssemble();
} | [
"function",
"Assemble",
"(",
"options",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"Assemble",
")",
")",
"{",
"return",
"new",
"Assemble",
"(",
"options",
")",
";",
"}",
"Core",
".",
"call",
"(",
"this",
",",
"options",
")",
";",
"this",
... | Create an `assemble` app. This is the main function exported
by the assemble module.
```js
var assemble = require('assemble');
var app = assemble();
```
@param {Object} `options` Optionally pass default options to use.
@api public | [
"Create",
"an",
"assemble",
"app",
".",
"This",
"is",
"the",
"main",
"function",
"exported",
"by",
"the",
"assemble",
"module",
"."
] | b5053ee061151e3850580606df525766b4b97357 | https://github.com/assemble/assemble/blob/b5053ee061151e3850580606df525766b4b97357/index.js#L24-L31 |
15,352 | assemble/assemble | examples/project-generator/build.js | ask | function ask(cb) {
return function(app) {
app.use(store('smithy'))
.use(questions())
.ask(function(err, answers) {
if (err) return cb(err);
cb.call(app, null, answers);
});
app.asyncHelper('ask', function(key, options, cb) {
app.questions.options.force = true;
a... | javascript | function ask(cb) {
return function(app) {
app.use(store('smithy'))
.use(questions())
.ask(function(err, answers) {
if (err) return cb(err);
cb.call(app, null, answers);
});
app.asyncHelper('ask', function(key, options, cb) {
app.questions.options.force = true;
a... | [
"function",
"ask",
"(",
"cb",
")",
"{",
"return",
"function",
"(",
"app",
")",
"{",
"app",
".",
"use",
"(",
"store",
"(",
"'smithy'",
")",
")",
".",
"use",
"(",
"questions",
"(",
")",
")",
".",
"ask",
"(",
"function",
"(",
"err",
",",
"answers",
... | Customize the base-questions plugin | [
"Customize",
"the",
"base",
"-",
"questions",
"plugin"
] | b5053ee061151e3850580606df525766b4b97357 | https://github.com/assemble/assemble/blob/b5053ee061151e3850580606df525766b4b97357/examples/project-generator/build.js#L23-L41 |
15,353 | digicorp/propeller | components/range-slider/js/wNumb.js | throwEqualError | function throwEqualError( F, a, b ) {
if ( (F[a] || F[b]) && (F[a] === F[b]) ) {
throw new Error(a);
}
} | javascript | function throwEqualError( F, a, b ) {
if ( (F[a] || F[b]) && (F[a] === F[b]) ) {
throw new Error(a);
}
} | [
"function",
"throwEqualError",
"(",
"F",
",",
"a",
",",
"b",
")",
"{",
"if",
"(",
"(",
"F",
"[",
"a",
"]",
"||",
"F",
"[",
"b",
"]",
")",
"&&",
"(",
"F",
"[",
"a",
"]",
"===",
"F",
"[",
"b",
"]",
")",
")",
"{",
"throw",
"new",
"Error",
... | Throw an error if formatting options are incompatible. | [
"Throw",
"an",
"error",
"if",
"formatting",
"options",
"are",
"incompatible",
"."
] | 151155570d9d975e16811aabc3c47e84eaeec661 | https://github.com/digicorp/propeller/blob/151155570d9d975e16811aabc3c47e84eaeec661/components/range-slider/js/wNumb.js#L38-L42 |
15,354 | digicorp/propeller | components/range-slider/js/wNumb.js | toFixed | function toFixed ( value, decimals ) {
var scale = Math.pow(10, decimals);
return ( Math.round(value * scale) / scale).toFixed( decimals );
} | javascript | function toFixed ( value, decimals ) {
var scale = Math.pow(10, decimals);
return ( Math.round(value * scale) / scale).toFixed( decimals );
} | [
"function",
"toFixed",
"(",
"value",
",",
"decimals",
")",
"{",
"var",
"scale",
"=",
"Math",
".",
"pow",
"(",
"10",
",",
"decimals",
")",
";",
"return",
"(",
"Math",
".",
"round",
"(",
"value",
"*",
"scale",
")",
"/",
"scale",
")",
".",
"toFixed",
... | Provide rounding-accurate toFixed method. | [
"Provide",
"rounding",
"-",
"accurate",
"toFixed",
"method",
"."
] | 151155570d9d975e16811aabc3c47e84eaeec661 | https://github.com/digicorp/propeller/blob/151155570d9d975e16811aabc3c47e84eaeec661/components/range-slider/js/wNumb.js#L50-L53 |
15,355 | digicorp/propeller | components/range-slider/js/wNumb.js | formatTo | function formatTo ( decimals, thousand, mark, prefix, postfix, encoder, decoder, negativeBefore, negative, edit, undo, input ) {
var originalInput = input, inputIsNegative, inputPieces, inputBase, inputDecimals = '', output = '';
// Apply user encoder to the input.
// Expected outcome: number.
if ( encoder ) ... | javascript | function formatTo ( decimals, thousand, mark, prefix, postfix, encoder, decoder, negativeBefore, negative, edit, undo, input ) {
var originalInput = input, inputIsNegative, inputPieces, inputBase, inputDecimals = '', output = '';
// Apply user encoder to the input.
// Expected outcome: number.
if ( encoder ) ... | [
"function",
"formatTo",
"(",
"decimals",
",",
"thousand",
",",
"mark",
",",
"prefix",
",",
"postfix",
",",
"encoder",
",",
"decoder",
",",
"negativeBefore",
",",
"negative",
",",
"edit",
",",
"undo",
",",
"input",
")",
"{",
"var",
"originalInput",
"=",
"... | Formatting Accept a number as input, output formatted string. | [
"Formatting",
"Accept",
"a",
"number",
"as",
"input",
"output",
"formatted",
"string",
"."
] | 151155570d9d975e16811aabc3c47e84eaeec661 | https://github.com/digicorp/propeller/blob/151155570d9d975e16811aabc3c47e84eaeec661/components/range-slider/js/wNumb.js#L59-L148 |
15,356 | digicorp/propeller | components/range-slider/js/wNumb.js | formatFrom | function formatFrom ( decimals, thousand, mark, prefix, postfix, encoder, decoder, negativeBefore, negative, edit, undo, input ) {
var originalInput = input, inputIsNegative, output = '';
// User defined pre-decoder. Result must be a non empty string.
if ( undo ) {
input = undo(input);
}
// Test the inp... | javascript | function formatFrom ( decimals, thousand, mark, prefix, postfix, encoder, decoder, negativeBefore, negative, edit, undo, input ) {
var originalInput = input, inputIsNegative, output = '';
// User defined pre-decoder. Result must be a non empty string.
if ( undo ) {
input = undo(input);
}
// Test the inp... | [
"function",
"formatFrom",
"(",
"decimals",
",",
"thousand",
",",
"mark",
",",
"prefix",
",",
"postfix",
",",
"encoder",
",",
"decoder",
",",
"negativeBefore",
",",
"negative",
",",
"edit",
",",
"undo",
",",
"input",
")",
"{",
"var",
"originalInput",
"=",
... | Accept a sting as input, output decoded number. | [
"Accept",
"a",
"sting",
"as",
"input",
"output",
"decoded",
"number",
"."
] | 151155570d9d975e16811aabc3c47e84eaeec661 | https://github.com/digicorp/propeller/blob/151155570d9d975e16811aabc3c47e84eaeec661/components/range-slider/js/wNumb.js#L151-L229 |
15,357 | digicorp/propeller | components/range-slider/js/wNumb.js | validate | function validate ( inputOptions ) {
var i, optionName, optionValue,
filteredOptions = {};
for ( i = 0; i < FormatOptions.length; i+=1 ) {
optionName = FormatOptions[i];
optionValue = inputOptions[optionName];
if ( optionValue === undefined ) {
// Only default if negativeBefore isn't set.
i... | javascript | function validate ( inputOptions ) {
var i, optionName, optionValue,
filteredOptions = {};
for ( i = 0; i < FormatOptions.length; i+=1 ) {
optionName = FormatOptions[i];
optionValue = inputOptions[optionName];
if ( optionValue === undefined ) {
// Only default if negativeBefore isn't set.
i... | [
"function",
"validate",
"(",
"inputOptions",
")",
"{",
"var",
"i",
",",
"optionName",
",",
"optionValue",
",",
"filteredOptions",
"=",
"{",
"}",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"FormatOptions",
".",
"length",
";",
"i",
"+=",
"1",
")",
... | Framework Validate formatting options | [
"Framework",
"Validate",
"formatting",
"options"
] | 151155570d9d975e16811aabc3c47e84eaeec661 | https://github.com/digicorp/propeller/blob/151155570d9d975e16811aabc3c47e84eaeec661/components/range-slider/js/wNumb.js#L235-L291 |
15,358 | digicorp/propeller | components/range-slider/js/wNumb.js | passAll | function passAll ( options, method, input ) {
var i, args = [];
// Add all options in order of FormatOptions
for ( i = 0; i < FormatOptions.length; i+=1 ) {
args.push(options[FormatOptions[i]]);
}
// Append the input, then call the method, presenting all
// options as arguments.
args.push(input);
r... | javascript | function passAll ( options, method, input ) {
var i, args = [];
// Add all options in order of FormatOptions
for ( i = 0; i < FormatOptions.length; i+=1 ) {
args.push(options[FormatOptions[i]]);
}
// Append the input, then call the method, presenting all
// options as arguments.
args.push(input);
r... | [
"function",
"passAll",
"(",
"options",
",",
"method",
",",
"input",
")",
"{",
"var",
"i",
",",
"args",
"=",
"[",
"]",
";",
"// Add all options in order of FormatOptions",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"FormatOptions",
".",
"length",
";",
"i",... | Pass all options as function arguments | [
"Pass",
"all",
"options",
"as",
"function",
"arguments"
] | 151155570d9d975e16811aabc3c47e84eaeec661 | https://github.com/digicorp/propeller/blob/151155570d9d975e16811aabc3c47e84eaeec661/components/range-slider/js/wNumb.js#L294-L306 |
15,359 | digicorp/propeller | components/range-slider/snippets/range-slider.js | formatDate | function formatDate ( date ) {
return weekdays[date.getDay()] + ", " +
date.getDate() + nth(date.getDate()) + " " +
months[date.getMonth()] + " " +
date.getFullYear();
} | javascript | function formatDate ( date ) {
return weekdays[date.getDay()] + ", " +
date.getDate() + nth(date.getDate()) + " " +
months[date.getMonth()] + " " +
date.getFullYear();
} | [
"function",
"formatDate",
"(",
"date",
")",
"{",
"return",
"weekdays",
"[",
"date",
".",
"getDay",
"(",
")",
"]",
"+",
"\", \"",
"+",
"date",
".",
"getDate",
"(",
")",
"+",
"nth",
"(",
"date",
".",
"getDate",
"(",
")",
")",
"+",
"\" \"",
"+",
"mo... | Create a string representation of the date. | [
"Create",
"a",
"string",
"representation",
"of",
"the",
"date",
"."
] | 151155570d9d975e16811aabc3c47e84eaeec661 | https://github.com/digicorp/propeller/blob/151155570d9d975e16811aabc3c47e84eaeec661/components/range-slider/snippets/range-slider.js#L90-L95 |
15,360 | digicorp/propeller | dist/js/propeller.js | function () {
function commons() {}
commons.attachParentSelector = function (parentSelector, defaultSelector) {
var customSelector = defaultSelector;
if (parentSelector !== '' && parentSelector.length > 0) {
if (parentSelector === defaultSelector) {
customSelector = defaultSelector;
} else if ($(paren... | javascript | function () {
function commons() {}
commons.attachParentSelector = function (parentSelector, defaultSelector) {
var customSelector = defaultSelector;
if (parentSelector !== '' && parentSelector.length > 0) {
if (parentSelector === defaultSelector) {
customSelector = defaultSelector;
} else if ($(paren... | [
"function",
"(",
")",
"{",
"function",
"commons",
"(",
")",
"{",
"}",
"commons",
".",
"attachParentSelector",
"=",
"function",
"(",
"parentSelector",
",",
"defaultSelector",
")",
"{",
"var",
"customSelector",
"=",
"defaultSelector",
";",
"if",
"(",
"parentSele... | Attach Parent Selector | [
"Attach",
"Parent",
"Selector"
] | 151155570d9d975e16811aabc3c47e84eaeec661 | https://github.com/digicorp/propeller/blob/151155570d9d975e16811aabc3c47e84eaeec661/dist/js/propeller.js#L13-L30 | |
15,361 | digicorp/propeller | dist/js/propeller.js | _inherits | function _inherits(SubClass, SuperClass) {
if (typeof SuperClass !== "function" && SuperClass !== null) {
throw new TypeError("Super expression must either be null or a function, not " + typeof SuperClass);
}
SubClass.prototype = new SuperClass();
} | javascript | function _inherits(SubClass, SuperClass) {
if (typeof SuperClass !== "function" && SuperClass !== null) {
throw new TypeError("Super expression must either be null or a function, not " + typeof SuperClass);
}
SubClass.prototype = new SuperClass();
} | [
"function",
"_inherits",
"(",
"SubClass",
",",
"SuperClass",
")",
"{",
"if",
"(",
"typeof",
"SuperClass",
"!==",
"\"function\"",
"&&",
"SuperClass",
"!==",
"null",
")",
"{",
"throw",
"new",
"TypeError",
"(",
"\"Super expression must either be null or a function, not \... | Inherit one class to another | [
"Inherit",
"one",
"class",
"to",
"another"
] | 151155570d9d975e16811aabc3c47e84eaeec661 | https://github.com/digicorp/propeller/blob/151155570d9d975e16811aabc3c47e84eaeec661/dist/js/propeller.js#L33-L38 |
15,362 | digicorp/propeller | dist/js/propeller.js | onNavBarToggle | function onNavBarToggle() {
$(Selector.NAVBAR_SIDEBAR).toggleClass(ClassName.OPEN);
if (($(Selector.NAVBAR_SIDEBAR).hasClass(ClassName.NAVBAR_SIDEBAR)) && $(Selector.NAVBAR_SIDEBAR).hasClass(ClassName.OPEN)) {
$(Selector.OVERLAY).addClass(ClassName.OVERLAY_ACTIVE);
$(Selector.BOD... | javascript | function onNavBarToggle() {
$(Selector.NAVBAR_SIDEBAR).toggleClass(ClassName.OPEN);
if (($(Selector.NAVBAR_SIDEBAR).hasClass(ClassName.NAVBAR_SIDEBAR)) && $(Selector.NAVBAR_SIDEBAR).hasClass(ClassName.OPEN)) {
$(Selector.OVERLAY).addClass(ClassName.OVERLAY_ACTIVE);
$(Selector.BOD... | [
"function",
"onNavBarToggle",
"(",
")",
"{",
"$",
"(",
"Selector",
".",
"NAVBAR_SIDEBAR",
")",
".",
"toggleClass",
"(",
"ClassName",
".",
"OPEN",
")",
";",
"if",
"(",
"(",
"$",
"(",
"Selector",
".",
"NAVBAR_SIDEBAR",
")",
".",
"hasClass",
"(",
"ClassName... | Nave bar in Sidebar | [
"Nave",
"bar",
"in",
"Sidebar"
] | 151155570d9d975e16811aabc3c47e84eaeec661 | https://github.com/digicorp/propeller/blob/151155570d9d975e16811aabc3c47e84eaeec661/dist/js/propeller.js#L1745-L1754 |
15,363 | digicorp/propeller | dist/js/propeller.js | onResizeWindow | function onResizeWindow(e) {
var options = e.data.param1;
var sideBarSelector=Selector.SIDEBAR;
$(sideBarSelector).each(function () {
var $this = $(this);
var sideBarId = $this.attr("id");
var isOpenWidth=$("a[data-target="+sideBarId+"]").attr("is-open-width");
if($(window).width()<isOpenWidth) {
... | javascript | function onResizeWindow(e) {
var options = e.data.param1;
var sideBarSelector=Selector.SIDEBAR;
$(sideBarSelector).each(function () {
var $this = $(this);
var sideBarId = $this.attr("id");
var isOpenWidth=$("a[data-target="+sideBarId+"]").attr("is-open-width");
if($(window).width()<isOpenWidth) {
... | [
"function",
"onResizeWindow",
"(",
"e",
")",
"{",
"var",
"options",
"=",
"e",
".",
"data",
".",
"param1",
";",
"var",
"sideBarSelector",
"=",
"Selector",
".",
"SIDEBAR",
";",
"$",
"(",
"sideBarSelector",
")",
".",
"each",
"(",
"function",
"(",
")",
"{"... | On Window Resize | [
"On",
"Window",
"Resize"
] | 151155570d9d975e16811aabc3c47e84eaeec661 | https://github.com/digicorp/propeller/blob/151155570d9d975e16811aabc3c47e84eaeec661/dist/js/propeller.js#L1767-L1792 |
15,364 | TotallyInformation/node-red-contrib-uibuilder | nodes/uibuilder.js | localMiddleware | function localMiddleware (req, res, next) {
// Tell the client what Socket.IO namespace to use,
// trim the leading slash because the cookie will turn it into a %2F
res.setHeader('uibuilder-namespace', node.ioNamespace)
res.cookie('uibuilder-namespace', tilib.trimSlashes(... | javascript | function localMiddleware (req, res, next) {
// Tell the client what Socket.IO namespace to use,
// trim the leading slash because the cookie will turn it into a %2F
res.setHeader('uibuilder-namespace', node.ioNamespace)
res.cookie('uibuilder-namespace', tilib.trimSlashes(... | [
"function",
"localMiddleware",
"(",
"req",
",",
"res",
",",
"next",
")",
"{",
"// Tell the client what Socket.IO namespace to use,",
"// trim the leading slash because the cookie will turn it into a %2F",
"res",
".",
"setHeader",
"(",
"'uibuilder-namespace'",
",",
"node",
".",
... | This ExpressJS middleware runs when the uibuilder page loads
@see https://expressjs.com/en/guide/using-middleware.html | [
"This",
"ExpressJS",
"middleware",
"runs",
"when",
"the",
"uibuilder",
"page",
"loads"
] | e89bf6e9d6ad183de9531301b35f87b8c7f08f7e | https://github.com/TotallyInformation/node-red-contrib-uibuilder/blob/e89bf6e9d6ad183de9531301b35f87b8c7f08f7e/nodes/uibuilder.js#L318-L324 |
15,365 | TotallyInformation/node-red-contrib-uibuilder | nodes/uiblib.js | function(msg, node, RED, io, ioNs, log) {
node.rcvMsgCount++
log.verbose(`[${node.url}] msg received via FLOW. ${node.rcvMsgCount} messages received`, msg)
// If the input msg is a uibuilder control msg, then drop it to prevent loops
if ( msg.hasOwnProperty('uibuilderCtrl') ) return nul... | javascript | function(msg, node, RED, io, ioNs, log) {
node.rcvMsgCount++
log.verbose(`[${node.url}] msg received via FLOW. ${node.rcvMsgCount} messages received`, msg)
// If the input msg is a uibuilder control msg, then drop it to prevent loops
if ( msg.hasOwnProperty('uibuilderCtrl') ) return nul... | [
"function",
"(",
"msg",
",",
"node",
",",
"RED",
",",
"io",
",",
"ioNs",
",",
"log",
")",
"{",
"node",
".",
"rcvMsgCount",
"++",
"log",
".",
"verbose",
"(",
"`",
"${",
"node",
".",
"url",
"}",
"${",
"node",
".",
"rcvMsgCount",
"}",
"`",
",",
"m... | Complex, custom code when processing an incoming msg should go here Needs to return the msg object | [
"Complex",
"custom",
"code",
"when",
"processing",
"an",
"incoming",
"msg",
"should",
"go",
"here",
"Needs",
"to",
"return",
"the",
"msg",
"object"
] | e89bf6e9d6ad183de9531301b35f87b8c7f08f7e | https://github.com/TotallyInformation/node-red-contrib-uibuilder/blob/e89bf6e9d6ad183de9531301b35f87b8c7f08f7e/nodes/uiblib.js#L29-L63 | |
15,366 | nikgraf/belle | src/components/Toggle.js | validateChoices | function validateChoices(props, propName, componentName) {
const propValue = props[propName];
if (!propValue) {
return undefined;
}
if (!Array.isArray(propValue) || propValue.length !== 2) {
return new Error(`Invalid ${propName} supplied to \`${componentName}\`, expected exactly two Choice components.`... | javascript | function validateChoices(props, propName, componentName) {
const propValue = props[propName];
if (!propValue) {
return undefined;
}
if (!Array.isArray(propValue) || propValue.length !== 2) {
return new Error(`Invalid ${propName} supplied to \`${componentName}\`, expected exactly two Choice components.`... | [
"function",
"validateChoices",
"(",
"props",
",",
"propName",
",",
"componentName",
")",
"{",
"const",
"propValue",
"=",
"props",
"[",
"propName",
"]",
";",
"if",
"(",
"!",
"propValue",
")",
"{",
"return",
"undefined",
";",
"}",
"if",
"(",
"!",
"Array",
... | Verifies that the children is an array containing only two choices with a
different value. | [
"Verifies",
"that",
"the",
"children",
"is",
"an",
"array",
"containing",
"only",
"two",
"choices",
"with",
"a",
"different",
"value",
"."
] | e0f561d6ad704b5e3d66a38752de29f938b065af | https://github.com/nikgraf/belle/blob/e0f561d6ad704b5e3d66a38752de29f938b065af/src/components/Toggle.js#L17-L39 |
15,367 | nikgraf/belle | src/components/Toggle.js | updatePseudoClassStyle | function updatePseudoClassStyle(styleId, properties, preventFocusStyleForTouchAndClick) {
let focusStyle;
if (preventFocusStyleForTouchAndClick) {
focusStyle = { outline: 0 };
} else {
focusStyle = {
...style.focusStyle,
...properties.focusStyle,
};
}
const styles = [
{
id: ... | javascript | function updatePseudoClassStyle(styleId, properties, preventFocusStyleForTouchAndClick) {
let focusStyle;
if (preventFocusStyleForTouchAndClick) {
focusStyle = { outline: 0 };
} else {
focusStyle = {
...style.focusStyle,
...properties.focusStyle,
};
}
const styles = [
{
id: ... | [
"function",
"updatePseudoClassStyle",
"(",
"styleId",
",",
"properties",
",",
"preventFocusStyleForTouchAndClick",
")",
"{",
"let",
"focusStyle",
";",
"if",
"(",
"preventFocusStyleForTouchAndClick",
")",
"{",
"focusStyle",
"=",
"{",
"outline",
":",
"0",
"}",
";",
... | Update focus style for the speficied styleId.
@param styleId {string} - a unique id that exists as class attribute in the DOM
@param properties {object} - the components properties optionally containing custom styles | [
"Update",
"focus",
"style",
"for",
"the",
"speficied",
"styleId",
"."
] | e0f561d6ad704b5e3d66a38752de29f938b065af | https://github.com/nikgraf/belle/blob/e0f561d6ad704b5e3d66a38752de29f938b065af/src/components/Toggle.js#L153-L173 |
15,368 | nikgraf/belle | src/components/Button.js | updatePseudoClassStyle | function updatePseudoClassStyle(styleId, properties, preventFocusStyleForTouchAndClick) {
const baseStyle = properties.primary ? buttonStyle.primaryStyle : buttonStyle.style;
const baseDisabledStyle = properties.primary ? buttonStyle.primaryDisabledStyle : buttonStyle.disabledStyle;
const disabledStyle = {
..... | javascript | function updatePseudoClassStyle(styleId, properties, preventFocusStyleForTouchAndClick) {
const baseStyle = properties.primary ? buttonStyle.primaryStyle : buttonStyle.style;
const baseDisabledStyle = properties.primary ? buttonStyle.primaryDisabledStyle : buttonStyle.disabledStyle;
const disabledStyle = {
..... | [
"function",
"updatePseudoClassStyle",
"(",
"styleId",
",",
"properties",
",",
"preventFocusStyleForTouchAndClick",
")",
"{",
"const",
"baseStyle",
"=",
"properties",
".",
"primary",
"?",
"buttonStyle",
".",
"primaryStyle",
":",
"buttonStyle",
".",
"style",
";",
"con... | Update hover, focus & active style for the speficied styleId.
@param styleId {string} - a unique id that exists as class attribute in the DOM
@param properties {object} - the components properties optionally containing custom styles | [
"Update",
"hover",
"focus",
"&",
"active",
"style",
"for",
"the",
"speficied",
"styleId",
"."
] | e0f561d6ad704b5e3d66a38752de29f938b065af | https://github.com/nikgraf/belle/blob/e0f561d6ad704b5e3d66a38752de29f938b065af/src/components/Button.js#L53-L99 |
15,369 | nikgraf/belle | src/components/Select.js | validateChildrenAreOptionsAndMaximumOnePlaceholder | function validateChildrenAreOptionsAndMaximumOnePlaceholder(props, propName, componentName) {
const validChildren = filterReactChildren(props[propName], (node) => (
(isOption(node) || isSeparator(node) || isPlaceholder(node))
));
if (React.Children.count(props[propName]) !== React.Children.count(validChildren... | javascript | function validateChildrenAreOptionsAndMaximumOnePlaceholder(props, propName, componentName) {
const validChildren = filterReactChildren(props[propName], (node) => (
(isOption(node) || isSeparator(node) || isPlaceholder(node))
));
if (React.Children.count(props[propName]) !== React.Children.count(validChildren... | [
"function",
"validateChildrenAreOptionsAndMaximumOnePlaceholder",
"(",
"props",
",",
"propName",
",",
"componentName",
")",
"{",
"const",
"validChildren",
"=",
"filterReactChildren",
"(",
"props",
"[",
"propName",
"]",
",",
"(",
"node",
")",
"=>",
"(",
"(",
"isOpt... | Verifies that the children is an array containing only Options & at maximum
one Placeholder. | [
"Verifies",
"that",
"the",
"children",
"is",
"an",
"array",
"containing",
"only",
"Options",
"&",
"at",
"maximum",
"one",
"Placeholder",
"."
] | e0f561d6ad704b5e3d66a38752de29f938b065af | https://github.com/nikgraf/belle/blob/e0f561d6ad704b5e3d66a38752de29f938b065af/src/components/Select.js#L54-L68 |
15,370 | nikgraf/belle | src/components/Select.js | updatePseudoClassStyle | function updatePseudoClassStyle(styleId, properties) {
const hoverStyle = {
...style.hoverStyle,
...properties.hoverStyle,
};
const disabledHoverStyle = {
...style.disabledHoverStyle,
...properties.disabledHoverStyle,
};
const styles = [
{
id: styleId,
style: hoverStyle,
... | javascript | function updatePseudoClassStyle(styleId, properties) {
const hoverStyle = {
...style.hoverStyle,
...properties.hoverStyle,
};
const disabledHoverStyle = {
...style.disabledHoverStyle,
...properties.disabledHoverStyle,
};
const styles = [
{
id: styleId,
style: hoverStyle,
... | [
"function",
"updatePseudoClassStyle",
"(",
"styleId",
",",
"properties",
")",
"{",
"const",
"hoverStyle",
"=",
"{",
"...",
"style",
".",
"hoverStyle",
",",
"...",
"properties",
".",
"hoverStyle",
",",
"}",
";",
"const",
"disabledHoverStyle",
"=",
"{",
"...",
... | Update hover style for the speficied styleId.
@param styleId {string} - a unique id that exists as class attribute in the DOM
@param properties {object} - the components properties optionally containing hoverStyle | [
"Update",
"hover",
"style",
"for",
"the",
"speficied",
"styleId",
"."
] | e0f561d6ad704b5e3d66a38752de29f938b065af | https://github.com/nikgraf/belle/blob/e0f561d6ad704b5e3d66a38752de29f938b065af/src/components/Select.js#L121-L145 |
15,371 | nikgraf/belle | docs/theme/initialize.js | updateStructure | function updateStructure(targetObject, object) {
for (const componentName in object) {
if (object.hasOwnProperty(componentName)) {
for (const styleName in object[componentName]) {
if (object[componentName].hasOwnProperty(styleName)) {
targetObject[componentName][styleName] = object[compone... | javascript | function updateStructure(targetObject, object) {
for (const componentName in object) {
if (object.hasOwnProperty(componentName)) {
for (const styleName in object[componentName]) {
if (object[componentName].hasOwnProperty(styleName)) {
targetObject[componentName][styleName] = object[compone... | [
"function",
"updateStructure",
"(",
"targetObject",
",",
"object",
")",
"{",
"for",
"(",
"const",
"componentName",
"in",
"object",
")",
"{",
"if",
"(",
"object",
".",
"hasOwnProperty",
"(",
"componentName",
")",
")",
"{",
"for",
"(",
"const",
"styleName",
... | Updates the deepest structure while keeping the original reference of the outer objects. | [
"Updates",
"the",
"deepest",
"structure",
"while",
"keeping",
"the",
"original",
"reference",
"of",
"the",
"outer",
"objects",
"."
] | e0f561d6ad704b5e3d66a38752de29f938b065af | https://github.com/nikgraf/belle/blob/e0f561d6ad704b5e3d66a38752de29f938b065af/docs/theme/initialize.js#L18-L28 |
15,372 | nikgraf/belle | src/utils/helpers.js | flattenInternal | function flattenInternal(output, element) {
if (element) {
element.forEach((obj) => {
if (Array.isArray(obj)) {
flattenInternal(output, obj);
} else {
output.push(obj);
}
});
}
} | javascript | function flattenInternal(output, element) {
if (element) {
element.forEach((obj) => {
if (Array.isArray(obj)) {
flattenInternal(output, obj);
} else {
output.push(obj);
}
});
}
} | [
"function",
"flattenInternal",
"(",
"output",
",",
"element",
")",
"{",
"if",
"(",
"element",
")",
"{",
"element",
".",
"forEach",
"(",
"(",
"obj",
")",
"=>",
"{",
"if",
"(",
"Array",
".",
"isArray",
"(",
"obj",
")",
")",
"{",
"flattenInternal",
"(",... | Recursive function for flattening an iterable.
@param {object} output - base object to be updated
@param {object} element - input object to be merged into the output | [
"Recursive",
"function",
"for",
"flattening",
"an",
"iterable",
"."
] | e0f561d6ad704b5e3d66a38752de29f938b065af | https://github.com/nikgraf/belle/blob/e0f561d6ad704b5e3d66a38752de29f938b065af/src/utils/helpers.js#L310-L320 |
15,373 | nikgraf/belle | src/utils/inject-style.js | createMarkupOnPseudoClass | function createMarkupOnPseudoClass(pseudoClasses, id, disabled) {
return mapObject(pseudoClasses, (style, pseudoClass) => {
if (style && Object.keys(style).length > 0) {
const styleString = CSSPropertyOperations.createMarkupForStyles(style);
const styleWithImportant = styleString.replace(/;/g, ' !impo... | javascript | function createMarkupOnPseudoClass(pseudoClasses, id, disabled) {
return mapObject(pseudoClasses, (style, pseudoClass) => {
if (style && Object.keys(style).length > 0) {
const styleString = CSSPropertyOperations.createMarkupForStyles(style);
const styleWithImportant = styleString.replace(/;/g, ' !impo... | [
"function",
"createMarkupOnPseudoClass",
"(",
"pseudoClasses",
",",
"id",
",",
"disabled",
")",
"{",
"return",
"mapObject",
"(",
"pseudoClasses",
",",
"(",
"style",
",",
"pseudoClass",
")",
"=>",
"{",
"if",
"(",
"style",
"&&",
"Object",
".",
"keys",
"(",
"... | Constructs all the stored styles & injects them to the DOM. | [
"Constructs",
"all",
"the",
"stored",
"styles",
"&",
"injects",
"them",
"to",
"the",
"DOM",
"."
] | e0f561d6ad704b5e3d66a38752de29f938b065af | https://github.com/nikgraf/belle/blob/e0f561d6ad704b5e3d66a38752de29f938b065af/src/utils/inject-style.js#L37-L50 |
15,374 | nikgraf/belle | src/components/ComboBox.js | filterFunc | function filterFunc(inputValue, optionValue) {
if (inputValue && optionValue) {
return optionValue.toLowerCase().indexOf(inputValue.toLowerCase()) > -1;
}
return false;
} | javascript | function filterFunc(inputValue, optionValue) {
if (inputValue && optionValue) {
return optionValue.toLowerCase().indexOf(inputValue.toLowerCase()) > -1;
}
return false;
} | [
"function",
"filterFunc",
"(",
"inputValue",
",",
"optionValue",
")",
"{",
"if",
"(",
"inputValue",
"&&",
"optionValue",
")",
"{",
"return",
"optionValue",
".",
"toLowerCase",
"(",
")",
".",
"indexOf",
"(",
"inputValue",
".",
"toLowerCase",
"(",
")",
")",
... | Default function used for filtering options. | [
"Default",
"function",
"used",
"for",
"filtering",
"options",
"."
] | e0f561d6ad704b5e3d66a38752de29f938b065af | https://github.com/nikgraf/belle/blob/e0f561d6ad704b5e3d66a38752de29f938b065af/src/components/ComboBox.js#L143-L149 |
15,375 | nikgraf/belle | src/utils/calculate-textarea-height.js | calculateStyling | function calculateStyling(node) {
const reactId = node.getAttribute('data-reactid');
// calculate the computed style only once it's not in the cache
if (!computedStyleCache[reactId]) {
// In order to work with legacy browsers the second paramter for pseudoClass
// has to be provided http://caniuse.com/#f... | javascript | function calculateStyling(node) {
const reactId = node.getAttribute('data-reactid');
// calculate the computed style only once it's not in the cache
if (!computedStyleCache[reactId]) {
// In order to work with legacy browsers the second paramter for pseudoClass
// has to be provided http://caniuse.com/#f... | [
"function",
"calculateStyling",
"(",
"node",
")",
"{",
"const",
"reactId",
"=",
"node",
".",
"getAttribute",
"(",
"'data-reactid'",
")",
";",
"// calculate the computed style only once it's not in the cache",
"if",
"(",
"!",
"computedStyleCache",
"[",
"reactId",
"]",
... | Returns an object containing the computed style and the combined vertical
padding size, combined vertical border size and box-sizing value.
This style is returned as string to be applied as attribute of an element. | [
"Returns",
"an",
"object",
"containing",
"the",
"computed",
"style",
"and",
"the",
"combined",
"vertical",
"padding",
"size",
"combined",
"vertical",
"border",
"size",
"and",
"box",
"-",
"sizing",
"value",
"."
] | e0f561d6ad704b5e3d66a38752de29f938b065af | https://github.com/nikgraf/belle/blob/e0f561d6ad704b5e3d66a38752de29f938b065af/src/utils/calculate-textarea-height.js#L46-L88 |
15,376 | nikgraf/belle | src/components/TextInput.js | sanitizeChildProps | function sanitizeChildProps(properties) {
const childProps = omit(properties, Object.keys(textInputPropTypes));
if (typeof properties.valueLink === 'object') {
childProps.value = properties.valueLink.value;
}
return childProps;
} | javascript | function sanitizeChildProps(properties) {
const childProps = omit(properties, Object.keys(textInputPropTypes));
if (typeof properties.valueLink === 'object') {
childProps.value = properties.valueLink.value;
}
return childProps;
} | [
"function",
"sanitizeChildProps",
"(",
"properties",
")",
"{",
"const",
"childProps",
"=",
"omit",
"(",
"properties",
",",
"Object",
".",
"keys",
"(",
"textInputPropTypes",
")",
")",
";",
"if",
"(",
"typeof",
"properties",
".",
"valueLink",
"===",
"'object'",
... | Returns an object with properties that are relevant for the TextInput's textarea.
As the height of the textarea needs to be calculated valueLink can not be
passed down to the textarea, but made available through this component. | [
"Returns",
"an",
"object",
"with",
"properties",
"that",
"are",
"relevant",
"for",
"the",
"TextInput",
"s",
"textarea",
"."
] | e0f561d6ad704b5e3d66a38752de29f938b065af | https://github.com/nikgraf/belle/blob/e0f561d6ad704b5e3d66a38752de29f938b065af/src/components/TextInput.js#L41-L48 |
15,377 | irislib/iris-lib | dist/irisLib.js | isBuffer | function isBuffer(obj) {
return obj != null && (!!obj._isBuffer || isFastBuffer(obj) || isSlowBuffer(obj))
} | javascript | function isBuffer(obj) {
return obj != null && (!!obj._isBuffer || isFastBuffer(obj) || isSlowBuffer(obj))
} | [
"function",
"isBuffer",
"(",
"obj",
")",
"{",
"return",
"obj",
"!=",
"null",
"&&",
"(",
"!",
"!",
"obj",
".",
"_isBuffer",
"||",
"isFastBuffer",
"(",
"obj",
")",
"||",
"isSlowBuffer",
"(",
"obj",
")",
")",
"}"
] | the following is from is-buffer, also by Feross Aboukhadijeh and with same lisence The _isBuffer check is for Safari 5-7 support, because it's missing Object.prototype.constructor. Remove this eventually | [
"the",
"following",
"is",
"from",
"is",
"-",
"buffer",
"also",
"by",
"Feross",
"Aboukhadijeh",
"and",
"with",
"same",
"lisence",
"The",
"_isBuffer",
"check",
"is",
"for",
"Safari",
"5",
"-",
"7",
"support",
"because",
"it",
"s",
"missing",
"Object",
".",
... | 6a170a49c0ef1ea06ebf8007a9af52e275b80f1d | https://github.com/irislib/iris-lib/blob/6a170a49c0ef1ea06ebf8007a9af52e275b80f1d/dist/irisLib.js#L4595-L4597 |
15,378 | irislib/iris-lib | dist/irisLib.js | copyFromBuffer | function copyFromBuffer(n, list) {
var ret = Buffer.allocUnsafe(n);
var p = list.head;
var c = 1;
p.data.copy(ret);
n -= p.data.length;
while (p = p.next) {
var buf = p.data;
var nb = n > buf.length ? buf.length : n;
buf.copy(ret, ret.length - n, 0, nb);
n -= nb;
if (n === 0) ... | javascript | function copyFromBuffer(n, list) {
var ret = Buffer.allocUnsafe(n);
var p = list.head;
var c = 1;
p.data.copy(ret);
n -= p.data.length;
while (p = p.next) {
var buf = p.data;
var nb = n > buf.length ? buf.length : n;
buf.copy(ret, ret.length - n, 0, nb);
n -= nb;
if (n === 0) ... | [
"function",
"copyFromBuffer",
"(",
"n",
",",
"list",
")",
"{",
"var",
"ret",
"=",
"Buffer",
".",
"allocUnsafe",
"(",
"n",
")",
";",
"var",
"p",
"=",
"list",
".",
"head",
";",
"var",
"c",
"=",
"1",
";",
"p",
".",
"data",
".",
"copy",
"(",
"ret",... | Copies a specified amount of bytes from the list of buffered data chunks. This function is designed to be inlinable, so please take care when making changes to the function body. | [
"Copies",
"a",
"specified",
"amount",
"of",
"bytes",
"from",
"the",
"list",
"of",
"buffered",
"data",
"chunks",
".",
"This",
"function",
"is",
"designed",
"to",
"be",
"inlinable",
"so",
"please",
"take",
"care",
"when",
"making",
"changes",
"to",
"the",
"f... | 6a170a49c0ef1ea06ebf8007a9af52e275b80f1d | https://github.com/irislib/iris-lib/blob/6a170a49c0ef1ea06ebf8007a9af52e275b80f1d/dist/irisLib.js#L6956-L6981 |
15,379 | irislib/iris-lib | dist/irisLib.js | Hash | function Hash (blockSize, finalSize) {
this._block = Buffer$4.alloc(blockSize);
this._finalSize = finalSize;
this._blockSize = blockSize;
this._len = 0;
} | javascript | function Hash (blockSize, finalSize) {
this._block = Buffer$4.alloc(blockSize);
this._finalSize = finalSize;
this._blockSize = blockSize;
this._len = 0;
} | [
"function",
"Hash",
"(",
"blockSize",
",",
"finalSize",
")",
"{",
"this",
".",
"_block",
"=",
"Buffer$4",
".",
"alloc",
"(",
"blockSize",
")",
";",
"this",
".",
"_finalSize",
"=",
"finalSize",
";",
"this",
".",
"_blockSize",
"=",
"blockSize",
";",
"this"... | prototype class for hash functions | [
"prototype",
"class",
"for",
"hash",
"functions"
] | 6a170a49c0ef1ea06ebf8007a9af52e275b80f1d | https://github.com/irislib/iris-lib/blob/6a170a49c0ef1ea06ebf8007a9af52e275b80f1d/dist/irisLib.js#L8173-L8178 |
15,380 | irislib/iris-lib | dist/irisLib.js | write | function write(buffer, offs) {
for (var i = 2; i < arguments.length; i++) {
for (var j = 0; j < arguments[i].length; j++) {
buffer[offs++] = arguments[i].charAt(j);
}
}
} | javascript | function write(buffer, offs) {
for (var i = 2; i < arguments.length; i++) {
for (var j = 0; j < arguments[i].length; j++) {
buffer[offs++] = arguments[i].charAt(j);
}
}
} | [
"function",
"write",
"(",
"buffer",
",",
"offs",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"2",
";",
"i",
"<",
"arguments",
".",
"length",
";",
"i",
"++",
")",
"{",
"for",
"(",
"var",
"j",
"=",
"0",
";",
"j",
"<",
"arguments",
"[",
"i",
"]",
"... | helper functions for that ctx | [
"helper",
"functions",
"for",
"that",
"ctx"
] | 6a170a49c0ef1ea06ebf8007a9af52e275b80f1d | https://github.com/irislib/iris-lib/blob/6a170a49c0ef1ea06ebf8007a9af52e275b80f1d/dist/irisLib.js#L9148-L9154 |
15,381 | irislib/iris-lib | dist/irisLib.js | crc32 | function crc32(png, offs, size) {
var crc = -1;
for (var i = 4; i < size-4; i += 1) {
crc = _crc32[(crc ^ png[offs+i].charCodeAt(0)) & 0xff] ^ ((crc >> 8) & 0x00ffffff);
}
write(png, offs+size-4, byte4(crc ^ -1));
} | javascript | function crc32(png, offs, size) {
var crc = -1;
for (var i = 4; i < size-4; i += 1) {
crc = _crc32[(crc ^ png[offs+i].charCodeAt(0)) & 0xff] ^ ((crc >> 8) & 0x00ffffff);
}
write(png, offs+size-4, byte4(crc ^ -1));
} | [
"function",
"crc32",
"(",
"png",
",",
"offs",
",",
"size",
")",
"{",
"var",
"crc",
"=",
"-",
"1",
";",
"for",
"(",
"var",
"i",
"=",
"4",
";",
"i",
"<",
"size",
"-",
"4",
";",
"i",
"+=",
"1",
")",
"{",
"crc",
"=",
"_crc32",
"[",
"(",
"crc"... | compute crc32 of the PNG chunks | [
"compute",
"crc32",
"of",
"the",
"PNG",
"chunks"
] | 6a170a49c0ef1ea06ebf8007a9af52e275b80f1d | https://github.com/irislib/iris-lib/blob/6a170a49c0ef1ea06ebf8007a9af52e275b80f1d/dist/irisLib.js#L9322-L9328 |
15,382 | irislib/iris-lib | dist/irisLib.js | searchText | async function searchText(node, callback, query, limit) {
var cursor = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : '';
var desc = arguments[5];
var seen = {};
console.log('cursor', cursor, 'query', query, 'desc', desc);
var q = desc ? { '<': cursor, '-': desc } : { '>': cursor, '... | javascript | async function searchText(node, callback, query, limit) {
var cursor = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : '';
var desc = arguments[5];
var seen = {};
console.log('cursor', cursor, 'query', query, 'desc', desc);
var q = desc ? { '<': cursor, '-': desc } : { '>': cursor, '... | [
"async",
"function",
"searchText",
"(",
"node",
",",
"callback",
",",
"query",
",",
"limit",
")",
"{",
"var",
"cursor",
"=",
"arguments",
".",
"length",
">",
"4",
"&&",
"arguments",
"[",
"4",
"]",
"!==",
"undefined",
"?",
"arguments",
"[",
"4",
"]",
... | temp method for GUN search | [
"temp",
"method",
"for",
"GUN",
"search"
] | 6a170a49c0ef1ea06ebf8007a9af52e275b80f1d | https://github.com/irislib/iris-lib/blob/6a170a49c0ef1ea06ebf8007a9af52e275b80f1d/dist/irisLib.js#L10842-L10864 |
15,383 | Medium/medium-sdk-nodejs | lib/mediumClient.js | MediumClient | function MediumClient(options) {
this._enforce(options, ['clientId', 'clientSecret'])
this._clientId = options.clientId
this._clientSecret = options.clientSecret
this._accessToken = ""
} | javascript | function MediumClient(options) {
this._enforce(options, ['clientId', 'clientSecret'])
this._clientId = options.clientId
this._clientSecret = options.clientSecret
this._accessToken = ""
} | [
"function",
"MediumClient",
"(",
"options",
")",
"{",
"this",
".",
"_enforce",
"(",
"options",
",",
"[",
"'clientId'",
",",
"'clientSecret'",
"]",
")",
"this",
".",
"_clientId",
"=",
"options",
".",
"clientId",
"this",
".",
"_clientSecret",
"=",
"options",
... | The core client.
@param {{
clientId: string,
clientSecret: string
}} options
@constructor | [
"The",
"core",
"client",
"."
] | 63539084fb26f4c39f8c70f6baa599f866b38b9a | https://github.com/Medium/medium-sdk-nodejs/blob/63539084fb26f4c39f8c70f6baa599f866b38b9a/lib/mediumClient.js#L85-L90 |
15,384 | microlinkhq/metascraper | bench/index.js | getResults | function getResults () {
return getHtmls(URLS).then(htmls => {
return getScrapersResults(SCRAPERS, URLS, htmls).then(results => results)
})
} | javascript | function getResults () {
return getHtmls(URLS).then(htmls => {
return getScrapersResults(SCRAPERS, URLS, htmls).then(results => results)
})
} | [
"function",
"getResults",
"(",
")",
"{",
"return",
"getHtmls",
"(",
"URLS",
")",
".",
"then",
"(",
"htmls",
"=>",
"{",
"return",
"getScrapersResults",
"(",
"SCRAPERS",
",",
"URLS",
",",
"htmls",
")",
".",
"then",
"(",
"results",
"=>",
"results",
")",
"... | Get the metadata results.
@return {Promise} results | [
"Get",
"the",
"metadata",
"results",
"."
] | 0220c2a23351a97ba57f6d2a80c44da22f22b5f7 | https://github.com/microlinkhq/metascraper/blob/0220c2a23351a97ba57f6d2a80c44da22f22b5f7/bench/index.js#L47-L51 |
15,385 | microlinkhq/metascraper | bench/index.js | getScrapersResults | function getScrapersResults (SCRAPERS, urls, htmls) {
return Promise.all(
SCRAPERS.map(SCRAPER => {
return getScraperResults(SCRAPER, urls, htmls).then(results => {
return {
name: SCRAPER.name,
results: results
}
})
})
)
} | javascript | function getScrapersResults (SCRAPERS, urls, htmls) {
return Promise.all(
SCRAPERS.map(SCRAPER => {
return getScraperResults(SCRAPER, urls, htmls).then(results => {
return {
name: SCRAPER.name,
results: results
}
})
})
)
} | [
"function",
"getScrapersResults",
"(",
"SCRAPERS",
",",
"urls",
",",
"htmls",
")",
"{",
"return",
"Promise",
".",
"all",
"(",
"SCRAPERS",
".",
"map",
"(",
"SCRAPER",
"=>",
"{",
"return",
"getScraperResults",
"(",
"SCRAPER",
",",
"urls",
",",
"htmls",
")",
... | Get the metadata results from all `SCRAPERS` and `urls` and `htmls`.
@param {Array} SCRAPERS
@param {Array} urls
@param {Array} htmls
@return {Promise} results | [
"Get",
"the",
"metadata",
"results",
"from",
"all",
"SCRAPERS",
"and",
"urls",
"and",
"htmls",
"."
] | 0220c2a23351a97ba57f6d2a80c44da22f22b5f7 | https://github.com/microlinkhq/metascraper/blob/0220c2a23351a97ba57f6d2a80c44da22f22b5f7/bench/index.js#L62-L73 |
15,386 | microlinkhq/metascraper | bench/index.js | getScraperResults | function getScraperResults (SCRAPER, urls, htmls) {
return Promise.all(
urls.map((url, i) => {
const html = htmls[i]
const name = SCRAPER.name
const Module = require(name)
return SCRAPER.scrape(Module, url, html).then(metadata => {
return SCRAPER.normalize(metadata)
})
})... | javascript | function getScraperResults (SCRAPER, urls, htmls) {
return Promise.all(
urls.map((url, i) => {
const html = htmls[i]
const name = SCRAPER.name
const Module = require(name)
return SCRAPER.scrape(Module, url, html).then(metadata => {
return SCRAPER.normalize(metadata)
})
})... | [
"function",
"getScraperResults",
"(",
"SCRAPER",
",",
"urls",
",",
"htmls",
")",
"{",
"return",
"Promise",
".",
"all",
"(",
"urls",
".",
"map",
"(",
"(",
"url",
",",
"i",
")",
"=>",
"{",
"const",
"html",
"=",
"htmls",
"[",
"i",
"]",
"const",
"name"... | Get metadata results from a single `SCRAPER` and `urls` and `htmls`.
@param {Object} SCRAPER
@param {Array} urls
@param {Array} htmls
@return {Promise} results | [
"Get",
"metadata",
"results",
"from",
"a",
"single",
"SCRAPER",
"and",
"urls",
"and",
"htmls",
"."
] | 0220c2a23351a97ba57f6d2a80c44da22f22b5f7 | https://github.com/microlinkhq/metascraper/blob/0220c2a23351a97ba57f6d2a80c44da22f22b5f7/bench/index.js#L84-L95 |
15,387 | microlinkhq/metascraper | bench/index.js | getHtmls | function getHtmls (urls) {
return Promise.all(urls.map(url => got(url).then(res => res.body)))
} | javascript | function getHtmls (urls) {
return Promise.all(urls.map(url => got(url).then(res => res.body)))
} | [
"function",
"getHtmls",
"(",
"urls",
")",
"{",
"return",
"Promise",
".",
"all",
"(",
"urls",
".",
"map",
"(",
"url",
"=>",
"got",
"(",
"url",
")",
".",
"then",
"(",
"res",
"=>",
"res",
".",
"body",
")",
")",
")",
"}"
] | Get html from a list of `urls`.
@param {Array} urls
@return {Promise} htmls | [
"Get",
"html",
"from",
"a",
"list",
"of",
"urls",
"."
] | 0220c2a23351a97ba57f6d2a80c44da22f22b5f7 | https://github.com/microlinkhq/metascraper/blob/0220c2a23351a97ba57f6d2a80c44da22f22b5f7/bench/index.js#L104-L106 |
15,388 | jneen/parsimmon | src/parsimmon.js | union | function union(xs, ys) {
var obj = {};
for (var i = 0; i < xs.length; i++) {
obj[xs[i]] = true;
}
for (var j = 0; j < ys.length; j++) {
obj[ys[j]] = true;
}
var keys = [];
for (var k in obj) {
if ({}.hasOwnProperty.call(obj, k)) {
keys.push(k);
}
}
keys.sort();
return keys;
} | javascript | function union(xs, ys) {
var obj = {};
for (var i = 0; i < xs.length; i++) {
obj[xs[i]] = true;
}
for (var j = 0; j < ys.length; j++) {
obj[ys[j]] = true;
}
var keys = [];
for (var k in obj) {
if ({}.hasOwnProperty.call(obj, k)) {
keys.push(k);
}
}
keys.sort();
return keys;
} | [
"function",
"union",
"(",
"xs",
",",
"ys",
")",
"{",
"var",
"obj",
"=",
"{",
"}",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"xs",
".",
"length",
";",
"i",
"++",
")",
"{",
"obj",
"[",
"xs",
"[",
"i",
"]",
"]",
"=",
"true",
";... | Returns the sorted set union of two arrays of strings | [
"Returns",
"the",
"sorted",
"set",
"union",
"of",
"two",
"arrays",
"of",
"strings"
] | f71a73882383013628cdd87017ae1617c765cf93 | https://github.com/jneen/parsimmon/blob/f71a73882383013628cdd87017ae1617c765cf93/src/parsimmon.js#L379-L395 |
15,389 | jneen/parsimmon | src/parsimmon.js | rangeFromIndexAndOffsets | function rangeFromIndexAndOffsets(i, before, after, length) {
return {
// Guard against the negative upper bound for lines included in the output.
from: i - before > 0 ? i - before : 0,
to: i + after > length ? length : i + after
};
} | javascript | function rangeFromIndexAndOffsets(i, before, after, length) {
return {
// Guard against the negative upper bound for lines included in the output.
from: i - before > 0 ? i - before : 0,
to: i + after > length ? length : i + after
};
} | [
"function",
"rangeFromIndexAndOffsets",
"(",
"i",
",",
"before",
",",
"after",
",",
"length",
")",
"{",
"return",
"{",
"// Guard against the negative upper bound for lines included in the output.",
"from",
":",
"i",
"-",
"before",
">",
"0",
"?",
"i",
"-",
"before",
... | Get a range of indexes including `i`-th element and `before` and `after` amount of elements from `arr`. | [
"Get",
"a",
"range",
"of",
"indexes",
"including",
"i",
"-",
"th",
"element",
"and",
"before",
"and",
"after",
"amount",
"of",
"elements",
"from",
"arr",
"."
] | f71a73882383013628cdd87017ae1617c765cf93 | https://github.com/jneen/parsimmon/blob/f71a73882383013628cdd87017ae1617c765cf93/src/parsimmon.js#L504-L510 |
15,390 | jneen/parsimmon | examples/math.js | PREFIX | function PREFIX(operatorsParser, nextParser) {
let parser = P.lazy(() => {
return P.seq(operatorsParser, parser).or(nextParser);
});
return parser;
} | javascript | function PREFIX(operatorsParser, nextParser) {
let parser = P.lazy(() => {
return P.seq(operatorsParser, parser).or(nextParser);
});
return parser;
} | [
"function",
"PREFIX",
"(",
"operatorsParser",
",",
"nextParser",
")",
"{",
"let",
"parser",
"=",
"P",
".",
"lazy",
"(",
"(",
")",
"=>",
"{",
"return",
"P",
".",
"seq",
"(",
"operatorsParser",
",",
"parser",
")",
".",
"or",
"(",
"nextParser",
")",
";"... | Takes a parser for the prefix operator, and a parser for the base thing being parsed, and parses as many occurrences as possible of the prefix operator. Note that the parser is created using `P.lazy` because it's recursive. It's valid for there to be zero occurrences of the prefix operator. | [
"Takes",
"a",
"parser",
"for",
"the",
"prefix",
"operator",
"and",
"a",
"parser",
"for",
"the",
"base",
"thing",
"being",
"parsed",
"and",
"parses",
"as",
"many",
"occurrences",
"as",
"possible",
"of",
"the",
"prefix",
"operator",
".",
"Note",
"that",
"the... | f71a73882383013628cdd87017ae1617c765cf93 | https://github.com/jneen/parsimmon/blob/f71a73882383013628cdd87017ae1617c765cf93/examples/math.js#L43-L48 |
15,391 | ngReact/ngReact | ngReact.js | findAttribute | function findAttribute(attrs, propName) {
var index = Object.keys(attrs).filter(function (attr) {
return attr.toLowerCase() === propName.toLowerCase();
})[0];
return attrs[index];
} | javascript | function findAttribute(attrs, propName) {
var index = Object.keys(attrs).filter(function (attr) {
return attr.toLowerCase() === propName.toLowerCase();
})[0];
return attrs[index];
} | [
"function",
"findAttribute",
"(",
"attrs",
",",
"propName",
")",
"{",
"var",
"index",
"=",
"Object",
".",
"keys",
"(",
"attrs",
")",
".",
"filter",
"(",
"function",
"(",
"attr",
")",
"{",
"return",
"attr",
".",
"toLowerCase",
"(",
")",
"===",
"propName... | find the normalized attribute knowing that React props accept any type of capitalization | [
"find",
"the",
"normalized",
"attribute",
"knowing",
"that",
"React",
"props",
"accept",
"any",
"type",
"of",
"capitalization"
] | 5f91c2e6bc976eb1aca7517adb448e4f07ff5d98 | https://github.com/ngReact/ngReact/blob/5f91c2e6bc976eb1aca7517adb448e4f07ff5d98/ngReact.js#L162-L167 |
15,392 | ngReact/ngReact | ngReact.js | function() {
var scopeProps = {}, config = {};
props.forEach(function(prop) {
var propName = getPropName(prop);
scopeProps[propName] = scope.$eval(findAttribute(attrs, propName));
config[propName] = getPropConfig(prop);
});
scopeP... | javascript | function() {
var scopeProps = {}, config = {};
props.forEach(function(prop) {
var propName = getPropName(prop);
scopeProps[propName] = scope.$eval(findAttribute(attrs, propName));
config[propName] = getPropConfig(prop);
});
scopeP... | [
"function",
"(",
")",
"{",
"var",
"scopeProps",
"=",
"{",
"}",
",",
"config",
"=",
"{",
"}",
";",
"props",
".",
"forEach",
"(",
"function",
"(",
"prop",
")",
"{",
"var",
"propName",
"=",
"getPropName",
"(",
"prop",
")",
";",
"scopeProps",
"[",
"pro... | for each of the properties, get their scope value and set it to scope.props | [
"for",
"each",
"of",
"the",
"properties",
"get",
"their",
"scope",
"value",
"and",
"set",
"it",
"to",
"scope",
".",
"props"
] | 5f91c2e6bc976eb1aca7517adb448e4f07ff5d98 | https://github.com/ngReact/ngReact/blob/5f91c2e6bc976eb1aca7517adb448e4f07ff5d98/ngReact.js#L275-L285 | |
15,393 | marcelduran/webpagetest-api | lib/helper.js | netLogParser | function netLogParser(data) {
data = (data || '{}').toString();
if (data.slice(data.length - 3) === ',\r\n') {
data = data.slice(0, data.length - 3) + ']}';
}
return JSON.parse(data);
} | javascript | function netLogParser(data) {
data = (data || '{}').toString();
if (data.slice(data.length - 3) === ',\r\n') {
data = data.slice(0, data.length - 3) + ']}';
}
return JSON.parse(data);
} | [
"function",
"netLogParser",
"(",
"data",
")",
"{",
"data",
"=",
"(",
"data",
"||",
"'{}'",
")",
".",
"toString",
"(",
")",
";",
"if",
"(",
"data",
".",
"slice",
"(",
"data",
".",
"length",
"-",
"3",
")",
"===",
"',\\r\\n'",
")",
"{",
"data",
"=",... | Net log has a buggy end of file, attempt to fix | [
"Net",
"log",
"has",
"a",
"buggy",
"end",
"of",
"file",
"attempt",
"to",
"fix"
] | 9c4d4d89aa9637319bdc4d170211e19abafafda7 | https://github.com/marcelduran/webpagetest-api/blob/9c4d4d89aa9637319bdc4d170211e19abafafda7/lib/helper.js#L121-L128 |
15,394 | marcelduran/webpagetest-api | lib/helper.js | scriptToString | function scriptToString(data) {
var script = [];
data.forEach(function dataEach(step) {
var key, value;
if (typeof step === 'string') {
script.push(step);
} else if (typeof step === 'object') {
key = [Object.keys(step)[0]];
value = step[key];
if (value !== undefined && value !=... | javascript | function scriptToString(data) {
var script = [];
data.forEach(function dataEach(step) {
var key, value;
if (typeof step === 'string') {
script.push(step);
} else if (typeof step === 'object') {
key = [Object.keys(step)[0]];
value = step[key];
if (value !== undefined && value !=... | [
"function",
"scriptToString",
"(",
"data",
")",
"{",
"var",
"script",
"=",
"[",
"]",
";",
"data",
".",
"forEach",
"(",
"function",
"dataEach",
"(",
"step",
")",
"{",
"var",
"key",
",",
"value",
";",
"if",
"(",
"typeof",
"step",
"===",
"'string'",
")"... | Convert script objects into formatted string | [
"Convert",
"script",
"objects",
"into",
"formatted",
"string"
] | 9c4d4d89aa9637319bdc4d170211e19abafafda7 | https://github.com/marcelduran/webpagetest-api/blob/9c4d4d89aa9637319bdc4d170211e19abafafda7/lib/helper.js#L136-L155 |
15,395 | marcelduran/webpagetest-api | lib/helper.js | dryRun | function dryRun(config, path) {
path = url.parse(path, true);
return {
url: url.format({
protocol: config.protocol,
hostname: config.hostname,
port: (config.port !== 80 && config.port !== 443 ?
config.port : undefined),
pathname: path.pathname,
query: path.query
})
}... | javascript | function dryRun(config, path) {
path = url.parse(path, true);
return {
url: url.format({
protocol: config.protocol,
hostname: config.hostname,
port: (config.port !== 80 && config.port !== 443 ?
config.port : undefined),
pathname: path.pathname,
query: path.query
})
}... | [
"function",
"dryRun",
"(",
"config",
",",
"path",
")",
"{",
"path",
"=",
"url",
".",
"parse",
"(",
"path",
",",
"true",
")",
";",
"return",
"{",
"url",
":",
"url",
".",
"format",
"(",
"{",
"protocol",
":",
"config",
".",
"protocol",
",",
"hostname"... | Build the RESTful API url call only | [
"Build",
"the",
"RESTful",
"API",
"url",
"call",
"only"
] | 9c4d4d89aa9637319bdc4d170211e19abafafda7 | https://github.com/marcelduran/webpagetest-api/blob/9c4d4d89aa9637319bdc4d170211e19abafafda7/lib/helper.js#L158-L171 |
15,396 | marcelduran/webpagetest-api | lib/helper.js | normalizeServer | function normalizeServer(server) {
// normalize hostname
if (!reProtocol.test(server)) {
server = 'http://' + server;
}
server = url.parse(server);
return {
protocol: server.protocol,
hostname: server.hostname,
auth: server.auth,
pathname: server.pathname,
port: parseInt(server.port, ... | javascript | function normalizeServer(server) {
// normalize hostname
if (!reProtocol.test(server)) {
server = 'http://' + server;
}
server = url.parse(server);
return {
protocol: server.protocol,
hostname: server.hostname,
auth: server.auth,
pathname: server.pathname,
port: parseInt(server.port, ... | [
"function",
"normalizeServer",
"(",
"server",
")",
"{",
"// normalize hostname",
"if",
"(",
"!",
"reProtocol",
".",
"test",
"(",
"server",
")",
")",
"{",
"server",
"=",
"'http://'",
"+",
"server",
";",
"}",
"server",
"=",
"url",
".",
"parse",
"(",
"serve... | Normalize server config | [
"Normalize",
"server",
"config"
] | 9c4d4d89aa9637319bdc4d170211e19abafafda7 | https://github.com/marcelduran/webpagetest-api/blob/9c4d4d89aa9637319bdc4d170211e19abafafda7/lib/helper.js#L174-L188 |
15,397 | marcelduran/webpagetest-api | lib/helper.js | localhost | function localhost(local, defaultPort) {
// edge case when hostname:port is not informed via cli
if (local === undefined || local === 'true') {
local = [defaultPort];
} else {
local = local.toString().split(':');
}
return {
hostname: reIp.test(local[0]) || isNaN(parseInt(local[0], 10)) &&
l... | javascript | function localhost(local, defaultPort) {
// edge case when hostname:port is not informed via cli
if (local === undefined || local === 'true') {
local = [defaultPort];
} else {
local = local.toString().split(':');
}
return {
hostname: reIp.test(local[0]) || isNaN(parseInt(local[0], 10)) &&
l... | [
"function",
"localhost",
"(",
"local",
",",
"defaultPort",
")",
"{",
"// edge case when hostname:port is not informed via cli",
"if",
"(",
"local",
"===",
"undefined",
"||",
"local",
"===",
"'true'",
")",
"{",
"local",
"=",
"[",
"defaultPort",
"]",
";",
"}",
"el... | Normalize localhost and port | [
"Normalize",
"localhost",
"and",
"port"
] | 9c4d4d89aa9637319bdc4d170211e19abafafda7 | https://github.com/marcelduran/webpagetest-api/blob/9c4d4d89aa9637319bdc4d170211e19abafafda7/lib/helper.js#L191-L205 |
15,398 | marcelduran/webpagetest-api | lib/helper.js | setQuery | function setQuery(map, options, query) {
query = query || {};
options = options || {};
map.options.forEach(function eachOpts(opt) {
Object.keys(opt).forEach(function eachOpt(key) {
var param = opt[key],
name = param.name,
value = options[name] || options[key];
if (value !== u... | javascript | function setQuery(map, options, query) {
query = query || {};
options = options || {};
map.options.forEach(function eachOpts(opt) {
Object.keys(opt).forEach(function eachOpt(key) {
var param = opt[key],
name = param.name,
value = options[name] || options[key];
if (value !== u... | [
"function",
"setQuery",
"(",
"map",
",",
"options",
",",
"query",
")",
"{",
"query",
"=",
"query",
"||",
"{",
"}",
";",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"map",
".",
"options",
".",
"forEach",
"(",
"function",
"eachOpts",
"(",
"opt",
... | Set valid parameter in query | [
"Set",
"valid",
"parameter",
"in",
"query"
] | 9c4d4d89aa9637319bdc4d170211e19abafafda7 | https://github.com/marcelduran/webpagetest-api/blob/9c4d4d89aa9637319bdc4d170211e19abafafda7/lib/helper.js#L217-L238 |
15,399 | marcelduran/webpagetest-api | lib/mapping.js | setOptions | function setOptions(command, query) {
var count, opts;
command = commands[command];
if (!command) {
return;
}
opts = {};
count = Object.keys(query).length;
[options.common].concat(command.options).some(function someTypes(options) {
if (!options) {
return;
}
Object.keys(options).so... | javascript | function setOptions(command, query) {
var count, opts;
command = commands[command];
if (!command) {
return;
}
opts = {};
count = Object.keys(query).length;
[options.common].concat(command.options).some(function someTypes(options) {
if (!options) {
return;
}
Object.keys(options).so... | [
"function",
"setOptions",
"(",
"command",
",",
"query",
")",
"{",
"var",
"count",
",",
"opts",
";",
"command",
"=",
"commands",
"[",
"command",
"]",
";",
"if",
"(",
"!",
"command",
")",
"{",
"return",
";",
"}",
"opts",
"=",
"{",
"}",
";",
"count",
... | set valid options only per command | [
"set",
"valid",
"options",
"only",
"per",
"command"
] | 9c4d4d89aa9637319bdc4d170211e19abafafda7 | https://github.com/marcelduran/webpagetest-api/blob/9c4d4d89aa9637319bdc4d170211e19abafafda7/lib/mapping.js#L837-L871 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.