repo stringlengths 5 67 | path stringlengths 4 116 | func_name stringlengths 0 58 | original_string stringlengths 52 373k | language stringclasses 1
value | code stringlengths 52 373k | code_tokens list | docstring stringlengths 4 11.8k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 86 226 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
smoketurner/serverless-vpc-plugin | src/flow_logs.js | buildLogBucketPolicy | function buildLogBucketPolicy() {
return {
LogBucketPolicy: {
Type: 'AWS::S3::BucketPolicy',
Properties: {
Bucket: {
Ref: 'LogBucket',
},
PolicyDocument: {
Version: '2012-10-17',
Statement: [
{
Sid: 'AWSLogDeliveryAclCheck... | javascript | function buildLogBucketPolicy() {
return {
LogBucketPolicy: {
Type: 'AWS::S3::BucketPolicy',
Properties: {
Bucket: {
Ref: 'LogBucket',
},
PolicyDocument: {
Version: '2012-10-17',
Statement: [
{
Sid: 'AWSLogDeliveryAclCheck... | [
"function",
"buildLogBucketPolicy",
"(",
")",
"{",
"return",
"{",
"LogBucketPolicy",
":",
"{",
"Type",
":",
"'AWS::S3::BucketPolicy'",
",",
"Properties",
":",
"{",
"Bucket",
":",
"{",
"Ref",
":",
"'LogBucket'",
",",
"}",
",",
"PolicyDocument",
":",
"{",
"Ver... | Build an S3 Bucket Policy for the logging bucket
@return {Object}
@see https://docs.aws.amazon.com/vpc/latest/userguide/flow-logs-s3.html#flow-logs-s3-permissions | [
"Build",
"an",
"S3",
"Bucket",
"Policy",
"for",
"the",
"logging",
"bucket"
] | 21a862ac01cc14fc5699fc9d7978bd736622cc1d | https://github.com/smoketurner/serverless-vpc-plugin/blob/21a862ac01cc14fc5699fc9d7978bd736622cc1d/src/flow_logs.js#L47-L99 | train |
smoketurner/serverless-vpc-plugin | src/flow_logs.js | buildVpcFlowLogs | function buildVpcFlowLogs({ name = 'S3FlowLog' } = {}) {
return {
[name]: {
Type: 'AWS::EC2::FlowLog',
DependsOn: 'LogBucketPolicy',
Properties: {
LogDestinationType: 's3',
LogDestination: {
'Fn::GetAtt': ['LogBucket', 'Arn'],
},
ResourceId: {
... | javascript | function buildVpcFlowLogs({ name = 'S3FlowLog' } = {}) {
return {
[name]: {
Type: 'AWS::EC2::FlowLog',
DependsOn: 'LogBucketPolicy',
Properties: {
LogDestinationType: 's3',
LogDestination: {
'Fn::GetAtt': ['LogBucket', 'Arn'],
},
ResourceId: {
... | [
"function",
"buildVpcFlowLogs",
"(",
"{",
"name",
"=",
"'S3FlowLog'",
"}",
"=",
"{",
"}",
")",
"{",
"return",
"{",
"[",
"name",
"]",
":",
"{",
"Type",
":",
"'AWS::EC2::FlowLog'",
",",
"DependsOn",
":",
"'LogBucketPolicy'",
",",
"Properties",
":",
"{",
"L... | Build a VPC FlowLog definition that logs to an S3 bucket
@param {Object} params
@return {Object} | [
"Build",
"a",
"VPC",
"FlowLog",
"definition",
"that",
"logs",
"to",
"an",
"S3",
"bucket"
] | 21a862ac01cc14fc5699fc9d7978bd736622cc1d | https://github.com/smoketurner/serverless-vpc-plugin/blob/21a862ac01cc14fc5699fc9d7978bd736622cc1d/src/flow_logs.js#L107-L125 | train |
smoketurner/serverless-vpc-plugin | src/nacl.js | buildNetworkAclEntry | function buildNetworkAclEntry(
name,
CidrBlock,
{ Egress = false, Protocol = -1, RuleAction = 'allow', RuleNumber = 100 } = {},
) {
const direction = Egress ? 'Egress' : 'Ingress';
const cfName = `${name}${direction}${RuleNumber}`;
return {
[cfName]: {
Type: 'AWS::EC2::NetworkAclEntry',
Prop... | javascript | function buildNetworkAclEntry(
name,
CidrBlock,
{ Egress = false, Protocol = -1, RuleAction = 'allow', RuleNumber = 100 } = {},
) {
const direction = Egress ? 'Egress' : 'Ingress';
const cfName = `${name}${direction}${RuleNumber}`;
return {
[cfName]: {
Type: 'AWS::EC2::NetworkAclEntry',
Prop... | [
"function",
"buildNetworkAclEntry",
"(",
"name",
",",
"CidrBlock",
",",
"{",
"Egress",
"=",
"false",
",",
"Protocol",
"=",
"-",
"1",
",",
"RuleAction",
"=",
"'allow'",
",",
"RuleNumber",
"=",
"100",
"}",
"=",
"{",
"}",
",",
")",
"{",
"const",
"directio... | Build a Network ACL entry
@param {String} name
@param {String} CidrBlock
@param {Object} params
@return {Object} | [
"Build",
"a",
"Network",
"ACL",
"entry"
] | 21a862ac01cc14fc5699fc9d7978bd736622cc1d | https://github.com/smoketurner/serverless-vpc-plugin/blob/21a862ac01cc14fc5699fc9d7978bd736622cc1d/src/nacl.js#L48-L70 | train |
smoketurner/serverless-vpc-plugin | src/nacl.js | buildNetworkAclAssociation | function buildNetworkAclAssociation(name, position) {
const cfName = `${name}SubnetNetworkAclAssociation${position}`;
return {
[cfName]: {
Type: 'AWS::EC2::SubnetNetworkAclAssociation',
Properties: {
SubnetId: {
Ref: `${name}Subnet${position}`,
},
NetworkAclId: {
... | javascript | function buildNetworkAclAssociation(name, position) {
const cfName = `${name}SubnetNetworkAclAssociation${position}`;
return {
[cfName]: {
Type: 'AWS::EC2::SubnetNetworkAclAssociation',
Properties: {
SubnetId: {
Ref: `${name}Subnet${position}`,
},
NetworkAclId: {
... | [
"function",
"buildNetworkAclAssociation",
"(",
"name",
",",
"position",
")",
"{",
"const",
"cfName",
"=",
"`",
"${",
"name",
"}",
"${",
"position",
"}",
"`",
";",
"return",
"{",
"[",
"cfName",
"]",
":",
"{",
"Type",
":",
"'AWS::EC2::SubnetNetworkAclAssociati... | Build a Subnet Network ACL Association
@param {String} name
@param {Number} position | [
"Build",
"a",
"Subnet",
"Network",
"ACL",
"Association"
] | 21a862ac01cc14fc5699fc9d7978bd736622cc1d | https://github.com/smoketurner/serverless-vpc-plugin/blob/21a862ac01cc14fc5699fc9d7978bd736622cc1d/src/nacl.js#L78-L93 | train |
smoketurner/serverless-vpc-plugin | src/nacl.js | buildPublicNetworkAcl | function buildPublicNetworkAcl(numZones = 0) {
if (numZones < 1) {
return {};
}
const resources = {};
Object.assign(
resources,
buildNetworkAcl(PUBLIC_SUBNET),
buildNetworkAclEntry(`${PUBLIC_SUBNET}NetworkAcl`, '0.0.0.0/0'),
buildNetworkAclEntry(`${PUBLIC_SUBNET}NetworkAcl`, '0.0.0.0/0', {... | javascript | function buildPublicNetworkAcl(numZones = 0) {
if (numZones < 1) {
return {};
}
const resources = {};
Object.assign(
resources,
buildNetworkAcl(PUBLIC_SUBNET),
buildNetworkAclEntry(`${PUBLIC_SUBNET}NetworkAcl`, '0.0.0.0/0'),
buildNetworkAclEntry(`${PUBLIC_SUBNET}NetworkAcl`, '0.0.0.0/0', {... | [
"function",
"buildPublicNetworkAcl",
"(",
"numZones",
"=",
"0",
")",
"{",
"if",
"(",
"numZones",
"<",
"1",
")",
"{",
"return",
"{",
"}",
";",
"}",
"const",
"resources",
"=",
"{",
"}",
";",
"Object",
".",
"assign",
"(",
"resources",
",",
"buildNetworkAc... | Build the Public Network ACL
@param {Number} numZones Number of availability zones | [
"Build",
"the",
"Public",
"Network",
"ACL"
] | 21a862ac01cc14fc5699fc9d7978bd736622cc1d | https://github.com/smoketurner/serverless-vpc-plugin/blob/21a862ac01cc14fc5699fc9d7978bd736622cc1d/src/nacl.js#L100-L121 | train |
smoketurner/serverless-vpc-plugin | src/nacl.js | buildAppNetworkAcl | function buildAppNetworkAcl(numZones = 0) {
if (numZones < 1) {
return {};
}
const resources = {};
Object.assign(
resources,
buildNetworkAcl(APP_SUBNET),
buildNetworkAclEntry(`${APP_SUBNET}NetworkAcl`, '0.0.0.0/0'),
buildNetworkAclEntry(`${APP_SUBNET}NetworkAcl`, '0.0.0.0/0', {
Egres... | javascript | function buildAppNetworkAcl(numZones = 0) {
if (numZones < 1) {
return {};
}
const resources = {};
Object.assign(
resources,
buildNetworkAcl(APP_SUBNET),
buildNetworkAclEntry(`${APP_SUBNET}NetworkAcl`, '0.0.0.0/0'),
buildNetworkAclEntry(`${APP_SUBNET}NetworkAcl`, '0.0.0.0/0', {
Egres... | [
"function",
"buildAppNetworkAcl",
"(",
"numZones",
"=",
"0",
")",
"{",
"if",
"(",
"numZones",
"<",
"1",
")",
"{",
"return",
"{",
"}",
";",
"}",
"const",
"resources",
"=",
"{",
"}",
";",
"Object",
".",
"assign",
"(",
"resources",
",",
"buildNetworkAcl",... | Build the Application Network ACL
@param {Number} numZones Number of availability zones | [
"Build",
"the",
"Application",
"Network",
"ACL"
] | 21a862ac01cc14fc5699fc9d7978bd736622cc1d | https://github.com/smoketurner/serverless-vpc-plugin/blob/21a862ac01cc14fc5699fc9d7978bd736622cc1d/src/nacl.js#L128-L149 | train |
smoketurner/serverless-vpc-plugin | src/nacl.js | buildDBNetworkAcl | function buildDBNetworkAcl(appSubnets = []) {
if (!Array.isArray(appSubnets) || appSubnets.length < 1) {
return {};
}
const resources = buildNetworkAcl(DB_SUBNET);
appSubnets.forEach((subnet, index) => {
Object.assign(
resources,
buildNetworkAclEntry(`${DB_SUBNET}NetworkAcl`, subnet, {
... | javascript | function buildDBNetworkAcl(appSubnets = []) {
if (!Array.isArray(appSubnets) || appSubnets.length < 1) {
return {};
}
const resources = buildNetworkAcl(DB_SUBNET);
appSubnets.forEach((subnet, index) => {
Object.assign(
resources,
buildNetworkAclEntry(`${DB_SUBNET}NetworkAcl`, subnet, {
... | [
"function",
"buildDBNetworkAcl",
"(",
"appSubnets",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"Array",
".",
"isArray",
"(",
"appSubnets",
")",
"||",
"appSubnets",
".",
"length",
"<",
"1",
")",
"{",
"return",
"{",
"}",
";",
"}",
"const",
"resources",
"... | Build the Database Network ACL
@param {Array} appSubnets Array of application subnets | [
"Build",
"the",
"Database",
"Network",
"ACL"
] | 21a862ac01cc14fc5699fc9d7978bd736622cc1d | https://github.com/smoketurner/serverless-vpc-plugin/blob/21a862ac01cc14fc5699fc9d7978bd736622cc1d/src/nacl.js#L156-L178 | train |
smoketurner/serverless-vpc-plugin | src/vpce.js | buildVPCEndpoint | function buildVPCEndpoint(service, { routeTableIds = [], subnetIds = [] } = {}) {
const endpoint = {
Type: 'AWS::EC2::VPCEndpoint',
Properties: {
ServiceName: {
'Fn::Join': [
'.',
[
'com.amazonaws',
{
Ref: 'AWS::Region',
},
... | javascript | function buildVPCEndpoint(service, { routeTableIds = [], subnetIds = [] } = {}) {
const endpoint = {
Type: 'AWS::EC2::VPCEndpoint',
Properties: {
ServiceName: {
'Fn::Join': [
'.',
[
'com.amazonaws',
{
Ref: 'AWS::Region',
},
... | [
"function",
"buildVPCEndpoint",
"(",
"service",
",",
"{",
"routeTableIds",
"=",
"[",
"]",
",",
"subnetIds",
"=",
"[",
"]",
"}",
"=",
"{",
"}",
")",
"{",
"const",
"endpoint",
"=",
"{",
"Type",
":",
"'AWS::EC2::VPCEndpoint'",
",",
"Properties",
":",
"{",
... | Build a VPCEndpoint
@param {String} service
@param {Object} params
@return {Object} | [
"Build",
"a",
"VPCEndpoint"
] | 21a862ac01cc14fc5699fc9d7978bd736622cc1d | https://github.com/smoketurner/serverless-vpc-plugin/blob/21a862ac01cc14fc5699fc9d7978bd736622cc1d/src/vpce.js#L10-L80 | train |
smoketurner/serverless-vpc-plugin | src/vpce.js | buildEndpointServices | function buildEndpointServices(services = [], numZones = 0) {
if (!Array.isArray(services) || services.length < 1) {
return {};
}
if (numZones < 1) {
return {};
}
const subnetIds = [];
const routeTableIds = [];
for (let i = 1; i <= numZones; i += 1) {
subnetIds.push({ Ref: `${APP_SUBNET}Subne... | javascript | function buildEndpointServices(services = [], numZones = 0) {
if (!Array.isArray(services) || services.length < 1) {
return {};
}
if (numZones < 1) {
return {};
}
const subnetIds = [];
const routeTableIds = [];
for (let i = 1; i <= numZones; i += 1) {
subnetIds.push({ Ref: `${APP_SUBNET}Subne... | [
"function",
"buildEndpointServices",
"(",
"services",
"=",
"[",
"]",
",",
"numZones",
"=",
"0",
")",
"{",
"if",
"(",
"!",
"Array",
".",
"isArray",
"(",
"services",
")",
"||",
"services",
".",
"length",
"<",
"1",
")",
"{",
"return",
"{",
"}",
";",
"... | Build VPC endpoints for a given number of services and zones
@param {Array} services Array of VPC endpoint services
@param {Number} numZones Number of availability zones
@return {Object} | [
"Build",
"VPC",
"endpoints",
"for",
"a",
"given",
"number",
"of",
"services",
"and",
"zones"
] | 21a862ac01cc14fc5699fc9d7978bd736622cc1d | https://github.com/smoketurner/serverless-vpc-plugin/blob/21a862ac01cc14fc5699fc9d7978bd736622cc1d/src/vpce.js#L89-L110 | train |
smoketurner/serverless-vpc-plugin | src/vpce.js | buildLambdaVPCEndpointSecurityGroup | function buildLambdaVPCEndpointSecurityGroup({ name = 'LambdaEndpointSecurityGroup' } = {}) {
return {
[name]: {
Type: 'AWS::EC2::SecurityGroup',
Properties: {
GroupDescription: 'Lambda access to VPC endpoints',
VpcId: {
Ref: 'VPC',
},
SecurityGroupIngress: [
... | javascript | function buildLambdaVPCEndpointSecurityGroup({ name = 'LambdaEndpointSecurityGroup' } = {}) {
return {
[name]: {
Type: 'AWS::EC2::SecurityGroup',
Properties: {
GroupDescription: 'Lambda access to VPC endpoints',
VpcId: {
Ref: 'VPC',
},
SecurityGroupIngress: [
... | [
"function",
"buildLambdaVPCEndpointSecurityGroup",
"(",
"{",
"name",
"=",
"'LambdaEndpointSecurityGroup'",
"}",
"=",
"{",
"}",
")",
"{",
"return",
"{",
"[",
"name",
"]",
":",
"{",
"Type",
":",
"'AWS::EC2::SecurityGroup'",
",",
"Properties",
":",
"{",
"GroupDescr... | Build a SecurityGroup to allow the Lambda's access to VPC endpoints over HTTPS.
@param {Object} params
@return {Object} | [
"Build",
"a",
"SecurityGroup",
"to",
"allow",
"the",
"Lambda",
"s",
"access",
"to",
"VPC",
"endpoints",
"over",
"HTTPS",
"."
] | 21a862ac01cc14fc5699fc9d7978bd736622cc1d | https://github.com/smoketurner/serverless-vpc-plugin/blob/21a862ac01cc14fc5699fc9d7978bd736622cc1d/src/vpce.js#L118-L157 | train |
smoketurner/serverless-vpc-plugin | src/outputs.js | buildOutputs | function buildOutputs(createBastionHost = false) {
const outputs = {
VPC: {
Description: 'VPC logical resource ID',
Value: {
Ref: 'VPC',
},
},
LambdaExecutionSecurityGroupId: {
Description:
'Security Group logical resource ID that the Lambda functions use when execu... | javascript | function buildOutputs(createBastionHost = false) {
const outputs = {
VPC: {
Description: 'VPC logical resource ID',
Value: {
Ref: 'VPC',
},
},
LambdaExecutionSecurityGroupId: {
Description:
'Security Group logical resource ID that the Lambda functions use when execu... | [
"function",
"buildOutputs",
"(",
"createBastionHost",
"=",
"false",
")",
"{",
"const",
"outputs",
"=",
"{",
"VPC",
":",
"{",
"Description",
":",
"'VPC logical resource ID'",
",",
"Value",
":",
"{",
"Ref",
":",
"'VPC'",
",",
"}",
",",
"}",
",",
"LambdaExecu... | Build CloudFormation Outputs on common resources
@param {Boolean} createBastionHost
@return {Object} | [
"Build",
"CloudFormation",
"Outputs",
"on",
"common",
"resources"
] | 21a862ac01cc14fc5699fc9d7978bd736622cc1d | https://github.com/smoketurner/serverless-vpc-plugin/blob/21a862ac01cc14fc5699fc9d7978bd736622cc1d/src/outputs.js#L7-L38 | train |
vm-component/vimo | build/doc-builder/theme/fixtures/documents/probe.js | processNestedOperator | function processNestedOperator( path, operand ) {
var opKeys = Object.keys( operand );
return {
operation : opKeys[ 0 ],
operands : [operand[ opKeys[ 0 ] ]],
path : path
};
} | javascript | function processNestedOperator( path, operand ) {
var opKeys = Object.keys( operand );
return {
operation : opKeys[ 0 ],
operands : [operand[ opKeys[ 0 ] ]],
path : path
};
} | [
"function",
"processNestedOperator",
"(",
"path",
",",
"operand",
")",
"{",
"var",
"opKeys",
"=",
"Object",
".",
"keys",
"(",
"operand",
")",
";",
"return",
"{",
"operation",
":",
"opKeys",
"[",
"0",
"]",
",",
"operands",
":",
"[",
"operand",
"[",
"opK... | Processes a nested operator by picking the operator out of the expression object. Returns a formatted object that can be used for querying
@private
@param {string} path The path to element to work with
@param {object} operand The operands to use for the query
@return {object} A formatted operation definition | [
"Processes",
"a",
"nested",
"operator",
"by",
"picking",
"the",
"operator",
"out",
"of",
"the",
"expression",
"object",
".",
"Returns",
"a",
"formatted",
"object",
"that",
"can",
"be",
"used",
"for",
"querying"
] | 52b4f66fd3f1d244e8e6b72f9d0fa7aa675c78a7 | https://github.com/vm-component/vimo/blob/52b4f66fd3f1d244e8e6b72f9d0fa7aa675c78a7/build/doc-builder/theme/fixtures/documents/probe.js#L33-L40 | train |
vm-component/vimo | build/doc-builder/theme/fixtures/documents/probe.js | processExpressionObject | function processExpressionObject( val, key ) {
var operator;
if ( sys.isObject( val ) ) {
var opKeys = Object.keys( val );
var op = opKeys[ 0 ];
if ( sys.indexOf( nestedOps, op ) > -1 ) {
operator = processNestedOperator( key, val );
} else if ( sys.indexOf( prefixOps, key ) > -1 ) {
operator = process... | javascript | function processExpressionObject( val, key ) {
var operator;
if ( sys.isObject( val ) ) {
var opKeys = Object.keys( val );
var op = opKeys[ 0 ];
if ( sys.indexOf( nestedOps, op ) > -1 ) {
operator = processNestedOperator( key, val );
} else if ( sys.indexOf( prefixOps, key ) > -1 ) {
operator = process... | [
"function",
"processExpressionObject",
"(",
"val",
",",
"key",
")",
"{",
"var",
"operator",
";",
"if",
"(",
"sys",
".",
"isObject",
"(",
"val",
")",
")",
"{",
"var",
"opKeys",
"=",
"Object",
".",
"keys",
"(",
"val",
")",
";",
"var",
"op",
"=",
"opK... | Interrogates a single query expression object and calls the appropriate handler for its contents
@private
@param {object} val The expression
@param {object} key The prefix
@returns {object} A formatted operation definition | [
"Interrogates",
"a",
"single",
"query",
"expression",
"object",
"and",
"calls",
"the",
"appropriate",
"handler",
"for",
"its",
"contents"
] | 52b4f66fd3f1d244e8e6b72f9d0fa7aa675c78a7 | https://github.com/vm-component/vimo/blob/52b4f66fd3f1d244e8e6b72f9d0fa7aa675c78a7/build/doc-builder/theme/fixtures/documents/probe.js#L49-L80 | train |
vm-component/vimo | build/doc-builder/theme/fixtures/documents/probe.js | processPrefixOperator | function processPrefixOperator( operation, operand ) {
var component = {
operation : operation,
path : null,
operands : []
};
if ( sys.isArray( operand ) ) {
//if it is an array we need to loop through the array and parse each operand
//if it is an array we need to loop through the array and parse e... | javascript | function processPrefixOperator( operation, operand ) {
var component = {
operation : operation,
path : null,
operands : []
};
if ( sys.isArray( operand ) ) {
//if it is an array we need to loop through the array and parse each operand
//if it is an array we need to loop through the array and parse e... | [
"function",
"processPrefixOperator",
"(",
"operation",
",",
"operand",
")",
"{",
"var",
"component",
"=",
"{",
"operation",
":",
"operation",
",",
"path",
":",
"null",
",",
"operands",
":",
"[",
"]",
"}",
";",
"if",
"(",
"sys",
".",
"isArray",
"(",
"op... | Processes a prefixed operator and then passes control to the nested operator method to pick out the contained values
@private
@param {string} operation The operation prefix
@param {object} operand The operands to use for the query
@return {object} A formatted operation definition | [
"Processes",
"a",
"prefixed",
"operator",
"and",
"then",
"passes",
"control",
"to",
"the",
"nested",
"operator",
"method",
"to",
"pick",
"out",
"the",
"contained",
"values"
] | 52b4f66fd3f1d244e8e6b72f9d0fa7aa675c78a7 | https://github.com/vm-component/vimo/blob/52b4f66fd3f1d244e8e6b72f9d0fa7aa675c78a7/build/doc-builder/theme/fixtures/documents/probe.js#L89-L112 | train |
vm-component/vimo | build/doc-builder/theme/fixtures/documents/probe.js | parseQueryExpression | function parseQueryExpression( obj ) {
if ( sys.size( obj ) > 1 ) {
var arr = sys.map( obj, function ( v, k ) {
var entry = {};
entry[k] = v;
return entry;
} );
obj = {
$and : arr
};
}
var payload = [];
sys.each( obj, function ( val, key ) {
var exprObj = processExpressionObject( val, key );
... | javascript | function parseQueryExpression( obj ) {
if ( sys.size( obj ) > 1 ) {
var arr = sys.map( obj, function ( v, k ) {
var entry = {};
entry[k] = v;
return entry;
} );
obj = {
$and : arr
};
}
var payload = [];
sys.each( obj, function ( val, key ) {
var exprObj = processExpressionObject( val, key );
... | [
"function",
"parseQueryExpression",
"(",
"obj",
")",
"{",
"if",
"(",
"sys",
".",
"size",
"(",
"obj",
")",
">",
"1",
")",
"{",
"var",
"arr",
"=",
"sys",
".",
"map",
"(",
"obj",
",",
"function",
"(",
"v",
",",
"k",
")",
"{",
"var",
"entry",
"=",
... | Parses a query request and builds an object that can used to process a query target
@private
@param {object} obj The expression object
@returns {object} All components of the expression in a kind of execution tree | [
"Parses",
"a",
"query",
"request",
"and",
"builds",
"an",
"object",
"that",
"can",
"used",
"to",
"process",
"a",
"query",
"target"
] | 52b4f66fd3f1d244e8e6b72f9d0fa7aa675c78a7 | https://github.com/vm-component/vimo/blob/52b4f66fd3f1d244e8e6b72f9d0fa7aa675c78a7/build/doc-builder/theme/fixtures/documents/probe.js#L121-L145 | train |
vm-component/vimo | build/doc-builder/theme/fixtures/documents/probe.js | reachin | function reachin( path, record ) {
var context = record;
var part;
var _i;
var _len;
for ( _i = 0, _len = path.length; _i < _len; _i++ ) {
part = path[_i];
context = context[part];
if ( sys.isNull( context ) || sys.isUndefined( context ) ) {
break;
}
}
return context;
} | javascript | function reachin( path, record ) {
var context = record;
var part;
var _i;
var _len;
for ( _i = 0, _len = path.length; _i < _len; _i++ ) {
part = path[_i];
context = context[part];
if ( sys.isNull( context ) || sys.isUndefined( context ) ) {
break;
}
}
return context;
} | [
"function",
"reachin",
"(",
"path",
",",
"record",
")",
"{",
"var",
"context",
"=",
"record",
";",
"var",
"part",
";",
"var",
"_i",
";",
"var",
"_len",
";",
"for",
"(",
"_i",
"=",
"0",
",",
"_len",
"=",
"path",
".",
"length",
";",
"_i",
"<",
"_... | Reaches into an object and allows you to get at a value deeply nested in an object
@private
@param {array} path The split path of the element to work with
@param {object} record The record to reach into
@return {*} Whatever was found in the record | [
"Reaches",
"into",
"an",
"object",
"and",
"allows",
"you",
"to",
"get",
"at",
"a",
"value",
"deeply",
"nested",
"in",
"an",
"object"
] | 52b4f66fd3f1d244e8e6b72f9d0fa7aa675c78a7 | https://github.com/vm-component/vimo/blob/52b4f66fd3f1d244e8e6b72f9d0fa7aa675c78a7/build/doc-builder/theme/fixtures/documents/probe.js#L174-L189 | train |
vm-component/vimo | build/doc-builder/theme/fixtures/documents/probe.js | execQuery | function execQuery( obj, qu, shortCircuit, stopOnFirst ) {
var arrayResults = [];
var keyResults = [];
sys.each( obj, function ( record, key ) {
var expr, result, test, _i, _len;
for ( _i = 0, _len = qu.length; _i < _len; _i++ ) {
expr = qu[_i];
if ( expr.splitPath ) {
test = reachin( expr.splitPath, ... | javascript | function execQuery( obj, qu, shortCircuit, stopOnFirst ) {
var arrayResults = [];
var keyResults = [];
sys.each( obj, function ( record, key ) {
var expr, result, test, _i, _len;
for ( _i = 0, _len = qu.length; _i < _len; _i++ ) {
expr = qu[_i];
if ( expr.splitPath ) {
test = reachin( expr.splitPath, ... | [
"function",
"execQuery",
"(",
"obj",
",",
"qu",
",",
"shortCircuit",
",",
"stopOnFirst",
")",
"{",
"var",
"arrayResults",
"=",
"[",
"]",
";",
"var",
"keyResults",
"=",
"[",
"]",
";",
"sys",
".",
"each",
"(",
"obj",
",",
"function",
"(",
"record",
","... | Executes a query by traversing a document and evaluating each record
@private
@param {array|object} obj The object to query
@param {object} qu The query to execute
@param {?boolean} shortCircuit When true, the condition that matches the query stops evaluation for that record, otherwise all conditions have to be met
@pa... | [
"Executes",
"a",
"query",
"by",
"traversing",
"a",
"document",
"and",
"evaluating",
"each",
"record"
] | 52b4f66fd3f1d244e8e6b72f9d0fa7aa675c78a7 | https://github.com/vm-component/vimo/blob/52b4f66fd3f1d244e8e6b72f9d0fa7aa675c78a7/build/doc-builder/theme/fixtures/documents/probe.js#L698-L726 | train |
DonutEspresso/big-json | tools/changelog.js | categorizeCommits | function categorizeCommits(rawCommits) {
const categorizedCommits = {};
// create a bucket of rawCommits by type:
// { fixes: [], upgrades: [], breaking: [] }
rawCommits.forEach(function(commit) {
const capType = capitalize(commit.type);
if (!categorizedCommits.hasOwnProperty(capType... | javascript | function categorizeCommits(rawCommits) {
const categorizedCommits = {};
// create a bucket of rawCommits by type:
// { fixes: [], upgrades: [], breaking: [] }
rawCommits.forEach(function(commit) {
const capType = capitalize(commit.type);
if (!categorizedCommits.hasOwnProperty(capType... | [
"function",
"categorizeCommits",
"(",
"rawCommits",
")",
"{",
"const",
"categorizedCommits",
"=",
"{",
"}",
";",
"// create a bucket of rawCommits by type:",
"// { fixes: [], upgrades: [], breaking: [] }",
"rawCommits",
".",
"forEach",
"(",
"function",
"(",
"commit",
")",
... | categorize raw commits into types of commits for consumption into md.
@function categorizeCommits
@param {Array} rawCommits array of objects describing commits
@return {Object} | [
"categorize",
"raw",
"commits",
"into",
"types",
"of",
"commits",
"for",
"consumption",
"into",
"md",
"."
] | a26eacf659db71d8e5e0a619ef73bccce05354f0 | https://github.com/DonutEspresso/big-json/blob/a26eacf659db71d8e5e0a619ef73bccce05354f0/tools/changelog.js#L509-L527 | train |
DonutEspresso/big-json | lib/index.js | createStringifyStream | function createStringifyStream(opts) {
assert.object(opts, 'opts');
assert.ok(Array.isArray(opts.body) || typeof opts.body === 'object',
'opts.body must be an array or object');
return stringifyStreamFactory(opts.body, null, null, true);
} | javascript | function createStringifyStream(opts) {
assert.object(opts, 'opts');
assert.ok(Array.isArray(opts.body) || typeof opts.body === 'object',
'opts.body must be an array or object');
return stringifyStreamFactory(opts.body, null, null, true);
} | [
"function",
"createStringifyStream",
"(",
"opts",
")",
"{",
"assert",
".",
"object",
"(",
"opts",
",",
"'opts'",
")",
";",
"assert",
".",
"ok",
"(",
"Array",
".",
"isArray",
"(",
"opts",
".",
"body",
")",
"||",
"typeof",
"opts",
".",
"body",
"===",
"... | create a JSON.stringify readable stream.
@public
@param {Object} opts an options object
@param {Object} opts.body the JS object to JSON.stringify
@function createStringifyStream
@return {Stream} | [
"create",
"a",
"JSON",
".",
"stringify",
"readable",
"stream",
"."
] | a26eacf659db71d8e5e0a619ef73bccce05354f0 | https://github.com/DonutEspresso/big-json/blob/a26eacf659db71d8e5e0a619ef73bccce05354f0/lib/index.js#L68-L74 | train |
DonutEspresso/big-json | lib/index.js | parse | function parse(opts, callback) {
assert.object(opts, 'opts');
assert.string(opts.body, 'opts.body');
assert.func(callback, 'callback');
const sourceStream = intoStream(opts.body);
const parseStream = createParseStream();
const cb = once(callback);
parseStream.on('data', function(data) {
... | javascript | function parse(opts, callback) {
assert.object(opts, 'opts');
assert.string(opts.body, 'opts.body');
assert.func(callback, 'callback');
const sourceStream = intoStream(opts.body);
const parseStream = createParseStream();
const cb = once(callback);
parseStream.on('data', function(data) {
... | [
"function",
"parse",
"(",
"opts",
",",
"callback",
")",
"{",
"assert",
".",
"object",
"(",
"opts",
",",
"'opts'",
")",
";",
"assert",
".",
"string",
"(",
"opts",
".",
"body",
",",
"'opts.body'",
")",
";",
"assert",
".",
"func",
"(",
"callback",
",",
... | stream based JSON.parse. async function signature to abstract over streams.
@public
@param {Object} opts options to pass to parse stream
@param {String} opts.body string to parse
@param {Function} callback a callback function
@return {Object} the parsed JSON object | [
"stream",
"based",
"JSON",
".",
"parse",
".",
"async",
"function",
"signature",
"to",
"abstract",
"over",
"streams",
"."
] | a26eacf659db71d8e5e0a619ef73bccce05354f0 | https://github.com/DonutEspresso/big-json/blob/a26eacf659db71d8e5e0a619ef73bccce05354f0/lib/index.js#L85-L103 | train |
DonutEspresso/big-json | lib/index.js | stringify | function stringify(opts, callback) {
assert.object(opts, 'opts');
assert.func(callback, 'callback');
let stringified = '';
const stringifyStream = createStringifyStream(opts);
const passthroughStream = new stream.PassThrough();
const cb = once(callback);
// setup the passthrough stream as ... | javascript | function stringify(opts, callback) {
assert.object(opts, 'opts');
assert.func(callback, 'callback');
let stringified = '';
const stringifyStream = createStringifyStream(opts);
const passthroughStream = new stream.PassThrough();
const cb = once(callback);
// setup the passthrough stream as ... | [
"function",
"stringify",
"(",
"opts",
",",
"callback",
")",
"{",
"assert",
".",
"object",
"(",
"opts",
",",
"'opts'",
")",
";",
"assert",
".",
"func",
"(",
"callback",
",",
"'callback'",
")",
";",
"let",
"stringified",
"=",
"''",
";",
"const",
"stringi... | stream based JSON.stringify. async function signature to abstract over
streams.
@public
@param {Object} opts options to pass to stringify stream
@param {Function} callback a callback function
@function stringify
@return {Object} the parsed JSON object | [
"stream",
"based",
"JSON",
".",
"stringify",
".",
"async",
"function",
"signature",
"to",
"abstract",
"over",
"streams",
"."
] | a26eacf659db71d8e5e0a619ef73bccce05354f0 | https://github.com/DonutEspresso/big-json/blob/a26eacf659db71d8e5e0a619ef73bccce05354f0/lib/index.js#L115-L140 | train |
cliffano/nestor | lib/cli/job.js | read | function read(cb) {
return function (name, args) {
function resultCb(result) {
var status = util.statusByColor(result.color);
var color = util.colorByStatus(status, result.color);
console.log('%s | %s', name, text.__(status)[color]);
result.healthReport.forEach(function (report) {
... | javascript | function read(cb) {
return function (name, args) {
function resultCb(result) {
var status = util.statusByColor(result.color);
var color = util.colorByStatus(status, result.color);
console.log('%s | %s', name, text.__(status)[color]);
result.healthReport.forEach(function (report) {
... | [
"function",
"read",
"(",
"cb",
")",
"{",
"return",
"function",
"(",
"name",
",",
"args",
")",
"{",
"function",
"resultCb",
"(",
"result",
")",
"{",
"var",
"status",
"=",
"util",
".",
"statusByColor",
"(",
"result",
".",
"color",
")",
";",
"var",
"col... | Get a handler that calls Jenkins API to retrieve information about a job.
Job status and health reports will be logged when there's no error.
@param {Function} cb: callback for argument handling
@return Jenkins API handler function | [
"Get",
"a",
"handler",
"that",
"calls",
"Jenkins",
"API",
"to",
"retrieve",
"information",
"about",
"a",
"job",
".",
"Job",
"status",
"and",
"health",
"reports",
"will",
"be",
"logged",
"when",
"there",
"s",
"no",
"error",
"."
] | aa7e964e372bef376bab59b3f3cb5d847f76290d | https://github.com/cliffano/nestor/blob/aa7e964e372bef376bab59b3f3cb5d847f76290d/lib/cli/job.js#L35-L50 | train |
cliffano/nestor | lib/cli/job.js | update | function update(cb) {
return function (name, configFile, args) {
function resultCb(result) {
console.log(text.__('Job %s was updated successfully'), name);
}
function jenkinsCb(jenkins) {
var config = fs.readFileSync(configFile).toString();
jenkins.updateJob(name, config, cli.exitCb(null... | javascript | function update(cb) {
return function (name, configFile, args) {
function resultCb(result) {
console.log(text.__('Job %s was updated successfully'), name);
}
function jenkinsCb(jenkins) {
var config = fs.readFileSync(configFile).toString();
jenkins.updateJob(name, config, cli.exitCb(null... | [
"function",
"update",
"(",
"cb",
")",
"{",
"return",
"function",
"(",
"name",
",",
"configFile",
",",
"args",
")",
"{",
"function",
"resultCb",
"(",
"result",
")",
"{",
"console",
".",
"log",
"(",
"text",
".",
"__",
"(",
"'Job %s was updated successfully'"... | Get a handler that calls Jenkins API to update a job with specific configuration.
Success job update message will be logged when there's no error.
@param {Function} cb: callback for argument handling
@return Jenkins API handler function | [
"Get",
"a",
"handler",
"that",
"calls",
"Jenkins",
"API",
"to",
"update",
"a",
"job",
"with",
"specific",
"configuration",
".",
"Success",
"job",
"update",
"message",
"will",
"be",
"logged",
"when",
"there",
"s",
"no",
"error",
"."
] | aa7e964e372bef376bab59b3f3cb5d847f76290d | https://github.com/cliffano/nestor/blob/aa7e964e372bef376bab59b3f3cb5d847f76290d/lib/cli/job.js#L95-L106 | train |
cliffano/nestor | lib/cli/job.js | _console | function _console(cb) {
return function (name, buildNumber, args) {
if (!args) {
args = buildNumber;
buildNumber = null;
}
function jenkinsCb(jenkins) {
// console does not trigger any build, interval is set to 0 (no-pending delay time)
var interval = 0;
var stream = jenki... | javascript | function _console(cb) {
return function (name, buildNumber, args) {
if (!args) {
args = buildNumber;
buildNumber = null;
}
function jenkinsCb(jenkins) {
// console does not trigger any build, interval is set to 0 (no-pending delay time)
var interval = 0;
var stream = jenki... | [
"function",
"_console",
"(",
"cb",
")",
"{",
"return",
"function",
"(",
"name",
",",
"buildNumber",
",",
"args",
")",
"{",
"if",
"(",
"!",
"args",
")",
"{",
"args",
"=",
"buildNumber",
";",
"buildNumber",
"=",
"null",
";",
"}",
"function",
"jenkinsCb",... | Get a handler that calls Jenkins API to stream console output.
@param {Function} cb: callback for argument handling
@return Jenkins API handler function | [
"Get",
"a",
"handler",
"that",
"calls",
"Jenkins",
"API",
"to",
"stream",
"console",
"output",
"."
] | aa7e964e372bef376bab59b3f3cb5d847f76290d | https://github.com/cliffano/nestor/blob/aa7e964e372bef376bab59b3f3cb5d847f76290d/lib/cli/job.js#L235-L252 | train |
cliffano/nestor | lib/cli/job.js | enable | function enable(cb) {
return function (name, args) {
function resultCb(result) {
console.log(text.__('Job %s was enabled successfully'), name);
}
function jenkinsCb(jenkins) {
jenkins.enableJob(name, cli.exitCb(null, resultCb));
}
cb(args, jenkinsCb);
};
} | javascript | function enable(cb) {
return function (name, args) {
function resultCb(result) {
console.log(text.__('Job %s was enabled successfully'), name);
}
function jenkinsCb(jenkins) {
jenkins.enableJob(name, cli.exitCb(null, resultCb));
}
cb(args, jenkinsCb);
};
} | [
"function",
"enable",
"(",
"cb",
")",
"{",
"return",
"function",
"(",
"name",
",",
"args",
")",
"{",
"function",
"resultCb",
"(",
"result",
")",
"{",
"console",
".",
"log",
"(",
"text",
".",
"__",
"(",
"'Job %s was enabled successfully'",
")",
",",
"name... | Get a handler that calls Jenkins API to enable a job.
Success job enabled message will be logged when there's no error.
@param {Function} cb: callback for argument handling
@return Jenkins API handler function | [
"Get",
"a",
"handler",
"that",
"calls",
"Jenkins",
"API",
"to",
"enable",
"a",
"job",
".",
"Success",
"job",
"enabled",
"message",
"will",
"be",
"logged",
"when",
"there",
"s",
"no",
"error",
"."
] | aa7e964e372bef376bab59b3f3cb5d847f76290d | https://github.com/cliffano/nestor/blob/aa7e964e372bef376bab59b3f3cb5d847f76290d/lib/cli/job.js#L261-L271 | train |
cliffano/nestor | lib/cli/job.js | copy | function copy(cb) {
return function (existingName, newName, args) {
function resultCb(result) {
console.log(text.__('Job %s was copied to job %s'), existingName, newName);
}
function jenkinsCb(jenkins) {
jenkins.copyJob(existingName, newName, cli.exitCb(null, resultCb));
}
cb(args, jen... | javascript | function copy(cb) {
return function (existingName, newName, args) {
function resultCb(result) {
console.log(text.__('Job %s was copied to job %s'), existingName, newName);
}
function jenkinsCb(jenkins) {
jenkins.copyJob(existingName, newName, cli.exitCb(null, resultCb));
}
cb(args, jen... | [
"function",
"copy",
"(",
"cb",
")",
"{",
"return",
"function",
"(",
"existingName",
",",
"newName",
",",
"args",
")",
"{",
"function",
"resultCb",
"(",
"result",
")",
"{",
"console",
".",
"log",
"(",
"text",
".",
"__",
"(",
"'Job %s was copied to job %s'",... | Get a handler that calls Jenkins API to copy a job into a new job.
Success job copy message will be logged when there's no error.
@param {Function} cb: callback for argument handling
@return Jenkins API handler function | [
"Get",
"a",
"handler",
"that",
"calls",
"Jenkins",
"API",
"to",
"copy",
"a",
"job",
"into",
"a",
"new",
"job",
".",
"Success",
"job",
"copy",
"message",
"will",
"be",
"logged",
"when",
"there",
"s",
"no",
"error",
"."
] | aa7e964e372bef376bab59b3f3cb5d847f76290d | https://github.com/cliffano/nestor/blob/aa7e964e372bef376bab59b3f3cb5d847f76290d/lib/cli/job.js#L299-L309 | train |
cliffano/nestor | lib/cli/view.js | fetchConfig | function fetchConfig(cb) {
return function (name, args) {
function resultCb(result) {
console.log(result);
}
function jenkinsCb(jenkins) {
jenkins.fetchViewConfig(name, cli.exitCb(null, resultCb));
}
cb(args, jenkinsCb);
};
} | javascript | function fetchConfig(cb) {
return function (name, args) {
function resultCb(result) {
console.log(result);
}
function jenkinsCb(jenkins) {
jenkins.fetchViewConfig(name, cli.exitCb(null, resultCb));
}
cb(args, jenkinsCb);
};
} | [
"function",
"fetchConfig",
"(",
"cb",
")",
"{",
"return",
"function",
"(",
"name",
",",
"args",
")",
"{",
"function",
"resultCb",
"(",
"result",
")",
"{",
"console",
".",
"log",
"(",
"result",
")",
";",
"}",
"function",
"jenkinsCb",
"(",
"jenkins",
")"... | Get a handler that calls Jenkins API to fetch a view configuration.
Jenkins view config.xml will be logged when there's no error.
@param {Function} cb: callback for argument handling
@return Jenkins API handler function | [
"Get",
"a",
"handler",
"that",
"calls",
"Jenkins",
"API",
"to",
"fetch",
"a",
"view",
"configuration",
".",
"Jenkins",
"view",
"config",
".",
"xml",
"will",
"be",
"logged",
"when",
"there",
"s",
"no",
"error",
"."
] | aa7e964e372bef376bab59b3f3cb5d847f76290d | https://github.com/cliffano/nestor/blob/aa7e964e372bef376bab59b3f3cb5d847f76290d/lib/cli/view.js#L52-L62 | train |
cliffano/nestor | lib/api/view.js | update | function update(name, config, cb) {
this.remoteAccessApi.postViewConfig(name, config, this.opts.headers, cb);
} | javascript | function update(name, config, cb) {
this.remoteAccessApi.postViewConfig(name, config, this.opts.headers, cb);
} | [
"function",
"update",
"(",
"name",
",",
"config",
",",
"cb",
")",
"{",
"this",
".",
"remoteAccessApi",
".",
"postViewConfig",
"(",
"name",
",",
"config",
",",
"this",
".",
"opts",
".",
"headers",
",",
"cb",
")",
";",
"}"
] | Update a view with specified configuration
@param {String} name: Jenkins view name
@param {String} config: Jenkins view config.xml
@param {Function} cb: standard cb(err, result) callback | [
"Update",
"a",
"view",
"with",
"specified",
"configuration"
] | aa7e964e372bef376bab59b3f3cb5d847f76290d | https://github.com/cliffano/nestor/blob/aa7e964e372bef376bab59b3f3cb5d847f76290d/lib/api/view.js#L36-L38 | train |
cliffano/nestor | lib/api/jenkins.js | discover | function discover(host, cb) {
const TIMEOUT = 5000;
var socket = dgram.createSocket('udp4');
var buffer = new Buffer(text.__('Long live Jenkins!'));
var parser = new xml2js.Parser();
socket.on('error', function (err) {
socket.close();
cb(err);
});
socket.on('message', function (result) {
s... | javascript | function discover(host, cb) {
const TIMEOUT = 5000;
var socket = dgram.createSocket('udp4');
var buffer = new Buffer(text.__('Long live Jenkins!'));
var parser = new xml2js.Parser();
socket.on('error', function (err) {
socket.close();
cb(err);
});
socket.on('message', function (result) {
s... | [
"function",
"discover",
"(",
"host",
",",
"cb",
")",
"{",
"const",
"TIMEOUT",
"=",
"5000",
";",
"var",
"socket",
"=",
"dgram",
".",
"createSocket",
"(",
"'udp4'",
")",
";",
"var",
"buffer",
"=",
"new",
"Buffer",
"(",
"text",
".",
"__",
"(",
"'Long li... | Discover whether there's a Jenkins instance running on the specified host.
@param {String} host: hostname
@param {Function} cb: standard cb(err, result) callback | [
"Discover",
"whether",
"there",
"s",
"a",
"Jenkins",
"instance",
"running",
"on",
"the",
"specified",
"host",
"."
] | aa7e964e372bef376bab59b3f3cb5d847f76290d | https://github.com/cliffano/nestor/blob/aa7e964e372bef376bab59b3f3cb5d847f76290d/lib/api/jenkins.js#L33-L64 | train |
cliffano/nestor | lib/api/jenkins.js | version | function version(cb) {
function _cb(err, result, response) {
if (err) {
cb(err);
} else if (response.headers['x-jenkins']) {
cb(null, response.headers['x-jenkins']);
} else {
cb(new Error(text.__('Not a Jenkins server')));
}
}
this.remoteAccessApi.headJenkins(_cb);
} | javascript | function version(cb) {
function _cb(err, result, response) {
if (err) {
cb(err);
} else if (response.headers['x-jenkins']) {
cb(null, response.headers['x-jenkins']);
} else {
cb(new Error(text.__('Not a Jenkins server')));
}
}
this.remoteAccessApi.headJenkins(_cb);
} | [
"function",
"version",
"(",
"cb",
")",
"{",
"function",
"_cb",
"(",
"err",
",",
"result",
",",
"response",
")",
"{",
"if",
"(",
"err",
")",
"{",
"cb",
"(",
"err",
")",
";",
"}",
"else",
"if",
"(",
"response",
".",
"headers",
"[",
"'x-jenkins'",
"... | Retrieve Jenkins version number from x-jenkins header.
If x-jenkins header does not exist, then it's assumed that the server is not a Jenkins instance.
@param {Function} cb: standard cb(err, result) callback | [
"Retrieve",
"Jenkins",
"version",
"number",
"from",
"x",
"-",
"jenkins",
"header",
".",
"If",
"x",
"-",
"jenkins",
"header",
"does",
"not",
"exist",
"then",
"it",
"s",
"assumed",
"that",
"the",
"server",
"is",
"not",
"a",
"Jenkins",
"instance",
"."
] | aa7e964e372bef376bab59b3f3cb5d847f76290d | https://github.com/cliffano/nestor/blob/aa7e964e372bef376bab59b3f3cb5d847f76290d/lib/api/jenkins.js#L103-L115 | train |
cliffano/nestor | lib/jenkins.js | executorSummary | function executorSummary(computers) {
var data = {};
computers.forEach(function (computer) {
var idleCount = 0;
var activeCount = 0;
data[computer.displayName] = { executors: [] };
computer.executors.forEach(function (executor) {
data[computer.displayName].executors.push({
idle:... | javascript | function executorSummary(computers) {
var data = {};
computers.forEach(function (computer) {
var idleCount = 0;
var activeCount = 0;
data[computer.displayName] = { executors: [] };
computer.executors.forEach(function (executor) {
data[computer.displayName].executors.push({
idle:... | [
"function",
"executorSummary",
"(",
"computers",
")",
"{",
"var",
"data",
"=",
"{",
"}",
";",
"computers",
".",
"forEach",
"(",
"function",
"(",
"computer",
")",
"{",
"var",
"idleCount",
"=",
"0",
";",
"var",
"activeCount",
"=",
"0",
";",
"data",
"[",
... | Summarise executor information from computers array.
@param {Array} computers: computers array, part of Jenkins#computer result
@return executor summary object | [
"Summarise",
"executor",
"information",
"from",
"computers",
"array",
"."
] | aa7e964e372bef376bab59b3f3cb5d847f76290d | https://github.com/cliffano/nestor/blob/aa7e964e372bef376bab59b3f3cb5d847f76290d/lib/jenkins.js#L107-L147 | train |
cliffano/nestor | lib/jenkins.js | monitor | function monitor(opts, cb) {
var self = this;
function singleJobResultCb(err, result) {
if (!err) {
result = util.statusByColor(result.color);
}
cb(err, result);
}
// when there are multiple jobs, status is derived following these rules:
// - fail if any job has Jenkins color red
// - wa... | javascript | function monitor(opts, cb) {
var self = this;
function singleJobResultCb(err, result) {
if (!err) {
result = util.statusByColor(result.color);
}
cb(err, result);
}
// when there are multiple jobs, status is derived following these rules:
// - fail if any job has Jenkins color red
// - wa... | [
"function",
"monitor",
"(",
"opts",
",",
"cb",
")",
"{",
"var",
"self",
"=",
"this",
";",
"function",
"singleJobResultCb",
"(",
"err",
",",
"result",
")",
"{",
"if",
"(",
"!",
"err",
")",
"{",
"result",
"=",
"util",
".",
"statusByColor",
"(",
"result... | Monitor Jenkins latest build status on a set interval.
@param {Object} opts: optional
- job: Jenkins job name
- view: Jenkins view name
- schedule: cron scheduling definition in standard * * * * * * format, default: 0 * * * * * (every minute)
@param {Function} cb: standard cb(err, result) callback | [
"Monitor",
"Jenkins",
"latest",
"build",
"status",
"on",
"a",
"set",
"interval",
"."
] | aa7e964e372bef376bab59b3f3cb5d847f76290d | https://github.com/cliffano/nestor/blob/aa7e964e372bef376bab59b3f3cb5d847f76290d/lib/jenkins.js#L158-L229 | train |
cliffano/nestor | lib/api/util.js | htmlError | function htmlError(result, cb) {
var message = result.body
.match(/<h1>Error<\/h1>.+<\/p>/).toString()
.replace(/<h1>Error<\/h1>/, '')
.replace(/<\/?p>/g, '');
cb(new Error(message));
} | javascript | function htmlError(result, cb) {
var message = result.body
.match(/<h1>Error<\/h1>.+<\/p>/).toString()
.replace(/<h1>Error<\/h1>/, '')
.replace(/<\/?p>/g, '');
cb(new Error(message));
} | [
"function",
"htmlError",
"(",
"result",
",",
"cb",
")",
"{",
"var",
"message",
"=",
"result",
".",
"body",
".",
"match",
"(",
"/",
"<h1>Error<\\/h1>.+<\\/p>",
"/",
")",
".",
"toString",
"(",
")",
".",
"replace",
"(",
"/",
"<h1>Error<\\/h1>",
"/",
",",
... | Parse HTML error page from Jenkins, pass the error message to the callback.
This error is usually the response body of error 400.
@param {Object} result: result of the sent request
@param {Function} cb: standard cb(err, result) callback | [
"Parse",
"HTML",
"error",
"page",
"from",
"Jenkins",
"pass",
"the",
"error",
"message",
"to",
"the",
"callback",
".",
"This",
"error",
"is",
"usually",
"the",
"response",
"body",
"of",
"error",
"400",
"."
] | aa7e964e372bef376bab59b3f3cb5d847f76290d | https://github.com/cliffano/nestor/blob/aa7e964e372bef376bab59b3f3cb5d847f76290d/lib/api/util.js#L40-L46 | train |
cliffano/nestor | lib/api/util.js | jobBuildNotFoundError | function jobBuildNotFoundError(name, buildNumber) {
return function (result, cb) {
cb(new Error(text.__('Job %s build %d does not exist', name, buildNumber)));
};
} | javascript | function jobBuildNotFoundError(name, buildNumber) {
return function (result, cb) {
cb(new Error(text.__('Job %s build %d does not exist', name, buildNumber)));
};
} | [
"function",
"jobBuildNotFoundError",
"(",
"name",
",",
"buildNumber",
")",
"{",
"return",
"function",
"(",
"result",
",",
"cb",
")",
"{",
"cb",
"(",
"new",
"Error",
"(",
"text",
".",
"__",
"(",
"'Job %s build %d does not exist'",
",",
"name",
",",
"buildNumb... | Create a 'job or build not found' error handler function.
@param {String} name: the job name
@param {Number} buildNumber: the job's build number
@return a handler function | [
"Create",
"a",
"job",
"or",
"build",
"not",
"found",
"error",
"handler",
"function",
"."
] | aa7e964e372bef376bab59b3f3cb5d847f76290d | https://github.com/cliffano/nestor/blob/aa7e964e372bef376bab59b3f3cb5d847f76290d/lib/api/util.js#L67-L71 | train |
cliffano/nestor | lib/api/job.js | create | function create(name, config, cb) {
var opts = {
body: config,
contentType: 'application/xml',
};
this.remoteAccessApi.postCreateItem(name, _.merge(opts, this.opts.headers), cb);
} | javascript | function create(name, config, cb) {
var opts = {
body: config,
contentType: 'application/xml',
};
this.remoteAccessApi.postCreateItem(name, _.merge(opts, this.opts.headers), cb);
} | [
"function",
"create",
"(",
"name",
",",
"config",
",",
"cb",
")",
"{",
"var",
"opts",
"=",
"{",
"body",
":",
"config",
",",
"contentType",
":",
"'application/xml'",
",",
"}",
";",
"this",
".",
"remoteAccessApi",
".",
"postCreateItem",
"(",
"name",
",",
... | Create a job with specified configuration.
@param {String} name: Jenkins job name
@param {String} config: Jenkins job config.xml
@param {Function} cb: standard cb(err, result) callback | [
"Create",
"a",
"job",
"with",
"specified",
"configuration",
"."
] | aa7e964e372bef376bab59b3f3cb5d847f76290d | https://github.com/cliffano/nestor/blob/aa7e964e372bef376bab59b3f3cb5d847f76290d/lib/api/job.js#L14-L20 | train |
cliffano/nestor | lib/api/job.js | update | function update(name, config, cb) {
this.remoteAccessApi.postJobConfig(name, config, this.opts.headers, cb);
} | javascript | function update(name, config, cb) {
this.remoteAccessApi.postJobConfig(name, config, this.opts.headers, cb);
} | [
"function",
"update",
"(",
"name",
",",
"config",
",",
"cb",
")",
"{",
"this",
".",
"remoteAccessApi",
".",
"postJobConfig",
"(",
"name",
",",
"config",
",",
"this",
".",
"opts",
".",
"headers",
",",
"cb",
")",
";",
"}"
] | Update a job with specified configuration
@param {String} name: Jenkins job name
@param {String} config: Jenkins job config.xml
@param {Function} cb: standard cb(err, result) callback | [
"Update",
"a",
"job",
"with",
"specified",
"configuration"
] | aa7e964e372bef376bab59b3f3cb5d847f76290d | https://github.com/cliffano/nestor/blob/aa7e964e372bef376bab59b3f3cb5d847f76290d/lib/api/job.js#L50-L52 | train |
cliffano/nestor | lib/api/job.js | build | function build(name, params, cb) {
var body = { parameter: [] } ;
_.keys(params).forEach(function (key) {
body.parameter.push({ name: key, value: params[key] });
});
var opts = {
token: 'nestor'
};
this.remoteAccessApi.postJobBuild(name, JSON.stringify(body), _.merge(opts, this.opts.headers), cb);
} | javascript | function build(name, params, cb) {
var body = { parameter: [] } ;
_.keys(params).forEach(function (key) {
body.parameter.push({ name: key, value: params[key] });
});
var opts = {
token: 'nestor'
};
this.remoteAccessApi.postJobBuild(name, JSON.stringify(body), _.merge(opts, this.opts.headers), cb);
} | [
"function",
"build",
"(",
"name",
",",
"params",
",",
"cb",
")",
"{",
"var",
"body",
"=",
"{",
"parameter",
":",
"[",
"]",
"}",
";",
"_",
".",
"keys",
"(",
"params",
")",
".",
"forEach",
"(",
"function",
"(",
"key",
")",
"{",
"body",
".",
"para... | Build a job.
@param {String} name: Jenkins job name
@param {Object|String} params: build parameters key-value pairs, passed as object or 'a=b&c=d' string
@param {Function} cb: standard cb(err, result) callback | [
"Build",
"a",
"job",
"."
] | aa7e964e372bef376bab59b3f3cb5d847f76290d | https://github.com/cliffano/nestor/blob/aa7e964e372bef376bab59b3f3cb5d847f76290d/lib/api/job.js#L71-L80 | train |
cliffano/nestor | lib/api/job.js | copy | function copy(existingName, newName, cb) {
var opts = {
mode: 'copy',
from: existingName,
contentType: 'text/plain',
};
this.remoteAccessApi.postCreateItem(newName, _.merge(opts, this.opts.headers), cb);
} | javascript | function copy(existingName, newName, cb) {
var opts = {
mode: 'copy',
from: existingName,
contentType: 'text/plain',
};
this.remoteAccessApi.postCreateItem(newName, _.merge(opts, this.opts.headers), cb);
} | [
"function",
"copy",
"(",
"existingName",
",",
"newName",
",",
"cb",
")",
"{",
"var",
"opts",
"=",
"{",
"mode",
":",
"'copy'",
",",
"from",
":",
"existingName",
",",
"contentType",
":",
"'text/plain'",
",",
"}",
";",
"this",
".",
"remoteAccessApi",
".",
... | Copy an existing job into a new job.
@param {String} existingName: existing Jenkins job name to copy from
@param {String} newName: new Jenkins job name to copy to
@param {Function} cb: standard cb(err, result) callback | [
"Copy",
"an",
"existing",
"job",
"into",
"a",
"new",
"job",
"."
] | aa7e964e372bef376bab59b3f3cb5d847f76290d | https://github.com/cliffano/nestor/blob/aa7e964e372bef376bab59b3f3cb5d847f76290d/lib/api/job.js#L204-L211 | train |
cliffano/nestor | lib/cli/jenkins.js | dashboard | function dashboard(cb) {
return function (args) {
function resultCb(result) {
var jobs = result.jobs;
if (_.isEmpty(jobs)) {
console.log(text.__('Jobless Jenkins'));
} else {
jobs.forEach(function (job) {
var status = util.statusByColor(job.color);
var color ... | javascript | function dashboard(cb) {
return function (args) {
function resultCb(result) {
var jobs = result.jobs;
if (_.isEmpty(jobs)) {
console.log(text.__('Jobless Jenkins'));
} else {
jobs.forEach(function (job) {
var status = util.statusByColor(job.color);
var color ... | [
"function",
"dashboard",
"(",
"cb",
")",
"{",
"return",
"function",
"(",
"args",
")",
"{",
"function",
"resultCb",
"(",
"result",
")",
"{",
"var",
"jobs",
"=",
"result",
".",
"jobs",
";",
"if",
"(",
"_",
".",
"isEmpty",
"(",
"jobs",
")",
")",
"{",
... | Get a handler that calls Jenkins API to get a list of all jobs on the Jenkins instance.
@param {Function} cb: callback for argument handling
@return Jenkins API handler function | [
"Get",
"a",
"handler",
"that",
"calls",
"Jenkins",
"API",
"to",
"get",
"a",
"list",
"of",
"all",
"jobs",
"on",
"the",
"Jenkins",
"instance",
"."
] | aa7e964e372bef376bab59b3f3cb5d847f76290d | https://github.com/cliffano/nestor/blob/aa7e964e372bef376bab59b3f3cb5d847f76290d/lib/cli/jenkins.js#L14-L33 | train |
cliffano/nestor | lib/cli/jenkins.js | discover | function discover(cb) {
return function (host, args) {
if (!args) {
args = host || {};
host = 'localhost';
}
function resultCb(result) {
console.log(text.__('Jenkins ver. %s is running on %s'),
result.hudson.version[0],
(result.hudson.url && result.hudson.url[0]) ? re... | javascript | function discover(cb) {
return function (host, args) {
if (!args) {
args = host || {};
host = 'localhost';
}
function resultCb(result) {
console.log(text.__('Jenkins ver. %s is running on %s'),
result.hudson.version[0],
(result.hudson.url && result.hudson.url[0]) ? re... | [
"function",
"discover",
"(",
"cb",
")",
"{",
"return",
"function",
"(",
"host",
",",
"args",
")",
"{",
"if",
"(",
"!",
"args",
")",
"{",
"args",
"=",
"host",
"||",
"{",
"}",
";",
"host",
"=",
"'localhost'",
";",
"}",
"function",
"resultCb",
"(",
... | Get a handler that calls Jenkins API to discover a Jenkins instance on specified host.
@param {Function} cb: callback for argument handling
@return Jenkins API handler function | [
"Get",
"a",
"handler",
"that",
"calls",
"Jenkins",
"API",
"to",
"discover",
"a",
"Jenkins",
"instance",
"on",
"specified",
"host",
"."
] | aa7e964e372bef376bab59b3f3cb5d847f76290d | https://github.com/cliffano/nestor/blob/aa7e964e372bef376bab59b3f3cb5d847f76290d/lib/cli/jenkins.js#L41-L57 | train |
cliffano/nestor | lib/cli/jenkins.js | executor | function executor(cb) {
return function (args) {
function resultCb(result) {
var computers = result.computer;
if (_.isEmpty(computers)) {
console.log(text.__('No executor found'));
} else {
var data = Jenkins.executorSummary(computers);
_.keys(data).forEach(function (... | javascript | function executor(cb) {
return function (args) {
function resultCb(result) {
var computers = result.computer;
if (_.isEmpty(computers)) {
console.log(text.__('No executor found'));
} else {
var data = Jenkins.executorSummary(computers);
_.keys(data).forEach(function (... | [
"function",
"executor",
"(",
"cb",
")",
"{",
"return",
"function",
"(",
"args",
")",
"{",
"function",
"resultCb",
"(",
"result",
")",
"{",
"var",
"computers",
"=",
"result",
".",
"computer",
";",
"if",
"(",
"_",
".",
"isEmpty",
"(",
"computers",
")",
... | Get a handler that calls Jenkins API to display executors information per computer
@param {Function} cb: callback for argument handling
@return Jenkins API handler function | [
"Get",
"a",
"handler",
"that",
"calls",
"Jenkins",
"API",
"to",
"display",
"executors",
"information",
"per",
"computer"
] | aa7e964e372bef376bab59b3f3cb5d847f76290d | https://github.com/cliffano/nestor/blob/aa7e964e372bef376bab59b3f3cb5d847f76290d/lib/cli/jenkins.js#L65-L93 | train |
cliffano/nestor | lib/cli/jenkins.js | feed | function feed(cb) {
return function (args) {
function resultCb(result) {
result.forEach(function (article) {
console.log(article.title);
});
}
function jenkinsCb(jenkins) {
if (args.job) {
jenkins.parseJobFeed(args.job, cli.exitCb(null, resultCb));
} else if (args.v... | javascript | function feed(cb) {
return function (args) {
function resultCb(result) {
result.forEach(function (article) {
console.log(article.title);
});
}
function jenkinsCb(jenkins) {
if (args.job) {
jenkins.parseJobFeed(args.job, cli.exitCb(null, resultCb));
} else if (args.v... | [
"function",
"feed",
"(",
"cb",
")",
"{",
"return",
"function",
"(",
"args",
")",
"{",
"function",
"resultCb",
"(",
"result",
")",
"{",
"result",
".",
"forEach",
"(",
"function",
"(",
"article",
")",
"{",
"console",
".",
"log",
"(",
"article",
".",
"t... | Get a handler that calls Jenkins API to retrieve feed.
Feed contains articles.
@param {Function} cb: callback for argument handling
@return Jenkins API handler function | [
"Get",
"a",
"handler",
"that",
"calls",
"Jenkins",
"API",
"to",
"retrieve",
"feed",
".",
"Feed",
"contains",
"articles",
"."
] | aa7e964e372bef376bab59b3f3cb5d847f76290d | https://github.com/cliffano/nestor/blob/aa7e964e372bef376bab59b3f3cb5d847f76290d/lib/cli/jenkins.js#L102-L120 | train |
cliffano/nestor | lib/cli/util.js | colorByStatus | function colorByStatus(status, jenkinsColor) {
var color;
if (jenkinsColor) {
// Jenkins color value can contain either a color, color_anime, or status in job.color field,
// hence to get color/status value out of the mix we need to remove the postfix _anime,
// _anime postfix only exists on a job cur... | javascript | function colorByStatus(status, jenkinsColor) {
var color;
if (jenkinsColor) {
// Jenkins color value can contain either a color, color_anime, or status in job.color field,
// hence to get color/status value out of the mix we need to remove the postfix _anime,
// _anime postfix only exists on a job cur... | [
"function",
"colorByStatus",
"(",
"status",
",",
"jenkinsColor",
")",
"{",
"var",
"color",
";",
"if",
"(",
"jenkinsColor",
")",
"{",
"// Jenkins color value can contain either a color, color_anime, or status in job.color field,",
"// hence to get color/status value out of the mix w... | Get color based on status and Jenkins status color.
Jenkins status color will take precedence over status because
Jenkins uses either blue or green as the color for ok status.
Color property can contain either color or status text.
Hence the need for mapping color to status text in the case where value is really color... | [
"Get",
"color",
"based",
"on",
"status",
"and",
"Jenkins",
"status",
"color",
".",
"Jenkins",
"status",
"color",
"will",
"take",
"precedence",
"over",
"status",
"because",
"Jenkins",
"uses",
"either",
"blue",
"or",
"green",
"as",
"the",
"color",
"for",
"ok",... | aa7e964e372bef376bab59b3f3cb5d847f76290d | https://github.com/cliffano/nestor/blob/aa7e964e372bef376bab59b3f3cb5d847f76290d/lib/cli/util.js#L24-L46 | train |
cliffano/nestor | lib/cli/util.js | statusByColor | function statusByColor(jenkinsColor) {
if (jenkinsColor) {
// Jenkins color value can contain either a color, color_anime, or status in job.color field,
// hence to get color/status value out of the mix we need to remove the postfix _anime,
// _anime postfix only exists on a job currently being built
... | javascript | function statusByColor(jenkinsColor) {
if (jenkinsColor) {
// Jenkins color value can contain either a color, color_anime, or status in job.color field,
// hence to get color/status value out of the mix we need to remove the postfix _anime,
// _anime postfix only exists on a job currently being built
... | [
"function",
"statusByColor",
"(",
"jenkinsColor",
")",
"{",
"if",
"(",
"jenkinsColor",
")",
"{",
"// Jenkins color value can contain either a color, color_anime, or status in job.color field,",
"// hence to get color/status value out of the mix we need to remove the postfix _anime,",
"// _... | Get status based on the value of color property.
Color property can contain either color or status text.
Hence the need for mapping color to status text in the case where value is really color.
This is used in conjunction with colorByStatus function.
@param {String} jenkinsColor: Jenkins status color
@return the stat... | [
"Get",
"status",
"based",
"on",
"the",
"value",
"of",
"color",
"property",
"."
] | aa7e964e372bef376bab59b3f3cb5d847f76290d | https://github.com/cliffano/nestor/blob/aa7e964e372bef376bab59b3f3cb5d847f76290d/lib/cli/util.js#L58-L73 | train |
bevacqua/insane | parser.js | parsePart | function parsePart () {
chars = true;
parseTag();
var same = html === last;
last = html;
if (same) { // discard, because it's invalid
html = '';
}
} | javascript | function parsePart () {
chars = true;
parseTag();
var same = html === last;
last = html;
if (same) { // discard, because it's invalid
html = '';
}
} | [
"function",
"parsePart",
"(",
")",
"{",
"chars",
"=",
"true",
";",
"parseTag",
"(",
")",
";",
"var",
"same",
"=",
"html",
"===",
"last",
";",
"last",
"=",
"html",
";",
"if",
"(",
"same",
")",
"{",
"// discard, because it's invalid",
"html",
"=",
"''",
... | clean up any remaining tags | [
"clean",
"up",
"any",
"remaining",
"tags"
] | 7f5a809f44a37e7d11ee5343b2d8bca4be6ba4ae | https://github.com/bevacqua/insane/blob/7f5a809f44a37e7d11ee5343b2d8bca4be6ba4ae/parser.js#L31-L41 | train |
iosphere/elm-i18n | index.js | build | function build(outputDir) {
let exec = require("child_process").exec;
let elmFile = path.join(argv.src, argv.elmFile);
let cmd = "elm-make " + elmFile + " --yes --output " + argv.output + "/" + argv.language + ".js";
console.log(cmd);
exec(cmd, (err, stdout, stderr) => {
if(err) {
... | javascript | function build(outputDir) {
let exec = require("child_process").exec;
let elmFile = path.join(argv.src, argv.elmFile);
let cmd = "elm-make " + elmFile + " --yes --output " + argv.output + "/" + argv.language + ".js";
console.log(cmd);
exec(cmd, (err, stdout, stderr) => {
if(err) {
... | [
"function",
"build",
"(",
"outputDir",
")",
"{",
"let",
"exec",
"=",
"require",
"(",
"\"child_process\"",
")",
".",
"exec",
";",
"let",
"elmFile",
"=",
"path",
".",
"join",
"(",
"argv",
".",
"src",
",",
"argv",
".",
"elmFile",
")",
";",
"let",
"cmd",... | build - Builds the elm app with the current language.
@param {type} outputDir The directory to which the elm build should be written.
Files will be named according to the current language | [
"build",
"-",
"Builds",
"the",
"elm",
"app",
"with",
"the",
"current",
"language",
"."
] | 8d4e571868390800ed64d530c8354b74949cf433 | https://github.com/iosphere/elm-i18n/blob/8d4e571868390800ed64d530c8354b74949cf433/index.js#L88-L100 | train |
iosphere/elm-i18n | extractor.js | handleExport | function handleExport(resultString) {
if (resultString === "") {
process.exit(500);
}
let targetPath = path.join(currentDir, argv.exportOutput);
fs.writeFileSync(targetPath, resultString);
console.log("Finished writing csv file to:", targetPath);
} | javascript | function handleExport(resultString) {
if (resultString === "") {
process.exit(500);
}
let targetPath = path.join(currentDir, argv.exportOutput);
fs.writeFileSync(targetPath, resultString);
console.log("Finished writing csv file to:", targetPath);
} | [
"function",
"handleExport",
"(",
"resultString",
")",
"{",
"if",
"(",
"resultString",
"===",
"\"\"",
")",
"{",
"process",
".",
"exit",
"(",
"500",
")",
";",
"}",
"let",
"targetPath",
"=",
"path",
".",
"join",
"(",
"currentDir",
",",
"argv",
".",
"expor... | handleExport - Handles the csv string generated by elm and saves it to exportOutput.
@param {String} resultString A CSV string of all translations. | [
"handleExport",
"-",
"Handles",
"the",
"csv",
"string",
"generated",
"by",
"elm",
"and",
"saves",
"it",
"to",
"exportOutput",
"."
] | 8d4e571868390800ed64d530c8354b74949cf433 | https://github.com/iosphere/elm-i18n/blob/8d4e571868390800ed64d530c8354b74949cf433/extractor.js#L91-L99 | train |
iosphere/elm-i18n | dist/elm.js | htmlToProgram | function htmlToProgram(vnode)
{
var emptyBag = batch(_elm_lang$core$Native_List.Nil);
var noChange = _elm_lang$core$Native_Utils.Tuple2(
_elm_lang$core$Native_Utils.Tuple0,
emptyBag
);
return _elm_lang$virtual_dom$VirtualDom$program({
init: noChange,
view: function(model) { return main; },
update: F2(fun... | javascript | function htmlToProgram(vnode)
{
var emptyBag = batch(_elm_lang$core$Native_List.Nil);
var noChange = _elm_lang$core$Native_Utils.Tuple2(
_elm_lang$core$Native_Utils.Tuple0,
emptyBag
);
return _elm_lang$virtual_dom$VirtualDom$program({
init: noChange,
view: function(model) { return main; },
update: F2(fun... | [
"function",
"htmlToProgram",
"(",
"vnode",
")",
"{",
"var",
"emptyBag",
"=",
"batch",
"(",
"_elm_lang$core$Native_List",
".",
"Nil",
")",
";",
"var",
"noChange",
"=",
"_elm_lang$core$Native_Utils",
".",
"Tuple2",
"(",
"_elm_lang$core$Native_Utils",
".",
"Tuple0",
... | HTML TO PROGRAM | [
"HTML",
"TO",
"PROGRAM"
] | 8d4e571868390800ed64d530c8354b74949cf433 | https://github.com/iosphere/elm-i18n/blob/8d4e571868390800ed64d530c8354b74949cf433/dist/elm.js#L2400-L2414 | train |
iosphere/elm-i18n | dist/elm.js | spawnLoop | function spawnLoop(init, onMessage)
{
var andThen = _elm_lang$core$Native_Scheduler.andThen;
function loop(state)
{
var handleMsg = _elm_lang$core$Native_Scheduler.receive(function(msg) {
return onMessage(msg, state);
});
return A2(andThen, loop, handleMsg);
}
var task = A2(andThen, loop, init);
retur... | javascript | function spawnLoop(init, onMessage)
{
var andThen = _elm_lang$core$Native_Scheduler.andThen;
function loop(state)
{
var handleMsg = _elm_lang$core$Native_Scheduler.receive(function(msg) {
return onMessage(msg, state);
});
return A2(andThen, loop, handleMsg);
}
var task = A2(andThen, loop, init);
retur... | [
"function",
"spawnLoop",
"(",
"init",
",",
"onMessage",
")",
"{",
"var",
"andThen",
"=",
"_elm_lang$core$Native_Scheduler",
".",
"andThen",
";",
"function",
"loop",
"(",
"state",
")",
"{",
"var",
"handleMsg",
"=",
"_elm_lang$core$Native_Scheduler",
".",
"receive",... | HELPER for STATEFUL LOOPS | [
"HELPER",
"for",
"STATEFUL",
"LOOPS"
] | 8d4e571868390800ed64d530c8354b74949cf433 | https://github.com/iosphere/elm-i18n/blob/8d4e571868390800ed64d530c8354b74949cf433/dist/elm.js#L2545-L2560 | train |
superbrothers/capturejs | lib/capturejs.js | createPageHandler | function createPageHandler(page) {
if (DEBUG && !page.phantom) inspectArgs("createPageHandler: ", page);
phPage = page;
var matches;
if (option.viewportsize) {
matches = option.viewportsize.match(/^(\d+)x(\d+)$/);
if (matches !== null) {
page.pro... | javascript | function createPageHandler(page) {
if (DEBUG && !page.phantom) inspectArgs("createPageHandler: ", page);
phPage = page;
var matches;
if (option.viewportsize) {
matches = option.viewportsize.match(/^(\d+)x(\d+)$/);
if (matches !== null) {
page.pro... | [
"function",
"createPageHandler",
"(",
"page",
")",
"{",
"if",
"(",
"DEBUG",
"&&",
"!",
"page",
".",
"phantom",
")",
"inspectArgs",
"(",
"\"createPageHandler: \"",
",",
"page",
")",
";",
"phPage",
"=",
"page",
";",
"var",
"matches",
";",
"if",
"(",
"optio... | Configure page settings then open a new page in PhantomJS. | [
"Configure",
"page",
"settings",
"then",
"open",
"a",
"new",
"page",
"in",
"PhantomJS",
"."
] | a29082451784713799ae4647665a2092ad2b0633 | https://github.com/superbrothers/capturejs/blob/a29082451784713799ae4647665a2092ad2b0633/lib/capturejs.js#L73-L112 | train |
superbrothers/capturejs | lib/capturejs.js | reportStatus | function reportStatus(status) {
if (DEBUG && status !== "success") inspectArgs("reportStatus: ", status);
if (status === "fail") {
var err = `capturejs: cannot access ${option.uri}: failed to open page`;
console.error(err);
phInstance.exit();
process.next... | javascript | function reportStatus(status) {
if (DEBUG && status !== "success") inspectArgs("reportStatus: ", status);
if (status === "fail") {
var err = `capturejs: cannot access ${option.uri}: failed to open page`;
console.error(err);
phInstance.exit();
process.next... | [
"function",
"reportStatus",
"(",
"status",
")",
"{",
"if",
"(",
"DEBUG",
"&&",
"status",
"!==",
"\"success\"",
")",
"inspectArgs",
"(",
"\"reportStatus: \"",
",",
"status",
")",
";",
"if",
"(",
"status",
"===",
"\"fail\"",
")",
"{",
"var",
"err",
"=",
"`... | Log status messages, and close PhantomJS on failure. | [
"Log",
"status",
"messages",
"and",
"close",
"PhantomJS",
"on",
"failure",
"."
] | a29082451784713799ae4647665a2092ad2b0633 | https://github.com/superbrothers/capturejs/blob/a29082451784713799ae4647665a2092ad2b0633/lib/capturejs.js#L117-L128 | train |
superbrothers/capturejs | lib/capturejs.js | manipulatePage | function manipulatePage(page) {
if (DEBUG && !page.phantom) inspectArgs("manipulatePage: ", page);
if (timer !== undefined) {
clearTimeout(timer);
}
// Inject an external script file.
if (option["javascript-file"]) {
page.injectJs(option["javascript-file... | javascript | function manipulatePage(page) {
if (DEBUG && !page.phantom) inspectArgs("manipulatePage: ", page);
if (timer !== undefined) {
clearTimeout(timer);
}
// Inject an external script file.
if (option["javascript-file"]) {
page.injectJs(option["javascript-file... | [
"function",
"manipulatePage",
"(",
"page",
")",
"{",
"if",
"(",
"DEBUG",
"&&",
"!",
"page",
".",
"phantom",
")",
"inspectArgs",
"(",
"\"manipulatePage: \"",
",",
"page",
")",
";",
"if",
"(",
"timer",
"!==",
"undefined",
")",
"{",
"clearTimeout",
"(",
"ti... | Inject JavaScript into the open page. | [
"Inject",
"JavaScript",
"into",
"the",
"open",
"page",
"."
] | a29082451784713799ae4647665a2092ad2b0633 | https://github.com/superbrothers/capturejs/blob/a29082451784713799ae4647665a2092ad2b0633/lib/capturejs.js#L133-L158 | train |
superbrothers/capturejs | lib/capturejs.js | captureImage | function captureImage(page) {
if (DEBUG && !page.phantom) inspectArgs("captureImage: ", page);
if (option.selector) {
let getElement = [ "function () {",
, "document.body.bgColor = 'white';"
, `var elem = document.querySelector('${option.selector}');`
... | javascript | function captureImage(page) {
if (DEBUG && !page.phantom) inspectArgs("captureImage: ", page);
if (option.selector) {
let getElement = [ "function () {",
, "document.body.bgColor = 'white';"
, `var elem = document.querySelector('${option.selector}');`
... | [
"function",
"captureImage",
"(",
"page",
")",
"{",
"if",
"(",
"DEBUG",
"&&",
"!",
"page",
".",
"phantom",
")",
"inspectArgs",
"(",
"\"captureImage: \"",
",",
"page",
")",
";",
"if",
"(",
"option",
".",
"selector",
")",
"{",
"let",
"getElement",
"=",
"[... | Capture the specified image. | [
"Capture",
"the",
"specified",
"image",
"."
] | a29082451784713799ae4647665a2092ad2b0633 | https://github.com/superbrothers/capturejs/blob/a29082451784713799ae4647665a2092ad2b0633/lib/capturejs.js#L163-L175 | train |
superbrothers/capturejs | lib/capturejs.js | saveImage | function saveImage(rect) {
if (DEBUG && rect && !rect.bottom) inspectArgs("saveImage: ", rect);
if (rect && typeof rect.bottom === "number") {
phPage.property("clipRect", rect);
}
// Set a timeout to give the page a chance to render.
setTimeout(function () {
... | javascript | function saveImage(rect) {
if (DEBUG && rect && !rect.bottom) inspectArgs("saveImage: ", rect);
if (rect && typeof rect.bottom === "number") {
phPage.property("clipRect", rect);
}
// Set a timeout to give the page a chance to render.
setTimeout(function () {
... | [
"function",
"saveImage",
"(",
"rect",
")",
"{",
"if",
"(",
"DEBUG",
"&&",
"rect",
"&&",
"!",
"rect",
".",
"bottom",
")",
"inspectArgs",
"(",
"\"saveImage: \"",
",",
"rect",
")",
";",
"if",
"(",
"rect",
"&&",
"typeof",
"rect",
".",
"bottom",
"===",
"\... | Output the saved image to the specified file. | [
"Output",
"the",
"saved",
"image",
"to",
"the",
"specified",
"file",
"."
] | a29082451784713799ae4647665a2092ad2b0633 | https://github.com/superbrothers/capturejs/blob/a29082451784713799ae4647665a2092ad2b0633/lib/capturejs.js#L180-L196 | train |
shobhitsharma/embedo | embedo.js | ajax | function ajax(url, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
callback = callback || function () {};
var xhr = new XMLHttpRequest();
xhr.onload = function () {
if (xhr.status >= 400) {
re... | javascript | function ajax(url, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
callback = callback || function () {};
var xhr = new XMLHttpRequest();
xhr.onload = function () {
if (xhr.status >= 400) {
re... | [
"function",
"ajax",
"(",
"url",
",",
"options",
",",
"callback",
")",
"{",
"if",
"(",
"typeof",
"options",
"===",
"'function'",
")",
"{",
"callback",
"=",
"options",
";",
"options",
"=",
"{",
"}",
";",
"}",
"callback",
"=",
"callback",
"||",
"function"... | XHR HTTP Requests
@param {string} url
@param {object} options
@param {Function} callback | [
"XHR",
"HTTP",
"Requests"
] | 8578c4125ecf475f4cdbd412f13d8687e816cda5 | https://github.com/shobhitsharma/embedo/blob/8578c4125ecf475f4cdbd412f13d8687e816cda5/embedo.js#L494-L516 | train |
shobhitsharma/embedo | embedo.js | relative_px | function relative_px(type, value) {
var w = window,
d = document,
e = d.documentElement,
g = d.body,
x = w.innerWidth || e.clientWidth || g.clientWidth,
y = w.innerHeight || e.clientHeight || g.clientHeight;
if (type === 'vw') {
... | javascript | function relative_px(type, value) {
var w = window,
d = document,
e = d.documentElement,
g = d.body,
x = w.innerWidth || e.clientWidth || g.clientWidth,
y = w.innerHeight || e.clientHeight || g.clientHeight;
if (type === 'vw') {
... | [
"function",
"relative_px",
"(",
"type",
",",
"value",
")",
"{",
"var",
"w",
"=",
"window",
",",
"d",
"=",
"document",
",",
"e",
"=",
"d",
".",
"documentElement",
",",
"g",
"=",
"d",
".",
"body",
",",
"x",
"=",
"w",
".",
"innerWidth",
"||",
"e",
... | Converts vw or vh to PX | [
"Converts",
"vw",
"or",
"vh",
"to",
"PX"
] | 8578c4125ecf475f4cdbd412f13d8687e816cda5 | https://github.com/shobhitsharma/embedo/blob/8578c4125ecf475f4cdbd412f13d8687e816cda5/embedo.js#L589-L604 | train |
shobhitsharma/embedo | embedo.js | percent_px | function percent_px(el, prop, percent) {
var parent_width = Embedo.utils.compute(el.parentNode, prop, true);
percent = parseFloat(percent);
return parent_width * (percent / 100);
} | javascript | function percent_px(el, prop, percent) {
var parent_width = Embedo.utils.compute(el.parentNode, prop, true);
percent = parseFloat(percent);
return parent_width * (percent / 100);
} | [
"function",
"percent_px",
"(",
"el",
",",
"prop",
",",
"percent",
")",
"{",
"var",
"parent_width",
"=",
"Embedo",
".",
"utils",
".",
"compute",
"(",
"el",
".",
"parentNode",
",",
"prop",
",",
"true",
")",
";",
"percent",
"=",
"parseFloat",
"(",
"percen... | Converts % to PX | [
"Converts",
"%",
"to",
"PX"
] | 8578c4125ecf475f4cdbd412f13d8687e816cda5 | https://github.com/shobhitsharma/embedo/blob/8578c4125ecf475f4cdbd412f13d8687e816cda5/embedo.js#L607-L611 | train |
CMUI/CMUI | src/js/btn.js | _iniBtnWrapper | function _iniBtnWrapper() {
var $wrapper = gearbox.dom.$body || gearbox.dom.$root
$wrapper.on('click', function (ev) {
var $target = gearbox.$(ev.target)
if ($target.hasClass(CLS_BTN_WRAPPER) && !$target.hasClass(CLS_BTN_DISABLED)) {
var $btnWrapper = $target
var selBtn = ([].concat('.' + CLS_BTN, BTN... | javascript | function _iniBtnWrapper() {
var $wrapper = gearbox.dom.$body || gearbox.dom.$root
$wrapper.on('click', function (ev) {
var $target = gearbox.$(ev.target)
if ($target.hasClass(CLS_BTN_WRAPPER) && !$target.hasClass(CLS_BTN_DISABLED)) {
var $btnWrapper = $target
var selBtn = ([].concat('.' + CLS_BTN, BTN... | [
"function",
"_iniBtnWrapper",
"(",
")",
"{",
"var",
"$wrapper",
"=",
"gearbox",
".",
"dom",
".",
"$body",
"||",
"gearbox",
".",
"dom",
".",
"$root",
"$wrapper",
".",
"on",
"(",
"'click'",
",",
"function",
"(",
"ev",
")",
"{",
"var",
"$target",
"=",
"... | util
if click on a btn wrapper, trigger `click` event on the btn inside of the wrapper
@private | [
"util",
"if",
"click",
"on",
"a",
"btn",
"wrapper",
"trigger",
"click",
"event",
"on",
"the",
"btn",
"inside",
"of",
"the",
"wrapper"
] | a0fd7f323bd2cf2f327ef6a5dc638e0b9e69a699 | https://github.com/CMUI/CMUI/blob/a0fd7f323bd2cf2f327ef6a5dc638e0b9e69a699/src/js/btn.js#L23-L36 | train |
pimterry/server-components | src/index.js | renderNode | function renderNode(rootNode) {
let createdPromises = [];
var document = getDocument(rootNode);
recurseTree(rootNode, (foundNode) => {
if (foundNode.tagName) {
let nodeType = foundNode.tagName.toLowerCase();
let customElement = registeredElements[nodeType];
if (... | javascript | function renderNode(rootNode) {
let createdPromises = [];
var document = getDocument(rootNode);
recurseTree(rootNode, (foundNode) => {
if (foundNode.tagName) {
let nodeType = foundNode.tagName.toLowerCase();
let customElement = registeredElements[nodeType];
if (... | [
"function",
"renderNode",
"(",
"rootNode",
")",
"{",
"let",
"createdPromises",
"=",
"[",
"]",
";",
"var",
"document",
"=",
"getDocument",
"(",
"rootNode",
")",
";",
"recurseTree",
"(",
"rootNode",
",",
"(",
"foundNode",
")",
"=>",
"{",
"if",
"(",
"foundN... | Takes a full Domino node object. Traverses within it and renders all the custom elements found.
Returns a promise for the document object itself, resolved when every custom element has
resolved, and rejected if any of them are rejected. | [
"Takes",
"a",
"full",
"Domino",
"node",
"object",
".",
"Traverses",
"within",
"it",
"and",
"renders",
"all",
"the",
"custom",
"elements",
"found",
".",
"Returns",
"a",
"promise",
"for",
"the",
"document",
"object",
"itself",
"resolved",
"when",
"every",
"cus... | c97a9f883db61490f35a1a9fc68316e3fa322e89 | https://github.com/pimterry/server-components/blob/c97a9f883db61490f35a1a9fc68316e3fa322e89/src/index.js#L88-L110 | train |
MrMaxie/get-google-fonts | main.js | format | function format(template, values) {
return Object
.entries(values)
.filter(
([key]) => /^[a-z0-9_-]+$/gi.test(key)
)
.map(
([key, value]) =>
[new RegExp(`([^{]|^){${key}}([^}]|$)`,'g'), `$1${value}$2`]
)
.reduce(
(str, [regexp, replacement]) => {
return str.replace(regexp, replacement)
... | javascript | function format(template, values) {
return Object
.entries(values)
.filter(
([key]) => /^[a-z0-9_-]+$/gi.test(key)
)
.map(
([key, value]) =>
[new RegExp(`([^{]|^){${key}}([^}]|$)`,'g'), `$1${value}$2`]
)
.reduce(
(str, [regexp, replacement]) => {
return str.replace(regexp, replacement)
... | [
"function",
"format",
"(",
"template",
",",
"values",
")",
"{",
"return",
"Object",
".",
"entries",
"(",
"values",
")",
".",
"filter",
"(",
"(",
"[",
"key",
"]",
")",
"=>",
"/",
"^[a-z0-9_-]+$",
"/",
"gi",
".",
"test",
"(",
"key",
")",
")",
".",
... | Replace in-string variables with their values from given object
@param {String} template
@param {Object} values
@return {String} | [
"Replace",
"in",
"-",
"string",
"variables",
"with",
"their",
"values",
"from",
"given",
"object"
] | 1f166b361773019d8b9145a8363b2089cfef905e | https://github.com/MrMaxie/get-google-fonts/blob/1f166b361773019d8b9145a8363b2089cfef905e/main.js#L41-L57 | train |
MrMaxie/get-google-fonts | main.js | filterConfig | function filterConfig(config) {
return Object
.entries(config)
.filter(
([key, value]) =>
typeof value === typeof DEFAULT_CONFIG[key]
)
.reduce(
(obj, [key, value]) => {
obj[key] = value
return obj
}, {}
)
} | javascript | function filterConfig(config) {
return Object
.entries(config)
.filter(
([key, value]) =>
typeof value === typeof DEFAULT_CONFIG[key]
)
.reduce(
(obj, [key, value]) => {
obj[key] = value
return obj
}, {}
)
} | [
"function",
"filterConfig",
"(",
"config",
")",
"{",
"return",
"Object",
".",
"entries",
"(",
"config",
")",
".",
"filter",
"(",
"(",
"[",
"key",
",",
"value",
"]",
")",
"=>",
"typeof",
"value",
"===",
"typeof",
"DEFAULT_CONFIG",
"[",
"key",
"]",
")",
... | Allows to filter config object
@param {Object} config
@return {Object} | [
"Allows",
"to",
"filter",
"config",
"object"
] | 1f166b361773019d8b9145a8363b2089cfef905e | https://github.com/MrMaxie/get-google-fonts/blob/1f166b361773019d8b9145a8363b2089cfef905e/main.js#L63-L76 | train |
MrMaxie/get-google-fonts | main.js | downloadString | function downloadString(url, {userAgent}) {
let deferred = Q.defer()
let startTime = Date.now()
let data = ''
request({
method: 'GET',
url: url,
headers: {
'User-Agent': userAgent
}
}, function(error, response, body) {
if(error) {
deferred.reject(new Error(error))
return;
}
deferred.resolve... | javascript | function downloadString(url, {userAgent}) {
let deferred = Q.defer()
let startTime = Date.now()
let data = ''
request({
method: 'GET',
url: url,
headers: {
'User-Agent': userAgent
}
}, function(error, response, body) {
if(error) {
deferred.reject(new Error(error))
return;
}
deferred.resolve... | [
"function",
"downloadString",
"(",
"url",
",",
"{",
"userAgent",
"}",
")",
"{",
"let",
"deferred",
"=",
"Q",
".",
"defer",
"(",
")",
"let",
"startTime",
"=",
"Date",
".",
"now",
"(",
")",
"let",
"data",
"=",
"''",
"request",
"(",
"{",
"method",
":"... | Download given url to string
@param {String} url
@return {Promise} | [
"Download",
"given",
"url",
"to",
"string"
] | 1f166b361773019d8b9145a8363b2089cfef905e | https://github.com/MrMaxie/get-google-fonts/blob/1f166b361773019d8b9145a8363b2089cfef905e/main.js#L82-L104 | train |
MrMaxie/get-google-fonts | main.js | arrayFrom | function arrayFrom(arrayLike, delimiter=',') {
if(typeof arrayLike === 'string')
return arrayLike.split(delimiter)
return Array.from(arrayLike)
} | javascript | function arrayFrom(arrayLike, delimiter=',') {
if(typeof arrayLike === 'string')
return arrayLike.split(delimiter)
return Array.from(arrayLike)
} | [
"function",
"arrayFrom",
"(",
"arrayLike",
",",
"delimiter",
"=",
"','",
")",
"{",
"if",
"(",
"typeof",
"arrayLike",
"===",
"'string'",
")",
"return",
"arrayLike",
".",
"split",
"(",
"delimiter",
")",
"return",
"Array",
".",
"from",
"(",
"arrayLike",
")",
... | Array parser helper
@param {Mixed} arrayLike
@param {String} delimiter
@return {Array} | [
"Array",
"parser",
"helper"
] | 1f166b361773019d8b9145a8363b2089cfef905e | https://github.com/MrMaxie/get-google-fonts/blob/1f166b361773019d8b9145a8363b2089cfef905e/main.js#L111-L115 | train |
MrMaxie/get-google-fonts | main.js | repairUrl | function repairUrl(url) {
return normalizeUrl(url
.replace(/&/gi, '&')
.replace(/</gi, '<')
.replace(/>/gi, '>')
.replace(/"/gi, '"')
.replace(/'/gi, '\'')
)
.trim()
.replace(/\s+/g,'+')
} | javascript | function repairUrl(url) {
return normalizeUrl(url
.replace(/&/gi, '&')
.replace(/</gi, '<')
.replace(/>/gi, '>')
.replace(/"/gi, '"')
.replace(/'/gi, '\'')
)
.trim()
.replace(/\s+/g,'+')
} | [
"function",
"repairUrl",
"(",
"url",
")",
"{",
"return",
"normalizeUrl",
"(",
"url",
".",
"replace",
"(",
"/",
"&",
"/",
"gi",
",",
"'&'",
")",
".",
"replace",
"(",
"/",
"<",
"/",
"gi",
",",
"'<'",
")",
".",
"replace",
"(",
"/",
">",
"/... | Normalize given URL
@param {String} url
@return {String} | [
"Normalize",
"given",
"URL"
] | 1f166b361773019d8b9145a8363b2089cfef905e | https://github.com/MrMaxie/get-google-fonts/blob/1f166b361773019d8b9145a8363b2089cfef905e/main.js#L121-L131 | train |
jonschlinkert/extend-shallow | benchmark/code/1-1-4.js | extend | function extend(o) {
if (typeOf(o) !== 'object') { return {}; }
var args = arguments;
var len = args.length - 1;
for (var i = 0; i < len; i++) {
var obj = args[i + 1];
if (typeOf(obj) === 'object' && typeOf(obj) !== 'regexp') {
for (var key in obj) {
if (obj.hasOwnProperty(key)) {
... | javascript | function extend(o) {
if (typeOf(o) !== 'object') { return {}; }
var args = arguments;
var len = args.length - 1;
for (var i = 0; i < len; i++) {
var obj = args[i + 1];
if (typeOf(obj) === 'object' && typeOf(obj) !== 'regexp') {
for (var key in obj) {
if (obj.hasOwnProperty(key)) {
... | [
"function",
"extend",
"(",
"o",
")",
"{",
"if",
"(",
"typeOf",
"(",
"o",
")",
"!==",
"'object'",
")",
"{",
"return",
"{",
"}",
";",
"}",
"var",
"args",
"=",
"arguments",
";",
"var",
"len",
"=",
"args",
".",
"length",
"-",
"1",
";",
"for",
"(",
... | Extend `o` with properties of other `objects`.
@param {Object} `o` The target object. Pass an empty object to shallow clone.
@param {Object} `objects`
@return {Object} | [
"Extend",
"o",
"with",
"properties",
"of",
"other",
"objects",
"."
] | 33698c3df7804f0d0e3ea98caa64d53f09c37bd4 | https://github.com/jonschlinkert/extend-shallow/blob/33698c3df7804f0d0e3ea98caa64d53f09c37bd4/benchmark/code/1-1-4.js#L19-L36 | train |
andyearnshaw/rollup-plugin-bundle-worker | src/index.js | function (id) {
if (!paths.has(id)) {
return;
}
var code = [
`import shimWorker from 'rollup-plugin-bundle-worker';`,
`export default new shimWorker(${JSON.stringify(paths.get(id))}, function (window, document) {`,
... | javascript | function (id) {
if (!paths.has(id)) {
return;
}
var code = [
`import shimWorker from 'rollup-plugin-bundle-worker';`,
`export default new shimWorker(${JSON.stringify(paths.get(id))}, function (window, document) {`,
... | [
"function",
"(",
"id",
")",
"{",
"if",
"(",
"!",
"paths",
".",
"has",
"(",
"id",
")",
")",
"{",
"return",
";",
"}",
"var",
"code",
"=",
"[",
"`",
"`",
",",
"`",
"${",
"JSON",
".",
"stringify",
"(",
"paths",
".",
"get",
"(",
"id",
")",
")",
... | Do everything in load so that code loaded by the plugin can still be transformed by the
rollup configuration | [
"Do",
"everything",
"in",
"load",
"so",
"that",
"code",
"loaded",
"by",
"the",
"plugin",
"can",
"still",
"be",
"transformed",
"by",
"the",
"rollup",
"configuration"
] | 1c92add8aa3ebc590ebd258fc644ed147fab3d79 | https://github.com/andyearnshaw/rollup-plugin-bundle-worker/blob/1c92add8aa3ebc590ebd258fc644ed147fab3d79/src/index.js#L24-L38 | train | |
zgreen/postcss-critical-css | lib/atRule.js | getCriticalFromAtRule | function getCriticalFromAtRule(args) {
var result = {};
var options = _extends({
defaultDest: 'critical.css',
css: _postcss2.default.root()
}, args);
options.css.walkAtRules('critical', function (atRule) {
var name = atRule.params ? atRule.params : options.defaultDest;
// If rule has no nodes, ... | javascript | function getCriticalFromAtRule(args) {
var result = {};
var options = _extends({
defaultDest: 'critical.css',
css: _postcss2.default.root()
}, args);
options.css.walkAtRules('critical', function (atRule) {
var name = atRule.params ? atRule.params : options.defaultDest;
// If rule has no nodes, ... | [
"function",
"getCriticalFromAtRule",
"(",
"args",
")",
"{",
"var",
"result",
"=",
"{",
"}",
";",
"var",
"options",
"=",
"_extends",
"(",
"{",
"defaultDest",
":",
"'critical.css'",
",",
"css",
":",
"_postcss2",
".",
"default",
".",
"root",
"(",
")",
"}",
... | Get critical CSS from an at-rule.
@param {Object} args Function args. See flow type alias. | [
"Get",
"critical",
"CSS",
"from",
"an",
"at",
"-",
"rule",
"."
] | 33bed8bc678dd3f66b8b114414804dbe284ab672 | https://github.com/zgreen/postcss-critical-css/blob/33bed8bc678dd3f66b8b114414804dbe284ab672/lib/atRule.js#L22-L43 | train |
zgreen/postcss-critical-css | lib/index.js | dryRunOrWriteFile | function dryRunOrWriteFile(dryRun, filePath, result) {
var css = result.css;
return new Promise(function (resolve) {
return resolve(dryRun ? doDryRun(css) : writeCriticalFile(filePath, css));
});
} | javascript | function dryRunOrWriteFile(dryRun, filePath, result) {
var css = result.css;
return new Promise(function (resolve) {
return resolve(dryRun ? doDryRun(css) : writeCriticalFile(filePath, css));
});
} | [
"function",
"dryRunOrWriteFile",
"(",
"dryRun",
",",
"filePath",
",",
"result",
")",
"{",
"var",
"css",
"=",
"result",
".",
"css",
";",
"return",
"new",
"Promise",
"(",
"function",
"(",
"resolve",
")",
"{",
"return",
"resolve",
"(",
"dryRun",
"?",
"doDry... | Do a dry run, or write a file.
@param {bool} dryRun Do a dry run?
@param {string} filePath Path to write file to.
@param {Object} result PostCSS root object.
@return {Promise} Resolves with writeCriticalFile or doDryRun function call. | [
"Do",
"a",
"dry",
"run",
"or",
"write",
"a",
"file",
"."
] | 33bed8bc678dd3f66b8b114414804dbe284ab672 | https://github.com/zgreen/postcss-critical-css/blob/33bed8bc678dd3f66b8b114414804dbe284ab672/lib/index.js#L106-L112 | train |
zgreen/postcss-critical-css | lib/index.js | hasNoOtherChildNodes | function hasNoOtherChildNodes() {
var nodes = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
var node = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _postcss2.default.root();
return nodes.filter(function (child) {
return child !== node;
}).length === 0;
} | javascript | function hasNoOtherChildNodes() {
var nodes = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
var node = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _postcss2.default.root();
return nodes.filter(function (child) {
return child !== node;
}).length === 0;
} | [
"function",
"hasNoOtherChildNodes",
"(",
")",
"{",
"var",
"nodes",
"=",
"arguments",
".",
"length",
">",
"0",
"&&",
"arguments",
"[",
"0",
"]",
"!==",
"undefined",
"?",
"arguments",
"[",
"0",
"]",
":",
"[",
"]",
";",
"var",
"node",
"=",
"arguments",
... | Confirm a node has no child nodes other than a specific node.
@param {array} nodes Nodes array to check.
@param {Object} node Node to check.
@return {boolean} Whether or not the node has no other children. | [
"Confirm",
"a",
"node",
"has",
"no",
"child",
"nodes",
"other",
"than",
"a",
"specific",
"node",
"."
] | 33bed8bc678dd3f66b8b114414804dbe284ab672 | https://github.com/zgreen/postcss-critical-css/blob/33bed8bc678dd3f66b8b114414804dbe284ab672/lib/index.js#L121-L128 | train |
zgreen/postcss-critical-css | lib/index.js | writeCriticalFile | function writeCriticalFile(filePath, css) {
_fs2.default.writeFile(filePath, css, { flag: append ? 'a' : 'w' }, function (err) {
append = true;
if (err) {
console.error(err);
process.exit(1);
}
});
} | javascript | function writeCriticalFile(filePath, css) {
_fs2.default.writeFile(filePath, css, { flag: append ? 'a' : 'w' }, function (err) {
append = true;
if (err) {
console.error(err);
process.exit(1);
}
});
} | [
"function",
"writeCriticalFile",
"(",
"filePath",
",",
"css",
")",
"{",
"_fs2",
".",
"default",
".",
"writeFile",
"(",
"filePath",
",",
"css",
",",
"{",
"flag",
":",
"append",
"?",
"'a'",
":",
"'w'",
"}",
",",
"function",
"(",
"err",
")",
"{",
"appen... | Write a file containing critical CSS.
@param {string} filePath Path to write file to.
@param {string} css CSS to write to file. | [
"Write",
"a",
"file",
"containing",
"critical",
"CSS",
"."
] | 33bed8bc678dd3f66b8b114414804dbe284ab672 | https://github.com/zgreen/postcss-critical-css/blob/33bed8bc678dd3f66b8b114414804dbe284ab672/lib/index.js#L136-L144 | train |
zgreen/postcss-critical-css | lib/index.js | buildCritical | function buildCritical() {
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var filteredOptions = Object.keys(options).reduce(function (acc, key) {
return typeof options[key] !== 'undefined' ? _extends({}, acc, _defineProperty({}, key, options[key])) : acc;
}, {});
var ... | javascript | function buildCritical() {
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var filteredOptions = Object.keys(options).reduce(function (acc, key) {
return typeof options[key] !== 'undefined' ? _extends({}, acc, _defineProperty({}, key, options[key])) : acc;
}, {});
var ... | [
"function",
"buildCritical",
"(",
")",
"{",
"var",
"options",
"=",
"arguments",
".",
"length",
">",
"0",
"&&",
"arguments",
"[",
"0",
"]",
"!==",
"undefined",
"?",
"arguments",
"[",
"0",
"]",
":",
"{",
"}",
";",
"var",
"filteredOptions",
"=",
"Object",... | Primary plugin function.
@param {object} options Object of function args.
@return {function} function for PostCSS plugin. | [
"Primary",
"plugin",
"function",
"."
] | 33bed8bc678dd3f66b8b114414804dbe284ab672 | https://github.com/zgreen/postcss-critical-css/blob/33bed8bc678dd3f66b8b114414804dbe284ab672/lib/index.js#L152-L187 | train |
zgreen/postcss-critical-css | lib/getCriticalRules.js | clean | function clean(root) {
var test = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'critical-selector';
var clone = root.clone();
if (clone.type === 'decl') {
clone.remove();
} else {
clone.walkDecls(test, function (decl) {
decl.remove();
});
}
return clone;
} | javascript | function clean(root) {
var test = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'critical-selector';
var clone = root.clone();
if (clone.type === 'decl') {
clone.remove();
} else {
clone.walkDecls(test, function (decl) {
decl.remove();
});
}
return clone;
} | [
"function",
"clean",
"(",
"root",
")",
"{",
"var",
"test",
"=",
"arguments",
".",
"length",
">",
"1",
"&&",
"arguments",
"[",
"1",
"]",
"!==",
"undefined",
"?",
"arguments",
"[",
"1",
"]",
":",
"'critical-selector'",
";",
"var",
"clone",
"=",
"root",
... | Clean a root node of a declaration.
@param {Object} root PostCSS root node.
@param {string} test Declaration string. Default `critical-selector`
@return {Object} clone Cloned, cleaned root node. | [
"Clean",
"a",
"root",
"node",
"of",
"a",
"declaration",
"."
] | 33bed8bc678dd3f66b8b114414804dbe284ab672 | https://github.com/zgreen/postcss-critical-css/blob/33bed8bc678dd3f66b8b114414804dbe284ab672/lib/getCriticalRules.js#L27-L39 | train |
zgreen/postcss-critical-css | lib/getCriticalRules.js | correctSourceOrder | function correctSourceOrder(root) {
var sortedRoot = _postcss2.default.root();
var clone = root.clone();
clone.walkRules(function (rule) {
var start = rule.source.start.line;
if (rule.parent.type === 'atrule') {
var child = rule;
rule = _postcss2.default.atRule({
name: rule.parent.name... | javascript | function correctSourceOrder(root) {
var sortedRoot = _postcss2.default.root();
var clone = root.clone();
clone.walkRules(function (rule) {
var start = rule.source.start.line;
if (rule.parent.type === 'atrule') {
var child = rule;
rule = _postcss2.default.atRule({
name: rule.parent.name... | [
"function",
"correctSourceOrder",
"(",
"root",
")",
"{",
"var",
"sortedRoot",
"=",
"_postcss2",
".",
"default",
".",
"root",
"(",
")",
";",
"var",
"clone",
"=",
"root",
".",
"clone",
"(",
")",
";",
"clone",
".",
"walkRules",
"(",
"function",
"(",
"rule... | Correct the source order of nodes in a root.
@param {Object} root PostCSS root node.
@return {Object} sortedRoot Root with nodes sorted by source order. | [
"Correct",
"the",
"source",
"order",
"of",
"nodes",
"in",
"a",
"root",
"."
] | 33bed8bc678dd3f66b8b114414804dbe284ab672 | https://github.com/zgreen/postcss-critical-css/blob/33bed8bc678dd3f66b8b114414804dbe284ab672/lib/getCriticalRules.js#L47-L68 | train |
zgreen/postcss-critical-css | lib/getCriticalRules.js | establishContainer | function establishContainer(node) {
return node.parent.type === 'atrule' && node.parent.name !== 'critical' ? _postcss2.default.atRule({
name: node.parent.name,
type: node.parent.type,
params: node.parent.params,
nodes: [node]
}) : node.clone();
} | javascript | function establishContainer(node) {
return node.parent.type === 'atrule' && node.parent.name !== 'critical' ? _postcss2.default.atRule({
name: node.parent.name,
type: node.parent.type,
params: node.parent.params,
nodes: [node]
}) : node.clone();
} | [
"function",
"establishContainer",
"(",
"node",
")",
"{",
"return",
"node",
".",
"parent",
".",
"type",
"===",
"'atrule'",
"&&",
"node",
".",
"parent",
".",
"name",
"!==",
"'critical'",
"?",
"_postcss2",
".",
"default",
".",
"atRule",
"(",
"{",
"name",
":... | Establish the container of a given node. Useful when preserving media queries
or other atrules.
@param {Object} node PostCSS node.
@return {Object} A new root node with an atrule at its base. | [
"Establish",
"the",
"container",
"of",
"a",
"given",
"node",
".",
"Useful",
"when",
"preserving",
"media",
"queries",
"or",
"other",
"atrules",
"."
] | 33bed8bc678dd3f66b8b114414804dbe284ab672 | https://github.com/zgreen/postcss-critical-css/blob/33bed8bc678dd3f66b8b114414804dbe284ab672/lib/getCriticalRules.js#L77-L84 | train |
zgreen/postcss-critical-css | lib/getCriticalRules.js | updateCritical | function updateCritical(root, update) {
var clonedRoot = root.clone();
if (update.type === 'rule') {
clonedRoot.append(clean(update.clone()));
} else {
update.clone().each(function (rule) {
clonedRoot.append(clean(rule.root()));
});
}
return clonedRoot;
} | javascript | function updateCritical(root, update) {
var clonedRoot = root.clone();
if (update.type === 'rule') {
clonedRoot.append(clean(update.clone()));
} else {
update.clone().each(function (rule) {
clonedRoot.append(clean(rule.root()));
});
}
return clonedRoot;
} | [
"function",
"updateCritical",
"(",
"root",
",",
"update",
")",
"{",
"var",
"clonedRoot",
"=",
"root",
".",
"clone",
"(",
")",
";",
"if",
"(",
"update",
".",
"type",
"===",
"'rule'",
")",
"{",
"clonedRoot",
".",
"append",
"(",
"clean",
"(",
"update",
... | Update a critical root.
@param {Object} root Root object to update.
@param {Object} update Update object.
@return {Object} clonedRoot Root object. | [
"Update",
"a",
"critical",
"root",
"."
] | 33bed8bc678dd3f66b8b114414804dbe284ab672 | https://github.com/zgreen/postcss-critical-css/blob/33bed8bc678dd3f66b8b114414804dbe284ab672/lib/getCriticalRules.js#L93-L103 | train |
zgreen/postcss-critical-css | lib/getCriticalDestination.js | getCriticalDestination | function getCriticalDestination(rule, dest) {
rule.walkDecls('critical-filename', function (decl) {
dest = decl.value.replace(/['"]*/g, '');
decl.remove();
});
return dest;
} | javascript | function getCriticalDestination(rule, dest) {
rule.walkDecls('critical-filename', function (decl) {
dest = decl.value.replace(/['"]*/g, '');
decl.remove();
});
return dest;
} | [
"function",
"getCriticalDestination",
"(",
"rule",
",",
"dest",
")",
"{",
"rule",
".",
"walkDecls",
"(",
"'critical-filename'",
",",
"function",
"(",
"decl",
")",
"{",
"dest",
"=",
"decl",
".",
"value",
".",
"replace",
"(",
"/",
"['\"]*",
"/",
"g",
",",
... | Identify critical CSS destinations.
@param {object} rule PostCSS rule.
@param {string} Default output CSS file name.
@return {string} String corresponding to output destination. | [
"Identify",
"critical",
"CSS",
"destinations",
"."
] | 33bed8bc678dd3f66b8b114414804dbe284ab672 | https://github.com/zgreen/postcss-critical-css/blob/33bed8bc678dd3f66b8b114414804dbe284ab672/lib/getCriticalDestination.js#L16-L22 | train |
jridgewell/babel-plugin-transform-incremental-dom | src/helpers/runtime/spread-attribute.js | spreadAttributeAST | function spreadAttributeAST(plugin, ref, deps) {
const { hasOwn } = deps;
const spread = t.identifier("spread");
const prop = t.identifier("prop");
/**
* function _spreadAttribute(spread) {
* for (var prop in spread) {
* if (_hasOwn.call(spread, prop)) {
* attr(prop, spread[prop]);
*... | javascript | function spreadAttributeAST(plugin, ref, deps) {
const { hasOwn } = deps;
const spread = t.identifier("spread");
const prop = t.identifier("prop");
/**
* function _spreadAttribute(spread) {
* for (var prop in spread) {
* if (_hasOwn.call(spread, prop)) {
* attr(prop, spread[prop]);
*... | [
"function",
"spreadAttributeAST",
"(",
"plugin",
",",
"ref",
",",
"deps",
")",
"{",
"const",
"{",
"hasOwn",
"}",
"=",
"deps",
";",
"const",
"spread",
"=",
"t",
".",
"identifier",
"(",
"\"spread\"",
")",
";",
"const",
"prop",
"=",
"t",
".",
"identifier"... | Iterates over a SpreadAttribute, assigning each property as an attribute on the element. | [
"Iterates",
"over",
"a",
"SpreadAttribute",
"assigning",
"each",
"property",
"as",
"an",
"attribute",
"on",
"the",
"element",
"."
] | 4ee2b244c0876338b6a7b6f2d6bae210712f8894 | https://github.com/jridgewell/babel-plugin-transform-incremental-dom/blob/4ee2b244c0876338b6a7b6f2d6bae210712f8894/src/helpers/runtime/spread-attribute.js#L9-L43 | train |
jridgewell/babel-plugin-transform-incremental-dom | src/helpers/root-jsx.js | inPatchRoot | function inPatchRoot(path, plugin) {
const { opts } = plugin;
if (useFastRoot(path, opts)) {
return true;
}
const roots = patchRoots(plugin)
return !roots.length || path.findParent((parent) => {
return roots.indexOf(parent) > -1;
});
} | javascript | function inPatchRoot(path, plugin) {
const { opts } = plugin;
if (useFastRoot(path, opts)) {
return true;
}
const roots = patchRoots(plugin)
return !roots.length || path.findParent((parent) => {
return roots.indexOf(parent) > -1;
});
} | [
"function",
"inPatchRoot",
"(",
"path",
",",
"plugin",
")",
"{",
"const",
"{",
"opts",
"}",
"=",
"plugin",
";",
"if",
"(",
"useFastRoot",
"(",
"path",
",",
"opts",
")",
")",
"{",
"return",
"true",
";",
"}",
"const",
"roots",
"=",
"patchRoots",
"(",
... | Determines if the JSX element is nested inside a patch's rendering function. | [
"Determines",
"if",
"the",
"JSX",
"element",
"is",
"nested",
"inside",
"a",
"patch",
"s",
"rendering",
"function",
"."
] | 4ee2b244c0876338b6a7b6f2d6bae210712f8894 | https://github.com/jridgewell/babel-plugin-transform-incremental-dom/blob/4ee2b244c0876338b6a7b6f2d6bae210712f8894/src/helpers/root-jsx.js#L23-L33 | train |
jridgewell/babel-plugin-transform-incremental-dom | src/helpers/runtime/render-arbitrary.js | isArray | function isArray(value) {
return toFunctionCall(
t.memberExpression(
t.identifier("Array"),
t.identifier("isArray")
),
[value]
);
} | javascript | function isArray(value) {
return toFunctionCall(
t.memberExpression(
t.identifier("Array"),
t.identifier("isArray")
),
[value]
);
} | [
"function",
"isArray",
"(",
"value",
")",
"{",
"return",
"toFunctionCall",
"(",
"t",
".",
"memberExpression",
"(",
"t",
".",
"identifier",
"(",
"\"Array\"",
")",
",",
"t",
".",
"identifier",
"(",
"\"isArray\"",
")",
")",
",",
"[",
"value",
"]",
")",
";... | Isolated AST code to determine if a value an Array. | [
"Isolated",
"AST",
"code",
"to",
"determine",
"if",
"a",
"value",
"an",
"Array",
"."
] | 4ee2b244c0876338b6a7b6f2d6bae210712f8894 | https://github.com/jridgewell/babel-plugin-transform-incremental-dom/blob/4ee2b244c0876338b6a7b6f2d6bae210712f8894/src/helpers/runtime/render-arbitrary.js#L26-L34 | train |
jridgewell/babel-plugin-transform-incremental-dom | src/helpers/runtime/render-arbitrary.js | isPlainObject | function isPlainObject(value) {
return t.binaryExpression(
"===",
toFunctionCall(t.identifier("String"), [value]),
t.stringLiteral("[object Object]")
);
} | javascript | function isPlainObject(value) {
return t.binaryExpression(
"===",
toFunctionCall(t.identifier("String"), [value]),
t.stringLiteral("[object Object]")
);
} | [
"function",
"isPlainObject",
"(",
"value",
")",
"{",
"return",
"t",
".",
"binaryExpression",
"(",
"\"===\"",
",",
"toFunctionCall",
"(",
"t",
".",
"identifier",
"(",
"\"String\"",
")",
",",
"[",
"value",
"]",
")",
",",
"t",
".",
"stringLiteral",
"(",
"\"... | Isolated AST to determine if the value is a "plain" object. | [
"Isolated",
"AST",
"to",
"determine",
"if",
"the",
"value",
"is",
"a",
"plain",
"object",
"."
] | 4ee2b244c0876338b6a7b6f2d6bae210712f8894 | https://github.com/jridgewell/babel-plugin-transform-incremental-dom/blob/4ee2b244c0876338b6a7b6f2d6bae210712f8894/src/helpers/runtime/render-arbitrary.js#L51-L57 | train |
jridgewell/babel-plugin-transform-incremental-dom | src/helpers/runtime/render-arbitrary.js | renderArbitraryAST | function renderArbitraryAST(plugin, ref, deps) {
const { hasOwn } = deps;
const child = t.identifier("child");
const type = t.identifier("type");
const func = t.identifier("func");
const args = t.identifier("args");
const i = t.identifier("i");
const prop = t.identifier("prop");
/**
* function _rend... | javascript | function renderArbitraryAST(plugin, ref, deps) {
const { hasOwn } = deps;
const child = t.identifier("child");
const type = t.identifier("type");
const func = t.identifier("func");
const args = t.identifier("args");
const i = t.identifier("i");
const prop = t.identifier("prop");
/**
* function _rend... | [
"function",
"renderArbitraryAST",
"(",
"plugin",
",",
"ref",
",",
"deps",
")",
"{",
"const",
"{",
"hasOwn",
"}",
"=",
"deps",
";",
"const",
"child",
"=",
"t",
".",
"identifier",
"(",
"\"child\"",
")",
";",
"const",
"type",
"=",
"t",
".",
"identifier",
... | Renders an arbitrary JSX Expression into the DOM. Valid types are strings, numbers, and JSX element closures. It may also be an Array or Object, which will be iterated recursively to find a valid type. | [
"Renders",
"an",
"arbitrary",
"JSX",
"Expression",
"into",
"the",
"DOM",
".",
"Valid",
"types",
"are",
"strings",
"numbers",
"and",
"JSX",
"element",
"closures",
".",
"It",
"may",
"also",
"be",
"an",
"Array",
"or",
"Object",
"which",
"will",
"be",
"iterate... | 4ee2b244c0876338b6a7b6f2d6bae210712f8894 | https://github.com/jridgewell/babel-plugin-transform-incremental-dom/blob/4ee2b244c0876338b6a7b6f2d6bae210712f8894/src/helpers/runtime/render-arbitrary.js#L64-L174 | train |
jridgewell/babel-plugin-transform-incremental-dom | src/helpers/hoist.js | generateHoistNameBasedOn | function generateHoistNameBasedOn(path, suffix = "") {
const names = [];
if (suffix) {
names.push(suffix);
}
let current = path;
while (!(current.isIdentifier() || current.isJSXIdentifier())) {
names.push(current.node.property.name);
current = current.get("object");
}
names.push(current.node.... | javascript | function generateHoistNameBasedOn(path, suffix = "") {
const names = [];
if (suffix) {
names.push(suffix);
}
let current = path;
while (!(current.isIdentifier() || current.isJSXIdentifier())) {
names.push(current.node.property.name);
current = current.get("object");
}
names.push(current.node.... | [
"function",
"generateHoistNameBasedOn",
"(",
"path",
",",
"suffix",
"=",
"\"\"",
")",
"{",
"const",
"names",
"=",
"[",
"]",
";",
"if",
"(",
"suffix",
")",
"{",
"names",
".",
"push",
"(",
"suffix",
")",
";",
"}",
"let",
"current",
"=",
"path",
";",
... | Name Smartly Do Good. | [
"Name",
"Smartly",
"Do",
"Good",
"."
] | 4ee2b244c0876338b6a7b6f2d6bae210712f8894 | https://github.com/jridgewell/babel-plugin-transform-incremental-dom/blob/4ee2b244c0876338b6a7b6f2d6bae210712f8894/src/helpers/hoist.js#L49-L63 | train |
jridgewell/babel-plugin-transform-incremental-dom | src/helpers/build-children.js | isStringConcatenation | function isStringConcatenation(path) {
if (!(path.isBinaryExpression() && path.node.operator === "+")) {
return false;
}
const left = path.get("left");
const right = path.get("right");
return left.isStringLiteral() ||
right.isStringLiteral() ||
isStringConcatenation(left) ||
isStringConcatena... | javascript | function isStringConcatenation(path) {
if (!(path.isBinaryExpression() && path.node.operator === "+")) {
return false;
}
const left = path.get("left");
const right = path.get("right");
return left.isStringLiteral() ||
right.isStringLiteral() ||
isStringConcatenation(left) ||
isStringConcatena... | [
"function",
"isStringConcatenation",
"(",
"path",
")",
"{",
"if",
"(",
"!",
"(",
"path",
".",
"isBinaryExpression",
"(",
")",
"&&",
"path",
".",
"node",
".",
"operator",
"===",
"\"+\"",
")",
")",
"{",
"return",
"false",
";",
"}",
"const",
"left",
"=",
... | String concatenations are special cased, so template literals don't require a call to renderArbitrary. | [
"String",
"concatenations",
"are",
"special",
"cased",
"so",
"template",
"literals",
"don",
"t",
"require",
"a",
"call",
"to",
"renderArbitrary",
"."
] | 4ee2b244c0876338b6a7b6f2d6bae210712f8894 | https://github.com/jridgewell/babel-plugin-transform-incremental-dom/blob/4ee2b244c0876338b6a7b6f2d6bae210712f8894/src/helpers/build-children.js#L12-L23 | train |
RedSeal-co/ts-tinkerpop | lib/tsJavaModule.js | beforeJvm | function beforeJvm() {
var moduleJars = ['target/ts-tinkerpop-3.0.1.GA.0.jar', 'target/dependency/commons-configuration-1.10.jar', 'target/dependency/commons-lang-2.6.jar', 'target/dependency/commons-lang3-3.3.1.jar', 'target/dependency/gremlin-core-3.0.1-incubating.jar', 'target/dependency/gremlin-groovy-3.0.1-inc... | javascript | function beforeJvm() {
var moduleJars = ['target/ts-tinkerpop-3.0.1.GA.0.jar', 'target/dependency/commons-configuration-1.10.jar', 'target/dependency/commons-lang-2.6.jar', 'target/dependency/commons-lang3-3.3.1.jar', 'target/dependency/gremlin-core-3.0.1-incubating.jar', 'target/dependency/gremlin-groovy-3.0.1-inc... | [
"function",
"beforeJvm",
"(",
")",
"{",
"var",
"moduleJars",
"=",
"[",
"'target/ts-tinkerpop-3.0.1.GA.0.jar'",
",",
"'target/dependency/commons-configuration-1.10.jar'",
",",
"'target/dependency/commons-lang-2.6.jar'",
",",
"'target/dependency/commons-lang3-3.3.1.jar'",
",",
"'targ... | JVM initialization callback which adds tsjava.classpath to the JVM classpath. | [
"JVM",
"initialization",
"callback",
"which",
"adds",
"tsjava",
".",
"classpath",
"to",
"the",
"JVM",
"classpath",
"."
] | 5b1485194407864aaa71134409f4b83b7cdaee1e | https://github.com/RedSeal-co/ts-tinkerpop/blob/5b1485194407864aaa71134409f4b83b7cdaee1e/lib/tsJavaModule.js#L22-L30 | train |
RedSeal-co/ts-tinkerpop | lib/tsJavaModule.js | instanceOf | function instanceOf(javaObject, className) {
var fullName = fullyQualifiedName(className) || className;
return smellsLikeJavaObject(javaObject) && _java.instanceOf(javaObject, fullName);
} | javascript | function instanceOf(javaObject, className) {
var fullName = fullyQualifiedName(className) || className;
return smellsLikeJavaObject(javaObject) && _java.instanceOf(javaObject, fullName);
} | [
"function",
"instanceOf",
"(",
"javaObject",
",",
"className",
")",
"{",
"var",
"fullName",
"=",
"fullyQualifiedName",
"(",
"className",
")",
"||",
"className",
";",
"return",
"smellsLikeJavaObject",
"(",
"javaObject",
")",
"&&",
"_java",
".",
"instanceOf",
"(",... | Returns true if javaObject is an instance of the named class, which may be a short className. Returns false if javaObject is not an instance of the named class. Throws an exception if the named class does not exist, or is an ambiguous short name. | [
"Returns",
"true",
"if",
"javaObject",
"is",
"an",
"instance",
"of",
"the",
"named",
"class",
"which",
"may",
"be",
"a",
"short",
"className",
".",
"Returns",
"false",
"if",
"javaObject",
"is",
"not",
"an",
"instance",
"of",
"the",
"named",
"class",
".",
... | 5b1485194407864aaa71134409f4b83b7cdaee1e | https://github.com/RedSeal-co/ts-tinkerpop/blob/5b1485194407864aaa71134409f4b83b7cdaee1e/lib/tsJavaModule.js#L488-L491 | train |
HTMLElements/smarthtmlelements-core | demos/accordion/methods/index.js | function() {
if (insertCounter === 3) {
insertBtn.disabled = true;
}
else {
insertBtn.disabled = false;
}
if (insertCounter === -3) {
removeBtn.disabled = true;
}
else {
removeBtn.disabled = false;
}
} | javascript | function() {
if (insertCounter === 3) {
insertBtn.disabled = true;
}
else {
insertBtn.disabled = false;
}
if (insertCounter === -3) {
removeBtn.disabled = true;
}
else {
removeBtn.disabled = false;
}
} | [
"function",
"(",
")",
"{",
"if",
"(",
"insertCounter",
"===",
"3",
")",
"{",
"insertBtn",
".",
"disabled",
"=",
"true",
";",
"}",
"else",
"{",
"insertBtn",
".",
"disabled",
"=",
"false",
";",
"}",
"if",
"(",
"insertCounter",
"===",
"-",
"3",
")",
"... | Insert, Update, Remove | [
"Insert",
"Update",
"Remove"
] | 80cc674fd954e3dba90644182479d67f0ffa1023 | https://github.com/HTMLElements/smarthtmlelements-core/blob/80cc674fd954e3dba90644182479d67f0ffa1023/demos/accordion/methods/index.js#L26-L40 | train | |
mradionov/eslint-plugin-disable | src/settings.js | prepare | function prepare(config) {
config = config || {};
var settings = config.settings && config.settings[constants.PLUGIN_NAME] || {};
// Set paths, convert string values to array
settings.paths = objValuesToArray(settings.paths || {});
// Set allExceptPaths, convert string values to array
settings.allExceptPa... | javascript | function prepare(config) {
config = config || {};
var settings = config.settings && config.settings[constants.PLUGIN_NAME] || {};
// Set paths, convert string values to array
settings.paths = objValuesToArray(settings.paths || {});
// Set allExceptPaths, convert string values to array
settings.allExceptPa... | [
"function",
"prepare",
"(",
"config",
")",
"{",
"config",
"=",
"config",
"||",
"{",
"}",
";",
"var",
"settings",
"=",
"config",
".",
"settings",
"&&",
"config",
".",
"settings",
"[",
"constants",
".",
"PLUGIN_NAME",
"]",
"||",
"{",
"}",
";",
"// Set pa... | Convert settings from config to use in plugin
@param {Object} config ESLint constructed config object
@return {Object} prettified settings object | [
"Convert",
"settings",
"from",
"config",
"to",
"use",
"in",
"plugin"
] | 19b4e341cc8769a9d20e8cbd50284a6a1b55efae | https://github.com/mradionov/eslint-plugin-disable/blob/19b4e341cc8769a9d20e8cbd50284a6a1b55efae/src/settings.js#L37-L60 | train |
jbreckmckye/trkl | trkl.js | subscribe | function subscribe(subscriber, immediate) {
if (!~subscribers.indexOf(subscriber)) {
subscribers.push(subscriber);
}
if (immediate) {
subscriber(value);
}
} | javascript | function subscribe(subscriber, immediate) {
if (!~subscribers.indexOf(subscriber)) {
subscribers.push(subscriber);
}
if (immediate) {
subscriber(value);
}
} | [
"function",
"subscribe",
"(",
"subscriber",
",",
"immediate",
")",
"{",
"if",
"(",
"!",
"~",
"subscribers",
".",
"indexOf",
"(",
"subscriber",
")",
")",
"{",
"subscribers",
".",
"push",
"(",
"subscriber",
")",
";",
"}",
"if",
"(",
"immediate",
")",
"{"... | declaring as a private function means the minifier can scrub its name on internal references | [
"declaring",
"as",
"a",
"private",
"function",
"means",
"the",
"minifier",
"can",
"scrub",
"its",
"name",
"on",
"internal",
"references"
] | e2660c5fd8b8339f959e033c7d90a6860c3570d6 | https://github.com/jbreckmckye/trkl/blob/e2660c5fd8b8339f959e033c7d90a6860c3570d6/trkl.js#L23-L30 | train |
zzarcon/gh-emoji | dist/gh-emoji.js | load | function load() {
return new Promise(function (resolve) {
if (emojis) return resolve(emojis);
return fetch(enpoint).then(function (r) {
return r.json();
}).then(function (response) {
emojis = response;
resolve(emojis);
});
});
} | javascript | function load() {
return new Promise(function (resolve) {
if (emojis) return resolve(emojis);
return fetch(enpoint).then(function (r) {
return r.json();
}).then(function (response) {
emojis = response;
resolve(emojis);
});
});
} | [
"function",
"load",
"(",
")",
"{",
"return",
"new",
"Promise",
"(",
"function",
"(",
"resolve",
")",
"{",
"if",
"(",
"emojis",
")",
"return",
"resolve",
"(",
"emojis",
")",
";",
"return",
"fetch",
"(",
"enpoint",
")",
".",
"then",
"(",
"function",
"(... | Fetch the emoji data from Github's api.
@example
import { load as loadEmojis } from 'gh-emoji';
loadEmojis().then((emojis) => {
console.log(emojis['+1']); // 👍
});
@returns {Promise<Object>} Promise which passes Object with emoji names
as keys and generated image tags as values to callback. | [
"Fetch",
"the",
"emoji",
"data",
"from",
"Github",
"s",
"api",
"."
] | ce3e1fa8ba8bf41c77a003cf6475e53456ff09f4 | https://github.com/zzarcon/gh-emoji/blob/ce3e1fa8ba8bf41c77a003cf6475e53456ff09f4/dist/gh-emoji.js#L126-L137 | train |
zzarcon/gh-emoji | dist/gh-emoji.js | parse | function parse(text) {
var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
var output = '';
var customClassNames = options.classNames ? options.classNames.trim().split(/\s+/) : '';
output += text.replace(delimiterRegex, function (match) {
var name = match.repla... | javascript | function parse(text) {
var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
var output = '';
var customClassNames = options.classNames ? options.classNames.trim().split(/\s+/) : '';
output += text.replace(delimiterRegex, function (match) {
var name = match.repla... | [
"function",
"parse",
"(",
"text",
")",
"{",
"var",
"options",
"=",
"arguments",
".",
"length",
"<=",
"1",
"||",
"arguments",
"[",
"1",
"]",
"===",
"undefined",
"?",
"{",
"}",
":",
"arguments",
"[",
"1",
"]",
";",
"var",
"output",
"=",
"''",
";",
... | Parse text and replace emoji tags with actual emoji symbols.
@example
import { load as loadEmojis, parse } from 'gh-emoji';
const text = 'Do you believe in :alien:...? :scream:';
loadEmojis().then(() => {
console.log(parse(text)) // 'Do you believe in 👽...? 😱';
});
@param {String} text Text to parse.
@param {Obje... | [
"Parse",
"text",
"and",
"replace",
"emoji",
"tags",
"with",
"actual",
"emoji",
"symbols",
"."
] | ce3e1fa8ba8bf41c77a003cf6475e53456ff09f4 | https://github.com/zzarcon/gh-emoji/blob/ce3e1fa8ba8bf41c77a003cf6475e53456ff09f4/dist/gh-emoji.js#L224-L250 | train |
weirdpattern/gatsby-remark-embed-gist | src/index.js | buildUrl | function buildUrl(value, options, file) {
const [gist] = value.split(/[?#]/);
const [inlineUsername, id] =
gist.indexOf("/") > 0 ? gist.split("/") : [null, gist];
// username can come from inline code or options
const username = inlineUsername || options.username;
// checks for a valid username
if (u... | javascript | function buildUrl(value, options, file) {
const [gist] = value.split(/[?#]/);
const [inlineUsername, id] =
gist.indexOf("/") > 0 ? gist.split("/") : [null, gist];
// username can come from inline code or options
const username = inlineUsername || options.username;
// checks for a valid username
if (u... | [
"function",
"buildUrl",
"(",
"value",
",",
"options",
",",
"file",
")",
"{",
"const",
"[",
"gist",
"]",
"=",
"value",
".",
"split",
"(",
"/",
"[?#]",
"/",
")",
";",
"const",
"[",
"inlineUsername",
",",
"id",
"]",
"=",
"gist",
".",
"indexOf",
"(",
... | Builds the gist url.
@param {string} value the value of the inlineCode block.
@param {PluginOptions} options the options of the plugin.
@param {string} file the file to be loaded.
@returns {string} the gist url. | [
"Builds",
"the",
"gist",
"url",
"."
] | c044ac165e1e37180743413d5614d749aee38349 | https://github.com/weirdpattern/gatsby-remark-embed-gist/blob/c044ac165e1e37180743413d5614d749aee38349/src/index.js#L79-L105 | train |
MaiaVictor/lambda-calculus | lambda-calculus.js | fromNumber | function fromNumber(num){
return Lam(Lam((function go(n){return n===0?Var(0):App(Var(1),go(n-1))})(num)));
} | javascript | function fromNumber(num){
return Lam(Lam((function go(n){return n===0?Var(0):App(Var(1),go(n-1))})(num)));
} | [
"function",
"fromNumber",
"(",
"num",
")",
"{",
"return",
"Lam",
"(",
"Lam",
"(",
"(",
"function",
"go",
"(",
"n",
")",
"{",
"return",
"n",
"===",
"0",
"?",
"Var",
"(",
"0",
")",
":",
"App",
"(",
"Var",
"(",
"1",
")",
",",
"go",
"(",
"n",
"... | Number -> Term Converts a JS number to a church-encoded nat. | [
"Number",
"-",
">",
"Term",
"Converts",
"a",
"JS",
"number",
"to",
"a",
"church",
"-",
"encoded",
"nat",
"."
] | c0880087ddc46957e66a691d2d296d4c7c7c5cef | https://github.com/MaiaVictor/lambda-calculus/blob/c0880087ddc46957e66a691d2d296d4c7c7c5cef/lambda-calculus.js#L70-L72 | train |
MaiaVictor/lambda-calculus | lambda-calculus.js | toFunction | function toFunction(term){
return eval(transmogrify(
function(varName, body){ return "(function("+varName+"){return "+body+"})"; },
function(fun, arg){ return fun+"("+arg+")"; })
(term));
} | javascript | function toFunction(term){
return eval(transmogrify(
function(varName, body){ return "(function("+varName+"){return "+body+"})"; },
function(fun, arg){ return fun+"("+arg+")"; })
(term));
} | [
"function",
"toFunction",
"(",
"term",
")",
"{",
"return",
"eval",
"(",
"transmogrify",
"(",
"function",
"(",
"varName",
",",
"body",
")",
"{",
"return",
"\"(function(\"",
"+",
"varName",
"+",
"\"){return \"",
"+",
"body",
"+",
"\"})\"",
";",
"}",
",",
"... | Term -> String Converts a term to a native JS function. | [
"Term",
"-",
">",
"String",
"Converts",
"a",
"term",
"to",
"a",
"native",
"JS",
"function",
"."
] | c0880087ddc46957e66a691d2d296d4c7c7c5cef | https://github.com/MaiaVictor/lambda-calculus/blob/c0880087ddc46957e66a691d2d296d4c7c7c5cef/lambda-calculus.js#L113-L118 | train |
MaiaVictor/lambda-calculus | lambda-calculus.js | fromBLC | function fromBLC(source){
var index = 0;
return (function go(){
if (source[index] === "0")
return source[index+1] === "0"
? (index+=2, Lam(go()))
: (index+=2, App(go(), go()));
for (var i=0; source[index]!=="0"; ++i)
++index;
return (++index, Var(i-1));
... | javascript | function fromBLC(source){
var index = 0;
return (function go(){
if (source[index] === "0")
return source[index+1] === "0"
? (index+=2, Lam(go()))
: (index+=2, App(go(), go()));
for (var i=0; source[index]!=="0"; ++i)
++index;
return (++index, Var(i-1));
... | [
"function",
"fromBLC",
"(",
"source",
")",
"{",
"var",
"index",
"=",
"0",
";",
"return",
"(",
"function",
"go",
"(",
")",
"{",
"if",
"(",
"source",
"[",
"index",
"]",
"===",
"\"0\"",
")",
"return",
"source",
"[",
"index",
"+",
"1",
"]",
"===",
"\... | String -> Term Converts a binary lambda calculus string to a term. | [
"String",
"-",
">",
"Term",
"Converts",
"a",
"binary",
"lambda",
"calculus",
"string",
"to",
"a",
"term",
"."
] | c0880087ddc46957e66a691d2d296d4c7c7c5cef | https://github.com/MaiaVictor/lambda-calculus/blob/c0880087ddc46957e66a691d2d296d4c7c7c5cef/lambda-calculus.js#L191-L202 | train |
MaiaVictor/lambda-calculus | lambda-calculus.js | fromBLC64 | function fromBLC64(digits){
var blc = "";
for (var d=0, l=digits.length; d<l; ++d){
var bits = base64Table[digits[d]];
blc += d === 0 ? bits.slice(bits.indexOf("1")+1) : bits;
};
return fromBLC(blc);
} | javascript | function fromBLC64(digits){
var blc = "";
for (var d=0, l=digits.length; d<l; ++d){
var bits = base64Table[digits[d]];
blc += d === 0 ? bits.slice(bits.indexOf("1")+1) : bits;
};
return fromBLC(blc);
} | [
"function",
"fromBLC64",
"(",
"digits",
")",
"{",
"var",
"blc",
"=",
"\"\"",
";",
"for",
"(",
"var",
"d",
"=",
"0",
",",
"l",
"=",
"digits",
".",
"length",
";",
"d",
"<",
"l",
";",
"++",
"d",
")",
"{",
"var",
"bits",
"=",
"base64Table",
"[",
... | String -> Term Converts a base64 binary lambda calculus string to a term. | [
"String",
"-",
">",
"Term",
"Converts",
"a",
"base64",
"binary",
"lambda",
"calculus",
"string",
"to",
"a",
"term",
"."
] | c0880087ddc46957e66a691d2d296d4c7c7c5cef | https://github.com/MaiaVictor/lambda-calculus/blob/c0880087ddc46957e66a691d2d296d4c7c7c5cef/lambda-calculus.js#L223-L230 | train |
MaiaVictor/lambda-calculus | lambda-calculus.js | toBLC64 | function toBLC64(term){
var blc = toBLC(term);
var digits = "";
for (var d=0, l=blc.length; d<=l/6; ++d){
var i = l - d*6 - 6;
var bits = i < 0
? ("000001"+blc.slice(0, i+6)).slice(-6)
: blc.slice(i, i+6);
digits = base64Table[bits] + digits;
};
return digits;
} | javascript | function toBLC64(term){
var blc = toBLC(term);
var digits = "";
for (var d=0, l=blc.length; d<=l/6; ++d){
var i = l - d*6 - 6;
var bits = i < 0
? ("000001"+blc.slice(0, i+6)).slice(-6)
: blc.slice(i, i+6);
digits = base64Table[bits] + digits;
};
return digits;
} | [
"function",
"toBLC64",
"(",
"term",
")",
"{",
"var",
"blc",
"=",
"toBLC",
"(",
"term",
")",
";",
"var",
"digits",
"=",
"\"\"",
";",
"for",
"(",
"var",
"d",
"=",
"0",
",",
"l",
"=",
"blc",
".",
"length",
";",
"d",
"<=",
"l",
"/",
"6",
";",
"... | Term -> String Converts a term to a base64 binary lambda calculus string. | [
"Term",
"-",
">",
"String",
"Converts",
"a",
"term",
"to",
"a",
"base64",
"binary",
"lambda",
"calculus",
"string",
"."
] | c0880087ddc46957e66a691d2d296d4c7c7c5cef | https://github.com/MaiaVictor/lambda-calculus/blob/c0880087ddc46957e66a691d2d296d4c7c7c5cef/lambda-calculus.js#L234-L245 | train |
skerit/json-dry | lib/json-dry.js | createDryReplacer | function createDryReplacer(root, replacer) {
var value_paths = new WeakMap(),
seen_path,
flags = {is_root: true},
chain = [],
path = [],
temp,
last,
len;
return function dryReplacer(holder, key, value) {
// Process the value to a possible given replacer function
if (replacer ... | javascript | function createDryReplacer(root, replacer) {
var value_paths = new WeakMap(),
seen_path,
flags = {is_root: true},
chain = [],
path = [],
temp,
last,
len;
return function dryReplacer(holder, key, value) {
// Process the value to a possible given replacer function
if (replacer ... | [
"function",
"createDryReplacer",
"(",
"root",
",",
"replacer",
")",
"{",
"var",
"value_paths",
"=",
"new",
"WeakMap",
"(",
")",
",",
"seen_path",
",",
"flags",
"=",
"{",
"is_root",
":",
"true",
"}",
",",
"chain",
"=",
"[",
"]",
",",
"path",
"=",
"[",... | Generate a replacer function
@author Jelle De Loecker <jelle@develry.be>
@since 0.1.0
@version 1.0.1
@param {Object} root
@param {Function} replacer
@return {Function} | [
"Generate",
"a",
"replacer",
"function"
] | f20fd8e4aa3bcfe133f3c1a5b5b6ea3aa7060546 | https://github.com/skerit/json-dry/blob/f20fd8e4aa3bcfe133f3c1a5b5b6ea3aa7060546/lib/json-dry.js#L24-L100 | train |
skerit/json-dry | lib/json-dry.js | recurseGeneralObject | function recurseGeneralObject(dryReplacer, value) {
var new_value = {},
keys = Object.keys(value),
key,
i;
for (i = 0; i < keys.length; i++) {
key = keys[i];
new_value[key] = dryReplacer(value, key, value[key]);
}
return new_value;
} | javascript | function recurseGeneralObject(dryReplacer, value) {
var new_value = {},
keys = Object.keys(value),
key,
i;
for (i = 0; i < keys.length; i++) {
key = keys[i];
new_value[key] = dryReplacer(value, key, value[key]);
}
return new_value;
} | [
"function",
"recurseGeneralObject",
"(",
"dryReplacer",
",",
"value",
")",
"{",
"var",
"new_value",
"=",
"{",
"}",
",",
"keys",
"=",
"Object",
".",
"keys",
"(",
"value",
")",
",",
"key",
",",
"i",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"k... | Recursively replace the given regular object
@author Jelle De Loecker <jelle@develry.be>
@since 1.0.11
@version 1.0.11
@param {Function} dryReplacer
@param {Object} value
@return {Object} | [
"Recursively",
"replace",
"the",
"given",
"regular",
"object"
] | f20fd8e4aa3bcfe133f3c1a5b5b6ea3aa7060546 | https://github.com/skerit/json-dry/blob/f20fd8e4aa3bcfe133f3c1a5b5b6ea3aa7060546/lib/json-dry.js#L313-L326 | train |
skerit/json-dry | lib/json-dry.js | generateReviver | function generateReviver(reviver, undry_paths) {
return function dryReviver(key, value) {
var val_type = typeof value,
constructor,
temp;
if (val_type === 'string') {
if (value[0] === special_char) {
// This is actually a path that needs to be replaced.
// Put in a String object for now
... | javascript | function generateReviver(reviver, undry_paths) {
return function dryReviver(key, value) {
var val_type = typeof value,
constructor,
temp;
if (val_type === 'string') {
if (value[0] === special_char) {
// This is actually a path that needs to be replaced.
// Put in a String object for now
... | [
"function",
"generateReviver",
"(",
"reviver",
",",
"undry_paths",
")",
"{",
"return",
"function",
"dryReviver",
"(",
"key",
",",
"value",
")",
"{",
"var",
"val_type",
"=",
"typeof",
"value",
",",
"constructor",
",",
"temp",
";",
"if",
"(",
"val_type",
"==... | Generate reviver function
@author Jelle De Loecker <jelle@develry.be>
@since 0.1.0
@version 1.0.2
@param {Function} reviver
@param {Map} undry_paths
@return {Function} | [
"Generate",
"reviver",
"function"
] | f20fd8e4aa3bcfe133f3c1a5b5b6ea3aa7060546 | https://github.com/skerit/json-dry/blob/f20fd8e4aa3bcfe133f3c1a5b5b6ea3aa7060546/lib/json-dry.js#L340-L424 | train |
skerit/json-dry | lib/json-dry.js | registerDrier | function registerDrier(constructor, fnc, options) {
var path;
if (typeof constructor == 'function') {
path = constructor.name;
} else {
path = constructor;
}
driers[path] = {
fnc : fnc,
options : options || {}
};
} | javascript | function registerDrier(constructor, fnc, options) {
var path;
if (typeof constructor == 'function') {
path = constructor.name;
} else {
path = constructor;
}
driers[path] = {
fnc : fnc,
options : options || {}
};
} | [
"function",
"registerDrier",
"(",
"constructor",
",",
"fnc",
",",
"options",
")",
"{",
"var",
"path",
";",
"if",
"(",
"typeof",
"constructor",
"==",
"'function'",
")",
"{",
"path",
"=",
"constructor",
".",
"name",
";",
"}",
"else",
"{",
"path",
"=",
"c... | Register a drier
@author Jelle De Loecker <jelle@develry.be>
@since 1.0.0
@version 1.0.0
@param {Function|String} constructor What constructor to listen to
@param {Function} fnc
@param {Object} options | [
"Register",
"a",
"drier"
] | f20fd8e4aa3bcfe133f3c1a5b5b6ea3aa7060546 | https://github.com/skerit/json-dry/blob/f20fd8e4aa3bcfe133f3c1a5b5b6ea3aa7060546/lib/json-dry.js#L604-L618 | train |
Subsets and Splits
SQL Console for semeru/code-text-javascript
Retrieves 20,000 non-null code samples labeled as JavaScript, providing a basic overview of the dataset.