id int32 0 58k | repo stringlengths 5 67 | path stringlengths 4 116 | func_name stringlengths 0 58 | original_string stringlengths 52 373k | language stringclasses 1
value | code stringlengths 52 373k | code_tokens list | docstring stringlengths 4 11.8k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 86 226 |
|---|---|---|---|---|---|---|---|---|---|---|---|
9,400 | serverless/serverless-kubeless | lib/deploy.js | handleMQTDeployment | function handleMQTDeployment(trigger, name, namespace, options) {
let mqTrigger = trigger;
// If only a string is passed, expect it to be the subject
if (typeof mqTrigger === 'string') {
// Defaults to Kafka
mqTrigger = {
queue: 'kafka',
topic: mqTrigger,
};
} else {
// Otherwise exp... | javascript | function handleMQTDeployment(trigger, name, namespace, options) {
let mqTrigger = trigger;
// If only a string is passed, expect it to be the subject
if (typeof mqTrigger === 'string') {
// Defaults to Kafka
mqTrigger = {
queue: 'kafka',
topic: mqTrigger,
};
} else {
// Otherwise exp... | [
"function",
"handleMQTDeployment",
"(",
"trigger",
",",
"name",
",",
"namespace",
",",
"options",
")",
"{",
"let",
"mqTrigger",
"=",
"trigger",
";",
"// If only a string is passed, expect it to be the subject",
"if",
"(",
"typeof",
"mqTrigger",
"===",
"'string'",
")",... | Handle message queue trigger input to normalize the users input values.
@param {string|object} trigger
@param {string} name
@param {string} namespace
@param {object} options | [
"Handle",
"message",
"queue",
"trigger",
"input",
"to",
"normalize",
"the",
"users",
"input",
"values",
"."
] | b85b77f584139a8d53f06346b3036f8b3017c9f9 | https://github.com/serverless/serverless-kubeless/blob/b85b77f584139a8d53f06346b3036f8b3017c9f9/lib/deploy.js#L476-L502 |
9,401 | fergiemcdowall/search-index | demo/search-app.js | function (elements) {
elements.forEach(function(element) {
document.getElementById(element).innerHTML = ''
document.getElementById(element).value = ''
})
} | javascript | function (elements) {
elements.forEach(function(element) {
document.getElementById(element).innerHTML = ''
document.getElementById(element).value = ''
})
} | [
"function",
"(",
"elements",
")",
"{",
"elements",
".",
"forEach",
"(",
"function",
"(",
"element",
")",
"{",
"document",
".",
"getElementById",
"(",
"element",
")",
".",
"innerHTML",
"=",
"''",
"document",
".",
"getElementById",
"(",
"element",
")",
".",
... | Empty HTML elements | [
"Empty",
"HTML",
"elements"
] | f69d992dd4c2a01c84b01feb0e6e57d91b6d7241 | https://github.com/fergiemcdowall/search-index/blob/f69d992dd4c2a01c84b01feb0e6e57d91b6d7241/demo/search-app.js#L49-L54 | |
9,402 | angular-ui/ui-calendar | src/calendar.js | function (newTokens, oldTokens) {
var i;
var token;
var replacedTokens = {};
var removedTokens = subtractAsSets(oldTokens, newTokens);
for (i = 0; i < removedTokens.length; i++) {
var removedToken... | javascript | function (newTokens, oldTokens) {
var i;
var token;
var replacedTokens = {};
var removedTokens = subtractAsSets(oldTokens, newTokens);
for (i = 0; i < removedTokens.length; i++) {
var removedToken... | [
"function",
"(",
"newTokens",
",",
"oldTokens",
")",
"{",
"var",
"i",
";",
"var",
"token",
";",
"var",
"replacedTokens",
"=",
"{",
"}",
";",
"var",
"removedTokens",
"=",
"subtractAsSets",
"(",
"oldTokens",
",",
"newTokens",
")",
";",
"for",
"(",
"i",
"... | Compare newTokens to oldTokens and call onAdded, onRemoved, and onChanged handlers for each affected event respectively. | [
"Compare",
"newTokens",
"to",
"oldTokens",
"and",
"call",
"onAdded",
"onRemoved",
"and",
"onChanged",
"handlers",
"for",
"each",
"affected",
"event",
"respectively",
"."
] | ac7a76c678a4eb8242a695d0ce133757345e6c31 | https://github.com/angular-ui/ui-calendar/blob/ac7a76c678a4eb8242a695d0ce133757345e6c31/src/calendar.js#L146-L172 | |
9,403 | angular-ui/ui-calendar | src/calendar.js | function (data) {
// convert {0: "Jan", 1: "Feb", ...} to ["Jan", "Feb", ...]
return (Object.keys(data) || []).reduce(
function (rslt, el) {
rslt.push(data[el]);
return rslt;
... | javascript | function (data) {
// convert {0: "Jan", 1: "Feb", ...} to ["Jan", "Feb", ...]
return (Object.keys(data) || []).reduce(
function (rslt, el) {
rslt.push(data[el]);
return rslt;
... | [
"function",
"(",
"data",
")",
"{",
"// convert {0: \"Jan\", 1: \"Feb\", ...} to [\"Jan\", \"Feb\", ...]",
"return",
"(",
"Object",
".",
"keys",
"(",
"data",
")",
"||",
"[",
"]",
")",
".",
"reduce",
"(",
"function",
"(",
"rslt",
",",
"el",
")",
"{",
"rslt",
"... | Configure to use locale names by default | [
"Configure",
"to",
"use",
"locale",
"names",
"by",
"default"
] | ac7a76c678a4eb8242a695d0ce133757345e6c31 | https://github.com/angular-ui/ui-calendar/blob/ac7a76c678a4eb8242a695d0ce133757345e6c31/src/calendar.js#L208-L217 | |
9,404 | digiaonline/react-foundation | src/components/button.js | createButtonClassName | function createButtonClassName(props) {
return createClassName(
props.noDefaultClassName ? null : 'button',
props.className,
props.size,
props.color,
{
'hollow': props.isHollow,
'clear': props.isClear,
'expanded': props.isExpanded,
'disabled': props.isDisabled,
'dropd... | javascript | function createButtonClassName(props) {
return createClassName(
props.noDefaultClassName ? null : 'button',
props.className,
props.size,
props.color,
{
'hollow': props.isHollow,
'clear': props.isClear,
'expanded': props.isExpanded,
'disabled': props.isDisabled,
'dropd... | [
"function",
"createButtonClassName",
"(",
"props",
")",
"{",
"return",
"createClassName",
"(",
"props",
".",
"noDefaultClassName",
"?",
"null",
":",
"'button'",
",",
"props",
".",
"className",
",",
"props",
".",
"size",
",",
"props",
".",
"color",
",",
"{",
... | Creates button class name from the given properties.
@param {Object} props
@returns {string} | [
"Creates",
"button",
"class",
"name",
"from",
"the",
"given",
"properties",
"."
] | 20cd3e2ff04efe8a01cf68b671f3bf2eb68d9ed3 | https://github.com/digiaonline/react-foundation/blob/20cd3e2ff04efe8a01cf68b671f3bf2eb68d9ed3/src/components/button.js#L59-L75 |
9,405 | MobilityData/gtfs-realtime-bindings | nodejs/gtfs-realtime.js | FeedMessage | function FeedMessage(properties) {
this.entity = [];
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
} | javascript | function FeedMessage(properties) {
this.entity = [];
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
} | [
"function",
"FeedMessage",
"(",
"properties",
")",
"{",
"this",
".",
"entity",
"=",
"[",
"]",
";",
"if",
"(",
"properties",
")",
"for",
"(",
"var",
"keys",
"=",
"Object",
".",
"keys",
"(",
"properties",
")",
",",
"i",
"=",
"0",
";",
"i",
"<",
"ke... | Properties of a FeedMessage.
@memberof transit_realtime
@interface IFeedMessage
@property {transit_realtime.IFeedHeader} header FeedMessage header
@property {Array.<transit_realtime.IFeedEntity>|null} [entity] FeedMessage entity
Constructs a new FeedMessage.
@memberof transit_realtime
@classdesc Represents a FeedMess... | [
"Properties",
"of",
"a",
"FeedMessage",
"."
] | 2ede9aeee2d9e8ec62ecc7684b8ee624fcfc5487 | https://github.com/MobilityData/gtfs-realtime-bindings/blob/2ede9aeee2d9e8ec62ecc7684b8ee624fcfc5487/nodejs/gtfs-realtime.js#L53-L59 |
9,406 | MobilityData/gtfs-realtime-bindings | nodejs/gtfs-realtime.js | FeedHeader | function FeedHeader(properties) {
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
} | javascript | function FeedHeader(properties) {
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
} | [
"function",
"FeedHeader",
"(",
"properties",
")",
"{",
"if",
"(",
"properties",
")",
"for",
"(",
"var",
"keys",
"=",
"Object",
".",
"keys",
"(",
"properties",
")",
",",
"i",
"=",
"0",
";",
"i",
"<",
"keys",
".",
"length",
";",
"++",
"i",
")",
"if... | Properties of a FeedHeader.
@memberof transit_realtime
@interface IFeedHeader
@property {string} gtfsRealtimeVersion FeedHeader gtfsRealtimeVersion
@property {transit_realtime.FeedHeader.Incrementality|null} [incrementality] FeedHeader incrementality
@property {number|Long|null} [timestamp] FeedHeader timestamp
Const... | [
"Properties",
"of",
"a",
"FeedHeader",
"."
] | 2ede9aeee2d9e8ec62ecc7684b8ee624fcfc5487 | https://github.com/MobilityData/gtfs-realtime-bindings/blob/2ede9aeee2d9e8ec62ecc7684b8ee624fcfc5487/nodejs/gtfs-realtime.js#L291-L296 |
9,407 | MobilityData/gtfs-realtime-bindings | nodejs/gtfs-realtime.js | FeedEntity | function FeedEntity(properties) {
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
} | javascript | function FeedEntity(properties) {
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
} | [
"function",
"FeedEntity",
"(",
"properties",
")",
"{",
"if",
"(",
"properties",
")",
"for",
"(",
"var",
"keys",
"=",
"Object",
".",
"keys",
"(",
"properties",
")",
",",
"i",
"=",
"0",
";",
"i",
"<",
"keys",
".",
"length",
";",
"++",
"i",
")",
"if... | Properties of a FeedEntity.
@memberof transit_realtime
@interface IFeedEntity
@property {string} id FeedEntity id
@property {boolean|null} [isDeleted] FeedEntity isDeleted
@property {transit_realtime.ITripUpdate|null} [tripUpdate] FeedEntity tripUpdate
@property {transit_realtime.IVehiclePosition|null} [vehicle] FeedEn... | [
"Properties",
"of",
"a",
"FeedEntity",
"."
] | 2ede9aeee2d9e8ec62ecc7684b8ee624fcfc5487 | https://github.com/MobilityData/gtfs-realtime-bindings/blob/2ede9aeee2d9e8ec62ecc7684b8ee624fcfc5487/nodejs/gtfs-realtime.js#L566-L571 |
9,408 | MobilityData/gtfs-realtime-bindings | nodejs/gtfs-realtime.js | TripUpdate | function TripUpdate(properties) {
this.stopTimeUpdate = [];
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
} | javascript | function TripUpdate(properties) {
this.stopTimeUpdate = [];
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
} | [
"function",
"TripUpdate",
"(",
"properties",
")",
"{",
"this",
".",
"stopTimeUpdate",
"=",
"[",
"]",
";",
"if",
"(",
"properties",
")",
"for",
"(",
"var",
"keys",
"=",
"Object",
".",
"keys",
"(",
"properties",
")",
",",
"i",
"=",
"0",
";",
"i",
"<"... | Properties of a TripUpdate.
@memberof transit_realtime
@interface ITripUpdate
@property {transit_realtime.ITripDescriptor} trip TripUpdate trip
@property {transit_realtime.IVehicleDescriptor|null} [vehicle] TripUpdate vehicle
@property {Array.<transit_realtime.TripUpdate.IStopTimeUpdate>|null} [stopTimeUpdate] TripUpda... | [
"Properties",
"of",
"a",
"TripUpdate",
"."
] | 2ede9aeee2d9e8ec62ecc7684b8ee624fcfc5487 | https://github.com/MobilityData/gtfs-realtime-bindings/blob/2ede9aeee2d9e8ec62ecc7684b8ee624fcfc5487/nodejs/gtfs-realtime.js#L857-L863 |
9,409 | MobilityData/gtfs-realtime-bindings | nodejs/gtfs-realtime.js | StopTimeEvent | function StopTimeEvent(properties) {
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
} | javascript | function StopTimeEvent(properties) {
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
} | [
"function",
"StopTimeEvent",
"(",
"properties",
")",
"{",
"if",
"(",
"properties",
")",
"for",
"(",
"var",
"keys",
"=",
"Object",
".",
"keys",
"(",
"properties",
")",
",",
"i",
"=",
"0",
";",
"i",
"<",
"keys",
".",
"length",
";",
"++",
"i",
")",
... | Properties of a StopTimeEvent.
@memberof transit_realtime.TripUpdate
@interface IStopTimeEvent
@property {number|null} [delay] StopTimeEvent delay
@property {number|Long|null} [time] StopTimeEvent time
@property {number|null} [uncertainty] StopTimeEvent uncertainty
Constructs a new StopTimeEvent.
@memberof transit_re... | [
"Properties",
"of",
"a",
"StopTimeEvent",
"."
] | 2ede9aeee2d9e8ec62ecc7684b8ee624fcfc5487 | https://github.com/MobilityData/gtfs-realtime-bindings/blob/2ede9aeee2d9e8ec62ecc7684b8ee624fcfc5487/nodejs/gtfs-realtime.js#L1175-L1180 |
9,410 | MobilityData/gtfs-realtime-bindings | nodejs/gtfs-realtime.js | StopTimeUpdate | function StopTimeUpdate(properties) {
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
} | javascript | function StopTimeUpdate(properties) {
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
} | [
"function",
"StopTimeUpdate",
"(",
"properties",
")",
"{",
"if",
"(",
"properties",
")",
"for",
"(",
"var",
"keys",
"=",
"Object",
".",
"keys",
"(",
"properties",
")",
",",
"i",
"=",
"0",
";",
"i",
"<",
"keys",
".",
"length",
";",
"++",
"i",
")",
... | Properties of a StopTimeUpdate.
@memberof transit_realtime.TripUpdate
@interface IStopTimeUpdate
@property {number|null} [stopSequence] StopTimeUpdate stopSequence
@property {string|null} [stopId] StopTimeUpdate stopId
@property {transit_realtime.TripUpdate.IStopTimeEvent|null} [arrival] StopTimeUpdate arrival
@propert... | [
"Properties",
"of",
"a",
"StopTimeUpdate",
"."
] | 2ede9aeee2d9e8ec62ecc7684b8ee624fcfc5487 | https://github.com/MobilityData/gtfs-realtime-bindings/blob/2ede9aeee2d9e8ec62ecc7684b8ee624fcfc5487/nodejs/gtfs-realtime.js#L1423-L1428 |
9,411 | MobilityData/gtfs-realtime-bindings | nodejs/gtfs-realtime.js | VehiclePosition | function VehiclePosition(properties) {
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
} | javascript | function VehiclePosition(properties) {
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
} | [
"function",
"VehiclePosition",
"(",
"properties",
")",
"{",
"if",
"(",
"properties",
")",
"for",
"(",
"var",
"keys",
"=",
"Object",
".",
"keys",
"(",
"properties",
")",
",",
"i",
"=",
"0",
";",
"i",
"<",
"keys",
".",
"length",
";",
"++",
"i",
")",
... | Properties of a VehiclePosition.
@memberof transit_realtime
@interface IVehiclePosition
@property {transit_realtime.ITripDescriptor|null} [trip] VehiclePosition trip
@property {transit_realtime.IVehicleDescriptor|null} [vehicle] VehiclePosition vehicle
@property {transit_realtime.IPosition|null} [position] VehiclePosit... | [
"Properties",
"of",
"a",
"VehiclePosition",
"."
] | 2ede9aeee2d9e8ec62ecc7684b8ee624fcfc5487 | https://github.com/MobilityData/gtfs-realtime-bindings/blob/2ede9aeee2d9e8ec62ecc7684b8ee624fcfc5487/nodejs/gtfs-realtime.js#L1750-L1755 |
9,412 | MobilityData/gtfs-realtime-bindings | nodejs/gtfs-realtime.js | Alert | function Alert(properties) {
this.activePeriod = [];
this.informedEntity = [];
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties... | javascript | function Alert(properties) {
this.activePeriod = [];
this.informedEntity = [];
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties... | [
"function",
"Alert",
"(",
"properties",
")",
"{",
"this",
".",
"activePeriod",
"=",
"[",
"]",
";",
"this",
".",
"informedEntity",
"=",
"[",
"]",
";",
"if",
"(",
"properties",
")",
"for",
"(",
"var",
"keys",
"=",
"Object",
".",
"keys",
"(",
"propertie... | Properties of an Alert.
@memberof transit_realtime
@interface IAlert
@property {Array.<transit_realtime.ITimeRange>|null} [activePeriod] Alert activePeriod
@property {Array.<transit_realtime.IEntitySelector>|null} [informedEntity] Alert informedEntity
@property {transit_realtime.Alert.Cause|null} [cause] Alert cause
@p... | [
"Properties",
"of",
"an",
"Alert",
"."
] | 2ede9aeee2d9e8ec62ecc7684b8ee624fcfc5487 | https://github.com/MobilityData/gtfs-realtime-bindings/blob/2ede9aeee2d9e8ec62ecc7684b8ee624fcfc5487/nodejs/gtfs-realtime.js#L2288-L2295 |
9,413 | MobilityData/gtfs-realtime-bindings | nodejs/gtfs-realtime.js | TimeRange | function TimeRange(properties) {
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
} | javascript | function TimeRange(properties) {
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
} | [
"function",
"TimeRange",
"(",
"properties",
")",
"{",
"if",
"(",
"properties",
")",
"for",
"(",
"var",
"keys",
"=",
"Object",
".",
"keys",
"(",
"properties",
")",
",",
"i",
"=",
"0",
";",
"i",
"<",
"keys",
".",
"length",
";",
"++",
"i",
")",
"if"... | Properties of a TimeRange.
@memberof transit_realtime
@interface ITimeRange
@property {number|Long|null} [start] TimeRange start
@property {number|Long|null} [end] TimeRange end
Constructs a new TimeRange.
@memberof transit_realtime
@classdesc Represents a TimeRange.
@implements ITimeRange
@constructor
@param {transi... | [
"Properties",
"of",
"a",
"TimeRange",
"."
] | 2ede9aeee2d9e8ec62ecc7684b8ee624fcfc5487 | https://github.com/MobilityData/gtfs-realtime-bindings/blob/2ede9aeee2d9e8ec62ecc7684b8ee624fcfc5487/nodejs/gtfs-realtime.js#L2956-L2961 |
9,414 | MobilityData/gtfs-realtime-bindings | nodejs/gtfs-realtime.js | Position | function Position(properties) {
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
} | javascript | function Position(properties) {
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
} | [
"function",
"Position",
"(",
"properties",
")",
"{",
"if",
"(",
"properties",
")",
"for",
"(",
"var",
"keys",
"=",
"Object",
".",
"keys",
"(",
"properties",
")",
",",
"i",
"=",
"0",
";",
"i",
"<",
"keys",
".",
"length",
";",
"++",
"i",
")",
"if",... | Properties of a Position.
@memberof transit_realtime
@interface IPosition
@property {number} latitude Position latitude
@property {number} longitude Position longitude
@property {number|null} [bearing] Position bearing
@property {number|null} [odometer] Position odometer
@property {number|null} [speed] Position speed
... | [
"Properties",
"of",
"a",
"Position",
"."
] | 2ede9aeee2d9e8ec62ecc7684b8ee624fcfc5487 | https://github.com/MobilityData/gtfs-realtime-bindings/blob/2ede9aeee2d9e8ec62ecc7684b8ee624fcfc5487/nodejs/gtfs-realtime.js#L3197-L3202 |
9,415 | MobilityData/gtfs-realtime-bindings | nodejs/gtfs-realtime.js | TripDescriptor | function TripDescriptor(properties) {
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
} | javascript | function TripDescriptor(properties) {
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
} | [
"function",
"TripDescriptor",
"(",
"properties",
")",
"{",
"if",
"(",
"properties",
")",
"for",
"(",
"var",
"keys",
"=",
"Object",
".",
"keys",
"(",
"properties",
")",
",",
"i",
"=",
"0",
";",
"i",
"<",
"keys",
".",
"length",
";",
"++",
"i",
")",
... | Properties of a TripDescriptor.
@memberof transit_realtime
@interface ITripDescriptor
@property {string|null} [tripId] TripDescriptor tripId
@property {string|null} [routeId] TripDescriptor routeId
@property {number|null} [directionId] TripDescriptor directionId
@property {string|null} [startTime] TripDescriptor startT... | [
"Properties",
"of",
"a",
"TripDescriptor",
"."
] | 2ede9aeee2d9e8ec62ecc7684b8ee624fcfc5487 | https://github.com/MobilityData/gtfs-realtime-bindings/blob/2ede9aeee2d9e8ec62ecc7684b8ee624fcfc5487/nodejs/gtfs-realtime.js#L3474-L3479 |
9,416 | MobilityData/gtfs-realtime-bindings | nodejs/gtfs-realtime.js | VehicleDescriptor | function VehicleDescriptor(properties) {
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
} | javascript | function VehicleDescriptor(properties) {
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
} | [
"function",
"VehicleDescriptor",
"(",
"properties",
")",
"{",
"if",
"(",
"properties",
")",
"for",
"(",
"var",
"keys",
"=",
"Object",
".",
"keys",
"(",
"properties",
")",
",",
"i",
"=",
"0",
";",
"i",
"<",
"keys",
".",
"length",
";",
"++",
"i",
")"... | Properties of a VehicleDescriptor.
@memberof transit_realtime
@interface IVehicleDescriptor
@property {string|null} [id] VehicleDescriptor id
@property {string|null} [label] VehicleDescriptor label
@property {string|null} [licensePlate] VehicleDescriptor licensePlate
Constructs a new VehicleDescriptor.
@memberof tran... | [
"Properties",
"of",
"a",
"VehicleDescriptor",
"."
] | 2ede9aeee2d9e8ec62ecc7684b8ee624fcfc5487 | https://github.com/MobilityData/gtfs-realtime-bindings/blob/2ede9aeee2d9e8ec62ecc7684b8ee624fcfc5487/nodejs/gtfs-realtime.js#L3817-L3822 |
9,417 | MobilityData/gtfs-realtime-bindings | nodejs/gtfs-realtime.js | EntitySelector | function EntitySelector(properties) {
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
} | javascript | function EntitySelector(properties) {
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
} | [
"function",
"EntitySelector",
"(",
"properties",
")",
"{",
"if",
"(",
"properties",
")",
"for",
"(",
"var",
"keys",
"=",
"Object",
".",
"keys",
"(",
"properties",
")",
",",
"i",
"=",
"0",
";",
"i",
"<",
"keys",
".",
"length",
";",
"++",
"i",
")",
... | Properties of an EntitySelector.
@memberof transit_realtime
@interface IEntitySelector
@property {string|null} [agencyId] EntitySelector agencyId
@property {string|null} [routeId] EntitySelector routeId
@property {number|null} [routeType] EntitySelector routeType
@property {transit_realtime.ITripDescriptor|null} [trip]... | [
"Properties",
"of",
"an",
"EntitySelector",
"."
] | 2ede9aeee2d9e8ec62ecc7684b8ee624fcfc5487 | https://github.com/MobilityData/gtfs-realtime-bindings/blob/2ede9aeee2d9e8ec62ecc7684b8ee624fcfc5487/nodejs/gtfs-realtime.js#L4051-L4056 |
9,418 | MobilityData/gtfs-realtime-bindings | nodejs/gtfs-realtime.js | TranslatedString | function TranslatedString(properties) {
this.translation = [];
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
} | javascript | function TranslatedString(properties) {
this.translation = [];
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
} | [
"function",
"TranslatedString",
"(",
"properties",
")",
"{",
"this",
".",
"translation",
"=",
"[",
"]",
";",
"if",
"(",
"properties",
")",
"for",
"(",
"var",
"keys",
"=",
"Object",
".",
"keys",
"(",
"properties",
")",
",",
"i",
"=",
"0",
";",
"i",
... | Properties of a TranslatedString.
@memberof transit_realtime
@interface ITranslatedString
@property {Array.<transit_realtime.TranslatedString.ITranslation>|null} [translation] TranslatedString translation
Constructs a new TranslatedString.
@memberof transit_realtime
@classdesc Represents a TranslatedString.
@implemen... | [
"Properties",
"of",
"a",
"TranslatedString",
"."
] | 2ede9aeee2d9e8ec62ecc7684b8ee624fcfc5487 | https://github.com/MobilityData/gtfs-realtime-bindings/blob/2ede9aeee2d9e8ec62ecc7684b8ee624fcfc5487/nodejs/gtfs-realtime.js#L4328-L4334 |
9,419 | MobilityData/gtfs-realtime-bindings | nodejs/gtfs-realtime.js | Translation | function Translation(properties) {
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
} | javascript | function Translation(properties) {
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
} | [
"function",
"Translation",
"(",
"properties",
")",
"{",
"if",
"(",
"properties",
")",
"for",
"(",
"var",
"keys",
"=",
"Object",
".",
"keys",
"(",
"properties",
")",
",",
"i",
"=",
"0",
";",
"i",
"<",
"keys",
".",
"length",
";",
"++",
"i",
")",
"i... | Properties of a Translation.
@memberof transit_realtime.TranslatedString
@interface ITranslation
@property {string} text Translation text
@property {string|null} [language] Translation language
Constructs a new Translation.
@memberof transit_realtime.TranslatedString
@classdesc Represents a Translation.
@implements I... | [
"Properties",
"of",
"a",
"Translation",
"."
] | 2ede9aeee2d9e8ec62ecc7684b8ee624fcfc5487 | https://github.com/MobilityData/gtfs-realtime-bindings/blob/2ede9aeee2d9e8ec62ecc7684b8ee624fcfc5487/nodejs/gtfs-realtime.js#L4534-L4539 |
9,420 | Microsoft/vscode-css-languageservice | build/mdn/mdn-data-importer.js | extractMDNProperties | function extractMDNProperties(mdnEntry) {
if (mdnEntry.status === 'standard') {
return {
syntax: mdnEntry.syntax
}
}
return {
status: abbreviateStatus(mdnEntry.status),
syntax: mdnEntry.syntax
}
} | javascript | function extractMDNProperties(mdnEntry) {
if (mdnEntry.status === 'standard') {
return {
syntax: mdnEntry.syntax
}
}
return {
status: abbreviateStatus(mdnEntry.status),
syntax: mdnEntry.syntax
}
} | [
"function",
"extractMDNProperties",
"(",
"mdnEntry",
")",
"{",
"if",
"(",
"mdnEntry",
".",
"status",
"===",
"'standard'",
")",
"{",
"return",
"{",
"syntax",
":",
"mdnEntry",
".",
"syntax",
"}",
"}",
"return",
"{",
"status",
":",
"abbreviateStatus",
"(",
"m... | Extract only the MDN data that we use | [
"Extract",
"only",
"the",
"MDN",
"data",
"that",
"we",
"use"
] | 2d0a8b93fa1cf138ccb936ab144303aea3e36d05 | https://github.com/Microsoft/vscode-css-languageservice/blob/2d0a8b93fa1cf138ccb936ab144303aea3e36d05/build/mdn/mdn-data-importer.js#L76-L87 |
9,421 | Microsoft/vscode-css-languageservice | build/generate_browserjs.js | convertEntry | function convertEntry(entry) {
entry.description = entry.desc
delete entry.desc
if (entry.values) {
entry.values.forEach(v => {
v.description = v.desc
delete v.desc
if (v.browsers) {
if (v.browsers === 'all') {
delete v.browsers
} else {
v.browsers = entry.browsers.split(',')
if (... | javascript | function convertEntry(entry) {
entry.description = entry.desc
delete entry.desc
if (entry.values) {
entry.values.forEach(v => {
v.description = v.desc
delete v.desc
if (v.browsers) {
if (v.browsers === 'all') {
delete v.browsers
} else {
v.browsers = entry.browsers.split(',')
if (... | [
"function",
"convertEntry",
"(",
"entry",
")",
"{",
"entry",
".",
"description",
"=",
"entry",
".",
"desc",
"delete",
"entry",
".",
"desc",
"if",
"(",
"entry",
".",
"values",
")",
"{",
"entry",
".",
"values",
".",
"forEach",
"(",
"v",
"=>",
"{",
"v",... | Temporarily convert old entry to new entry
Todo@Pine: Change MDN data generation so this yields new entry | [
"Temporarily",
"convert",
"old",
"entry",
"to",
"new",
"entry",
"Todo"
] | 2d0a8b93fa1cf138ccb936ab144303aea3e36d05 | https://github.com/Microsoft/vscode-css-languageservice/blob/2d0a8b93fa1cf138ccb936ab144303aea3e36d05/build/generate_browserjs.js#L422-L465 |
9,422 | dailymotion/vast-client-js | dist/vast-client-node.js | childByName | function childByName(node, name) {
var childNodes = node.childNodes;
for (var childKey in childNodes) {
var child = childNodes[childKey];
if (child.nodeName === name) {
return child;
}
}
} | javascript | function childByName(node, name) {
var childNodes = node.childNodes;
for (var childKey in childNodes) {
var child = childNodes[childKey];
if (child.nodeName === name) {
return child;
}
}
} | [
"function",
"childByName",
"(",
"node",
",",
"name",
")",
"{",
"var",
"childNodes",
"=",
"node",
".",
"childNodes",
";",
"for",
"(",
"var",
"childKey",
"in",
"childNodes",
")",
"{",
"var",
"child",
"=",
"childNodes",
"[",
"childKey",
"]",
";",
"if",
"(... | This module provides support methods to the parsing classes.
Returns the first element of the given node which nodeName matches the given name.
@param {Object} node - The node to use to find a match.
@param {String} name - The name to look for.
@return {Object} | [
"This",
"module",
"provides",
"support",
"methods",
"to",
"the",
"parsing",
"classes",
".",
"Returns",
"the",
"first",
"element",
"of",
"the",
"given",
"node",
"which",
"nodeName",
"matches",
"the",
"given",
"name",
"."
] | da5626fbc07b5949feb602fcea49b97df6070e61 | https://github.com/dailymotion/vast-client-js/blob/da5626fbc07b5949feb602fcea49b97df6070e61/dist/vast-client-node.js#L252-L262 |
9,423 | dailymotion/vast-client-js | dist/vast-client-node.js | resolveVastAdTagURI | function resolveVastAdTagURI(vastAdTagUrl, originalUrl) {
if (!originalUrl) {
return vastAdTagUrl;
}
if (vastAdTagUrl.indexOf('//') === 0) {
var _location = location,
protocol = _location.protocol;
return '' + protocol + vastAdTagUrl;
}
if (vastAdTagUrl.indexOf('://') === -1) {
// R... | javascript | function resolveVastAdTagURI(vastAdTagUrl, originalUrl) {
if (!originalUrl) {
return vastAdTagUrl;
}
if (vastAdTagUrl.indexOf('//') === 0) {
var _location = location,
protocol = _location.protocol;
return '' + protocol + vastAdTagUrl;
}
if (vastAdTagUrl.indexOf('://') === -1) {
// R... | [
"function",
"resolveVastAdTagURI",
"(",
"vastAdTagUrl",
",",
"originalUrl",
")",
"{",
"if",
"(",
"!",
"originalUrl",
")",
"{",
"return",
"vastAdTagUrl",
";",
"}",
"if",
"(",
"vastAdTagUrl",
".",
"indexOf",
"(",
"'//'",
")",
"===",
"0",
")",
"{",
"var",
"... | Converts relative vastAdTagUri.
@param {String} vastAdTagUrl - The url to resolve.
@param {String} originalUrl - The original url.
@return {String} | [
"Converts",
"relative",
"vastAdTagUri",
"."
] | da5626fbc07b5949feb602fcea49b97df6070e61 | https://github.com/dailymotion/vast-client-js/blob/da5626fbc07b5949feb602fcea49b97df6070e61/dist/vast-client-node.js#L290-L309 |
9,424 | dailymotion/vast-client-js | dist/vast-client-node.js | mergeWrapperAdData | function mergeWrapperAdData(unwrappedAd, wrapper) {
unwrappedAd.errorURLTemplates = wrapper.errorURLTemplates.concat(unwrappedAd.errorURLTemplates);
unwrappedAd.impressionURLTemplates = wrapper.impressionURLTemplates.concat(unwrappedAd.impressionURLTemplates);
unwrappedAd.extensions = wrapper.extensions.concat(un... | javascript | function mergeWrapperAdData(unwrappedAd, wrapper) {
unwrappedAd.errorURLTemplates = wrapper.errorURLTemplates.concat(unwrappedAd.errorURLTemplates);
unwrappedAd.impressionURLTemplates = wrapper.impressionURLTemplates.concat(unwrappedAd.impressionURLTemplates);
unwrappedAd.extensions = wrapper.extensions.concat(un... | [
"function",
"mergeWrapperAdData",
"(",
"unwrappedAd",
",",
"wrapper",
")",
"{",
"unwrappedAd",
".",
"errorURLTemplates",
"=",
"wrapper",
".",
"errorURLTemplates",
".",
"concat",
"(",
"unwrappedAd",
".",
"errorURLTemplates",
")",
";",
"unwrappedAd",
".",
"impressionU... | Merges the data between an unwrapped ad and his wrapper.
@param {Ad} unwrappedAd - The 'unwrapped' Ad.
@param {Ad} wrapper - The wrapper Ad.
@return {void} | [
"Merges",
"the",
"data",
"between",
"an",
"unwrapped",
"ad",
"and",
"his",
"wrapper",
"."
] | da5626fbc07b5949feb602fcea49b97df6070e61 | https://github.com/dailymotion/vast-client-js/blob/da5626fbc07b5949feb602fcea49b97df6070e61/dist/vast-client-node.js#L416-L457 |
9,425 | dailymotion/vast-client-js | dist/vast-client-node.js | parseCreativeNonLinear | function parseCreativeNonLinear(creativeElement, creativeAttributes) {
var creative = new CreativeNonLinear(creativeAttributes);
parserUtils.childrenByName(creativeElement, 'TrackingEvents').forEach(function (trackingEventsElement) {
var eventName = void 0,
trackingURLTemplate = void 0;
parserUtils... | javascript | function parseCreativeNonLinear(creativeElement, creativeAttributes) {
var creative = new CreativeNonLinear(creativeAttributes);
parserUtils.childrenByName(creativeElement, 'TrackingEvents').forEach(function (trackingEventsElement) {
var eventName = void 0,
trackingURLTemplate = void 0;
parserUtils... | [
"function",
"parseCreativeNonLinear",
"(",
"creativeElement",
",",
"creativeAttributes",
")",
"{",
"var",
"creative",
"=",
"new",
"CreativeNonLinear",
"(",
"creativeAttributes",
")",
";",
"parserUtils",
".",
"childrenByName",
"(",
"creativeElement",
",",
"'TrackingEvent... | This module provides methods to parse a VAST NonLinear Element.
Parses a NonLinear element.
@param {any} creativeElement - The VAST NonLinear element to parse.
@param {any} creativeAttributes - The attributes of the NonLinear (optional).
@return {CreativeNonLinear} | [
"This",
"module",
"provides",
"methods",
"to",
"parse",
"a",
"VAST",
"NonLinear",
"Element",
".",
"Parses",
"a",
"NonLinear",
"element",
"."
] | da5626fbc07b5949feb602fcea49b97df6070e61 | https://github.com/dailymotion/vast-client-js/blob/da5626fbc07b5949feb602fcea49b97df6070e61/dist/vast-client-node.js#L825-L885 |
9,426 | dailymotion/vast-client-js | dist/vast-client-node.js | parseInLine | function parseInLine(inLineElement) {
var childNodes = inLineElement.childNodes;
var ad = new Ad();
ad.id = inLineElement.getAttribute('id') || null;
ad.sequence = inLineElement.getAttribute('sequence') || null;
for (var nodeKey in childNodes) {
var node = childNodes[nodeKey];
switch (node.nodeName)... | javascript | function parseInLine(inLineElement) {
var childNodes = inLineElement.childNodes;
var ad = new Ad();
ad.id = inLineElement.getAttribute('id') || null;
ad.sequence = inLineElement.getAttribute('sequence') || null;
for (var nodeKey in childNodes) {
var node = childNodes[nodeKey];
switch (node.nodeName)... | [
"function",
"parseInLine",
"(",
"inLineElement",
")",
"{",
"var",
"childNodes",
"=",
"inLineElement",
".",
"childNodes",
";",
"var",
"ad",
"=",
"new",
"Ad",
"(",
")",
";",
"ad",
".",
"id",
"=",
"inLineElement",
".",
"getAttribute",
"(",
"'id'",
")",
"||"... | Parses an Inline element.
@param {Object} inLineElement - The VAST Inline element to parse.
@return {Ad} | [
"Parses",
"an",
"Inline",
"element",
"."
] | da5626fbc07b5949feb602fcea49b97df6070e61 | https://github.com/dailymotion/vast-client-js/blob/da5626fbc07b5949feb602fcea49b97df6070e61/dist/vast-client-node.js#L922-L1015 |
9,427 | dailymotion/vast-client-js | dist/vast-client-node.js | parseWrapper | function parseWrapper(wrapperElement) {
var ad = parseInLine(wrapperElement);
var wrapperURLElement = parserUtils.childByName(wrapperElement, 'VASTAdTagURI');
if (wrapperURLElement) {
ad.nextWrapperURL = parserUtils.parseNodeText(wrapperURLElement);
} else {
wrapperURLElement = parserUtils.childByName(... | javascript | function parseWrapper(wrapperElement) {
var ad = parseInLine(wrapperElement);
var wrapperURLElement = parserUtils.childByName(wrapperElement, 'VASTAdTagURI');
if (wrapperURLElement) {
ad.nextWrapperURL = parserUtils.parseNodeText(wrapperURLElement);
} else {
wrapperURLElement = parserUtils.childByName(... | [
"function",
"parseWrapper",
"(",
"wrapperElement",
")",
"{",
"var",
"ad",
"=",
"parseInLine",
"(",
"wrapperElement",
")",
";",
"var",
"wrapperURLElement",
"=",
"parserUtils",
".",
"childByName",
"(",
"wrapperElement",
",",
"'VASTAdTagURI'",
")",
";",
"if",
"(",
... | Parses a Wrapper element without resolving the wrapped urls.
@param {Object} wrapperElement - The VAST Wrapper element to be parsed.
@return {Ad} | [
"Parses",
"a",
"Wrapper",
"element",
"without",
"resolving",
"the",
"wrapped",
"urls",
"."
] | da5626fbc07b5949feb602fcea49b97df6070e61 | https://github.com/dailymotion/vast-client-js/blob/da5626fbc07b5949feb602fcea49b97df6070e61/dist/vast-client-node.js#L1022-L1089 |
9,428 | dailymotion/vast-client-js | dist/vast-client-node.js | VASTParser | function VASTParser() {
classCallCheck(this, VASTParser);
var _this = possibleConstructorReturn(this, (VASTParser.__proto__ || Object.getPrototypeOf(VASTParser)).call(this));
_this.remainingAds = [];
_this.parentURLs = [];
_this.errorURLTemplates = [];
_this.rootErrorURLTemplates = [];
_th... | javascript | function VASTParser() {
classCallCheck(this, VASTParser);
var _this = possibleConstructorReturn(this, (VASTParser.__proto__ || Object.getPrototypeOf(VASTParser)).call(this));
_this.remainingAds = [];
_this.parentURLs = [];
_this.errorURLTemplates = [];
_this.rootErrorURLTemplates = [];
_th... | [
"function",
"VASTParser",
"(",
")",
"{",
"classCallCheck",
"(",
"this",
",",
"VASTParser",
")",
";",
"var",
"_this",
"=",
"possibleConstructorReturn",
"(",
"this",
",",
"(",
"VASTParser",
".",
"__proto__",
"||",
"Object",
".",
"getPrototypeOf",
"(",
"VASTParse... | Creates an instance of VASTParser.
@constructor | [
"Creates",
"an",
"instance",
"of",
"VASTParser",
"."
] | da5626fbc07b5949feb602fcea49b97df6070e61 | https://github.com/dailymotion/vast-client-js/blob/da5626fbc07b5949feb602fcea49b97df6070e61/dist/vast-client-node.js#L1344-L1357 |
9,429 | dailymotion/vast-client-js | dist/vast-client-node.js | VASTClient | function VASTClient(cappingFreeLunch, cappingMinimumTimeInterval, customStorage) {
classCallCheck(this, VASTClient);
this.cappingFreeLunch = cappingFreeLunch || 0;
this.cappingMinimumTimeInterval = cappingMinimumTimeInterval || 0;
this.defaultOptions = {
withCredentials: false,
timeout: 0
... | javascript | function VASTClient(cappingFreeLunch, cappingMinimumTimeInterval, customStorage) {
classCallCheck(this, VASTClient);
this.cappingFreeLunch = cappingFreeLunch || 0;
this.cappingMinimumTimeInterval = cappingMinimumTimeInterval || 0;
this.defaultOptions = {
withCredentials: false,
timeout: 0
... | [
"function",
"VASTClient",
"(",
"cappingFreeLunch",
",",
"cappingMinimumTimeInterval",
",",
"customStorage",
")",
"{",
"classCallCheck",
"(",
"this",
",",
"VASTClient",
")",
";",
"this",
".",
"cappingFreeLunch",
"=",
"cappingFreeLunch",
"||",
"0",
";",
"this",
".",... | Creates an instance of VASTClient.
@param {Number} cappingFreeLunch - The number of first calls to skip.
@param {Number} cappingMinimumTimeInterval - The minimum time interval between two consecutive calls.
@param {Storage} customStorage - A custom storage to use instead of the default one.
@constructor | [
"Creates",
"an",
"instance",
"of",
"VASTClient",
"."
] | da5626fbc07b5949feb602fcea49b97df6070e61 | https://github.com/dailymotion/vast-client-js/blob/da5626fbc07b5949feb602fcea49b97df6070e61/dist/vast-client-node.js#L2006-L2029 |
9,430 | dailymotion/vast-client-js | dist/vast-client-node.js | VASTTracker | function VASTTracker(client, ad, creative) {
var variation = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
classCallCheck(this, VASTTracker);
var _this = possibleConstructorReturn(this, (VASTTracker.__proto__ || Object.getPrototypeOf(VASTTracker)).call(this));
_this.ad = ad... | javascript | function VASTTracker(client, ad, creative) {
var variation = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
classCallCheck(this, VASTTracker);
var _this = possibleConstructorReturn(this, (VASTTracker.__proto__ || Object.getPrototypeOf(VASTTracker)).call(this));
_this.ad = ad... | [
"function",
"VASTTracker",
"(",
"client",
",",
"ad",
",",
"creative",
")",
"{",
"var",
"variation",
"=",
"arguments",
".",
"length",
">",
"3",
"&&",
"arguments",
"[",
"3",
"]",
"!==",
"undefined",
"?",
"arguments",
"[",
"3",
"]",
":",
"null",
";",
"c... | Creates an instance of VASTTracker.
@param {VASTClient} client - An instance of VASTClient that can be updated by the tracker. [optional]
@param {Ad} ad - The ad to track.
@param {Creative} creative - The creative to track.
@param {CompanionAd|NonLinearAd} [variation=null] - An optional variation of the creative.
@con... | [
"Creates",
"an",
"instance",
"of",
"VASTTracker",
"."
] | da5626fbc07b5949feb602fcea49b97df6070e61 | https://github.com/dailymotion/vast-client-js/blob/da5626fbc07b5949feb602fcea49b97df6070e61/dist/vast-client-node.js#L2169-L2211 |
9,431 | dailymotion/vast-client-js | src/parser/ad_parser.js | parseExtensions | function parseExtensions(collection, extensions) {
extensions.forEach(extNode => {
const ext = new AdExtension();
const extNodeAttrs = extNode.attributes;
const childNodes = extNode.childNodes;
if (extNode.attributes) {
for (const extNodeAttrKey in extNodeAttrs) {
const extNodeAttr = ex... | javascript | function parseExtensions(collection, extensions) {
extensions.forEach(extNode => {
const ext = new AdExtension();
const extNodeAttrs = extNode.attributes;
const childNodes = extNode.childNodes;
if (extNode.attributes) {
for (const extNodeAttrKey in extNodeAttrs) {
const extNodeAttr = ex... | [
"function",
"parseExtensions",
"(",
"collection",
",",
"extensions",
")",
"{",
"extensions",
".",
"forEach",
"(",
"extNode",
"=>",
"{",
"const",
"ext",
"=",
"new",
"AdExtension",
"(",
")",
";",
"const",
"extNodeAttrs",
"=",
"extNode",
".",
"attributes",
";",... | Parses an array of Extension elements.
@param {Array} collection - The array used to store the parsed extensions.
@param {Array} extensions - The array of extensions to parse. | [
"Parses",
"an",
"array",
"of",
"Extension",
"elements",
"."
] | da5626fbc07b5949feb602fcea49b97df6070e61 | https://github.com/dailymotion/vast-client-js/blob/da5626fbc07b5949feb602fcea49b97df6070e61/src/parser/ad_parser.js#L238-L281 |
9,432 | dailymotion/vast-client-js | src/util/util.js | resolveURLTemplates | function resolveURLTemplates(URLTemplates, variables = {}, options = {}) {
const URLs = [];
// Encode String variables, when given
if (variables['ASSETURI']) {
variables['ASSETURI'] = encodeURIComponentRFC3986(variables['ASSETURI']);
}
if (variables['CONTENTPLAYHEAD']) {
variables['CONTENTPLAYHEAD'] ... | javascript | function resolveURLTemplates(URLTemplates, variables = {}, options = {}) {
const URLs = [];
// Encode String variables, when given
if (variables['ASSETURI']) {
variables['ASSETURI'] = encodeURIComponentRFC3986(variables['ASSETURI']);
}
if (variables['CONTENTPLAYHEAD']) {
variables['CONTENTPLAYHEAD'] ... | [
"function",
"resolveURLTemplates",
"(",
"URLTemplates",
",",
"variables",
"=",
"{",
"}",
",",
"options",
"=",
"{",
"}",
")",
"{",
"const",
"URLs",
"=",
"[",
"]",
";",
"// Encode String variables, when given",
"if",
"(",
"variables",
"[",
"'ASSETURI'",
"]",
"... | Replace the provided URLTemplates with the given values
@param {Array} URLTemplates - An array of tracking url templates.
@param {Object} [variables={}] - An optional Object of parameters to be used in the tracking calls.
@param {Object} [options={}] - An optional Object of options to be used in the tracking calls. | [
"Replace",
"the",
"provided",
"URLTemplates",
"with",
"the",
"given",
"values"
] | da5626fbc07b5949feb602fcea49b97df6070e61 | https://github.com/dailymotion/vast-client-js/blob/da5626fbc07b5949feb602fcea49b97df6070e61/src/util/util.js#L19-L68 |
9,433 | dailymotion/vast-client-js | src/parser/parser_utils.js | copyNodeAttribute | function copyNodeAttribute(attributeName, nodeSource, nodeDestination) {
const attributeValue = nodeSource.getAttribute(attributeName);
if (attributeValue) {
nodeDestination.setAttribute(attributeName, attributeValue);
}
} | javascript | function copyNodeAttribute(attributeName, nodeSource, nodeDestination) {
const attributeValue = nodeSource.getAttribute(attributeName);
if (attributeValue) {
nodeDestination.setAttribute(attributeName, attributeValue);
}
} | [
"function",
"copyNodeAttribute",
"(",
"attributeName",
",",
"nodeSource",
",",
"nodeDestination",
")",
"{",
"const",
"attributeValue",
"=",
"nodeSource",
".",
"getAttribute",
"(",
"attributeName",
")",
";",
"if",
"(",
"attributeValue",
")",
"{",
"nodeDestination",
... | Copies an attribute from a node to another.
@param {String} attributeName - The name of the attribute to clone.
@param {Object} nodeSource - The source node to copy the attribute from.
@param {Object} nodeDestination - The destination node to copy the attribute at. | [
"Copies",
"an",
"attribute",
"from",
"a",
"node",
"to",
"another",
"."
] | da5626fbc07b5949feb602fcea49b97df6070e61 | https://github.com/dailymotion/vast-client-js/blob/da5626fbc07b5949feb602fcea49b97df6070e61/src/parser/parser_utils.js#L94-L99 |
9,434 | dailymotion/vast-client-js | src/parser/parser_utils.js | parseDuration | function parseDuration(durationString) {
if (durationString === null || typeof durationString === 'undefined') {
return -1;
}
// Some VAST doesn't have an HH:MM:SS duration format but instead jus the number of seconds
if (util.isNumeric(durationString)) {
return parseInt(durationString);
}
const du... | javascript | function parseDuration(durationString) {
if (durationString === null || typeof durationString === 'undefined') {
return -1;
}
// Some VAST doesn't have an HH:MM:SS duration format but instead jus the number of seconds
if (util.isNumeric(durationString)) {
return parseInt(durationString);
}
const du... | [
"function",
"parseDuration",
"(",
"durationString",
")",
"{",
"if",
"(",
"durationString",
"===",
"null",
"||",
"typeof",
"durationString",
"===",
"'undefined'",
")",
"{",
"return",
"-",
"1",
";",
"}",
"// Some VAST doesn't have an HH:MM:SS duration format but instead j... | Parses a String duration into a Number.
@param {String} durationString - The dureation represented as a string.
@return {Number} | [
"Parses",
"a",
"String",
"duration",
"into",
"a",
"Number",
"."
] | da5626fbc07b5949feb602fcea49b97df6070e61 | https://github.com/dailymotion/vast-client-js/blob/da5626fbc07b5949feb602fcea49b97df6070e61/src/parser/parser_utils.js#L106-L139 |
9,435 | nearform/node-clinic | lib/authenticate.js | loadToken | async function loadToken (url) {
let tokens
try {
const data = await readFile(credentialsPath)
tokens = JSON.parse(data)
} catch (err) {}
return tokens && tokens[url]
} | javascript | async function loadToken (url) {
let tokens
try {
const data = await readFile(credentialsPath)
tokens = JSON.parse(data)
} catch (err) {}
return tokens && tokens[url]
} | [
"async",
"function",
"loadToken",
"(",
"url",
")",
"{",
"let",
"tokens",
"try",
"{",
"const",
"data",
"=",
"await",
"readFile",
"(",
"credentialsPath",
")",
"tokens",
"=",
"JSON",
".",
"parse",
"(",
"data",
")",
"}",
"catch",
"(",
"err",
")",
"{",
"}... | Load the JWT for an Upload Server URL. | [
"Load",
"the",
"JWT",
"for",
"an",
"Upload",
"Server",
"URL",
"."
] | 7e44899f42451691bc35a7a095fd17c1065ea8e8 | https://github.com/nearform/node-clinic/blob/7e44899f42451691bc35a7a095fd17c1065ea8e8/lib/authenticate.js#L29-L36 |
9,436 | nearform/node-clinic | lib/authenticate.js | validateToken | function validateToken (token) {
const header = jwt.decode(token)
const now = Math.floor(Date.now() / 1000)
return header && header.exp > now
} | javascript | function validateToken (token) {
const header = jwt.decode(token)
const now = Math.floor(Date.now() / 1000)
return header && header.exp > now
} | [
"function",
"validateToken",
"(",
"token",
")",
"{",
"const",
"header",
"=",
"jwt",
".",
"decode",
"(",
"token",
")",
"const",
"now",
"=",
"Math",
".",
"floor",
"(",
"Date",
".",
"now",
"(",
")",
"/",
"1000",
")",
"return",
"header",
"&&",
"header",
... | Check that a JWT has not expired. | [
"Check",
"that",
"a",
"JWT",
"has",
"not",
"expired",
"."
] | 7e44899f42451691bc35a7a095fd17c1065ea8e8 | https://github.com/nearform/node-clinic/blob/7e44899f42451691bc35a7a095fd17c1065ea8e8/lib/authenticate.js#L41-L45 |
9,437 | nearform/node-clinic | lib/authenticate.js | validateAskPermission | function validateAskPermission (token) {
const header = jwt.decode(token)
return validateToken(token) && header[ASK_CLAIM_KEY]
} | javascript | function validateAskPermission (token) {
const header = jwt.decode(token)
return validateToken(token) && header[ASK_CLAIM_KEY]
} | [
"function",
"validateAskPermission",
"(",
"token",
")",
"{",
"const",
"header",
"=",
"jwt",
".",
"decode",
"(",
"token",
")",
"return",
"validateToken",
"(",
"token",
")",
"&&",
"header",
"[",
"ASK_CLAIM_KEY",
"]",
"}"
] | Check that a JWT has Ask terms accepted. | [
"Check",
"that",
"a",
"JWT",
"has",
"Ask",
"terms",
"accepted",
"."
] | 7e44899f42451691bc35a7a095fd17c1065ea8e8 | https://github.com/nearform/node-clinic/blob/7e44899f42451691bc35a7a095fd17c1065ea8e8/lib/authenticate.js#L50-L54 |
9,438 | nearform/node-clinic | lib/authenticate.js | getSession | async function getSession (url) {
const token = await loadToken(url)
if (!token) return null
const header = jwt.decode(token)
if (!header) return null
const now = Math.floor(Date.now() / 1000)
if (header.exp <= now) return null
return header
} | javascript | async function getSession (url) {
const token = await loadToken(url)
if (!token) return null
const header = jwt.decode(token)
if (!header) return null
const now = Math.floor(Date.now() / 1000)
if (header.exp <= now) return null
return header
} | [
"async",
"function",
"getSession",
"(",
"url",
")",
"{",
"const",
"token",
"=",
"await",
"loadToken",
"(",
"url",
")",
"if",
"(",
"!",
"token",
")",
"return",
"null",
"const",
"header",
"=",
"jwt",
".",
"decode",
"(",
"token",
")",
"if",
"(",
"!",
... | Get the session data for an Upload Server URL. | [
"Get",
"the",
"session",
"data",
"for",
"an",
"Upload",
"Server",
"URL",
"."
] | 7e44899f42451691bc35a7a095fd17c1065ea8e8 | https://github.com/nearform/node-clinic/blob/7e44899f42451691bc35a7a095fd17c1065ea8e8/lib/authenticate.js#L59-L67 |
9,439 | nearform/node-clinic | lib/authenticate.js | saveToken | async function saveToken (url, token) {
let tokens
try {
const data = await readFile(credentialsPath)
tokens = JSON.parse(data)
} catch (err) {}
// if it was empty or contained `null` for some reason
if (typeof tokens !== 'object' || !tokens) {
tokens = {}
}
tokens[url] = token
await writ... | javascript | async function saveToken (url, token) {
let tokens
try {
const data = await readFile(credentialsPath)
tokens = JSON.parse(data)
} catch (err) {}
// if it was empty or contained `null` for some reason
if (typeof tokens !== 'object' || !tokens) {
tokens = {}
}
tokens[url] = token
await writ... | [
"async",
"function",
"saveToken",
"(",
"url",
",",
"token",
")",
"{",
"let",
"tokens",
"try",
"{",
"const",
"data",
"=",
"await",
"readFile",
"(",
"credentialsPath",
")",
"tokens",
"=",
"JSON",
".",
"parse",
"(",
"data",
")",
"}",
"catch",
"(",
"err",
... | Store the JWT for an Upload Server URL in the credentials file. | [
"Store",
"the",
"JWT",
"for",
"an",
"Upload",
"Server",
"URL",
"in",
"the",
"credentials",
"file",
"."
] | 7e44899f42451691bc35a7a095fd17c1065ea8e8 | https://github.com/nearform/node-clinic/blob/7e44899f42451691bc35a7a095fd17c1065ea8e8/lib/authenticate.js#L72-L87 |
9,440 | squarefeet/ShaderParticleEngine | build/SPE.js | function( arg, type, defaultValue ) {
'use strict';
// If the argument being checked is an array, loop through
// it and ensure all the values are of the correct type,
// falling back to the defaultValue if any aren't.
if ( Array.isArray( arg ) ) {
for ( var i = arg.... | javascript | function( arg, type, defaultValue ) {
'use strict';
// If the argument being checked is an array, loop through
// it and ensure all the values are of the correct type,
// falling back to the defaultValue if any aren't.
if ( Array.isArray( arg ) ) {
for ( var i = arg.... | [
"function",
"(",
"arg",
",",
"type",
",",
"defaultValue",
")",
"{",
"'use strict'",
";",
"// If the argument being checked is an array, loop through",
"// it and ensure all the values are of the correct type,",
"// falling back to the defaultValue if any aren't.",
"if",
"(",
"Array",... | Given an array of values, a type, and a default value,
ensure the given array's contents ALL adhere to the provided type,
returning the default value if type check fails.
If the given value to check isn't an Array, delegates to SPE.utils.ensureTypedArg.
@param {Array|boolean|string|number|object} arg The ar... | [
"Given",
"an",
"array",
"of",
"values",
"a",
"type",
"and",
"a",
"default",
"value",
"ensure",
"the",
"given",
"array",
"s",
"contents",
"ALL",
"adhere",
"to",
"the",
"provided",
"type",
"returning",
"the",
"default",
"value",
"if",
"type",
"check",
"fails... | ecc2886ce952d8f0ae0739f031bead671445f8a9 | https://github.com/squarefeet/ShaderParticleEngine/blob/ecc2886ce952d8f0ae0739f031bead671445f8a9/build/SPE.js#L1164-L1183 | |
9,441 | squarefeet/ShaderParticleEngine | build/SPE.js | function( arg, instance, defaultValue ) {
'use strict';
// If the argument being checked is an array, loop through
// it and ensure all the values are of the correct type,
// falling back to the defaultValue if any aren't.
if ( Array.isArray( arg ) ) {
for ( var i = ... | javascript | function( arg, instance, defaultValue ) {
'use strict';
// If the argument being checked is an array, loop through
// it and ensure all the values are of the correct type,
// falling back to the defaultValue if any aren't.
if ( Array.isArray( arg ) ) {
for ( var i = ... | [
"function",
"(",
"arg",
",",
"instance",
",",
"defaultValue",
")",
"{",
"'use strict'",
";",
"// If the argument being checked is an array, loop through",
"// it and ensure all the values are of the correct type,",
"// falling back to the defaultValue if any aren't.",
"if",
"(",
"Arr... | Given an array of values, ensure the instances of all items in the array
matches the given instance constructor falling back to a default value if
the check fails.
If given value isn't an Array, delegates to `SPE.utils.ensureInstanceOf`.
@param {Array|Object} arg The value to perform the instanceof check on... | [
"Given",
"an",
"array",
"of",
"values",
"ensure",
"the",
"instances",
"of",
"all",
"items",
"in",
"the",
"array",
"matches",
"the",
"given",
"instance",
"constructor",
"falling",
"back",
"to",
"a",
"default",
"value",
"if",
"the",
"check",
"fails",
"."
] | ecc2886ce952d8f0ae0739f031bead671445f8a9 | https://github.com/squarefeet/ShaderParticleEngine/blob/ecc2886ce952d8f0ae0739f031bead671445f8a9/build/SPE.js#L1216-L1235 | |
9,442 | squarefeet/ShaderParticleEngine | build/SPE.js | function( value, randomise ) {
'use strict';
var epsilon = 0.00001,
result = value;
result = randomise ? Math.random() * epsilon * 10 : epsilon;
if ( value < 0 && value > -epsilon ) {
result = -result;
}
// if ( value === 0 ) {
// r... | javascript | function( value, randomise ) {
'use strict';
var epsilon = 0.00001,
result = value;
result = randomise ? Math.random() * epsilon * 10 : epsilon;
if ( value < 0 && value > -epsilon ) {
result = -result;
}
// if ( value === 0 ) {
// r... | [
"function",
"(",
"value",
",",
"randomise",
")",
"{",
"'use strict'",
";",
"var",
"epsilon",
"=",
"0.00001",
",",
"result",
"=",
"value",
";",
"result",
"=",
"randomise",
"?",
"Math",
".",
"random",
"(",
")",
"*",
"epsilon",
"*",
"10",
":",
"epsilon",
... | If the given value is less than the epsilon value, then return
a randomised epsilon value if specified, or just the epsilon value if not.
Works for negative numbers as well as positive.
@param {Number} value The value to perform the operation on.
@param {Boolean} randomise Whether the value should be randomised.... | [
"If",
"the",
"given",
"value",
"is",
"less",
"than",
"the",
"epsilon",
"value",
"then",
"return",
"a",
"randomised",
"epsilon",
"value",
"if",
"specified",
"or",
"just",
"the",
"epsilon",
"value",
"if",
"not",
".",
"Works",
"for",
"negative",
"numbers",
"a... | ecc2886ce952d8f0ae0739f031bead671445f8a9 | https://github.com/squarefeet/ShaderParticleEngine/blob/ecc2886ce952d8f0ae0739f031bead671445f8a9/build/SPE.js#L1337-L1360 | |
9,443 | squarefeet/ShaderParticleEngine | build/SPE.js | function( start, end, delta ) {
'use strict';
var types = this.types,
out;
if ( typeof start === types.NUMBER && typeof end === types.NUMBER ) {
return start + ( ( end - start ) * delta );
}
else if ( start instanceof THREE.Vector2 && end instanceof THRE... | javascript | function( start, end, delta ) {
'use strict';
var types = this.types,
out;
if ( typeof start === types.NUMBER && typeof end === types.NUMBER ) {
return start + ( ( end - start ) * delta );
}
else if ( start instanceof THREE.Vector2 && end instanceof THRE... | [
"function",
"(",
"start",
",",
"end",
",",
"delta",
")",
"{",
"'use strict'",
";",
"var",
"types",
"=",
"this",
".",
"types",
",",
"out",
";",
"if",
"(",
"typeof",
"start",
"===",
"types",
".",
"NUMBER",
"&&",
"typeof",
"end",
"===",
"types",
".",
... | Linearly interpolates two values of various types. The given values
must be of the same type for the interpolation to work.
@param {(number|Object)} start The start value of the lerp.
@param {(number|object)} end The end value of the lerp.
@param {Number} delta The delta posiiton of the lerp operation. Ideally bet... | [
"Linearly",
"interpolates",
"two",
"values",
"of",
"various",
"types",
".",
"The",
"given",
"values",
"must",
"be",
"of",
"the",
"same",
"type",
"for",
"the",
"interpolation",
"to",
"work",
"."
] | ecc2886ce952d8f0ae0739f031bead671445f8a9 | https://github.com/squarefeet/ShaderParticleEngine/blob/ecc2886ce952d8f0ae0739f031bead671445f8a9/build/SPE.js#L1372-L1412 | |
9,444 | squarefeet/ShaderParticleEngine | build/SPE.js | function( n, multiple ) {
'use strict';
var remainder = 0;
if ( multiple === 0 ) {
return n;
}
remainder = Math.abs( n ) % multiple;
if ( remainder === 0 ) {
return n;
}
if ( n < 0 ) {
return -( Math.abs( n ) - rema... | javascript | function( n, multiple ) {
'use strict';
var remainder = 0;
if ( multiple === 0 ) {
return n;
}
remainder = Math.abs( n ) % multiple;
if ( remainder === 0 ) {
return n;
}
if ( n < 0 ) {
return -( Math.abs( n ) - rema... | [
"function",
"(",
"n",
",",
"multiple",
")",
"{",
"'use strict'",
";",
"var",
"remainder",
"=",
"0",
";",
"if",
"(",
"multiple",
"===",
"0",
")",
"{",
"return",
"n",
";",
"}",
"remainder",
"=",
"Math",
".",
"abs",
"(",
"n",
")",
"%",
"multiple",
"... | Rounds a number to a nearest multiple.
@param {Number} n The number to round.
@param {Number} multiple The multiple to round to.
@return {Number} The result of the round operation. | [
"Rounds",
"a",
"number",
"to",
"a",
"nearest",
"multiple",
"."
] | ecc2886ce952d8f0ae0739f031bead671445f8a9 | https://github.com/squarefeet/ShaderParticleEngine/blob/ecc2886ce952d8f0ae0739f031bead671445f8a9/build/SPE.js#L1433-L1453 | |
9,445 | squarefeet/ShaderParticleEngine | build/SPE.js | function(
attribute, index, base, radius, radiusSpread, radiusScale, radiusSpreadClamp, distributionClamp
) {
'use strict';
var depth = 2 * Math.random() - 1,
t = 6.2832 * Math.random(),
r = Math.sqrt( 1 - depth * depth ),
rand = this.randomFloat( radius,... | javascript | function(
attribute, index, base, radius, radiusSpread, radiusScale, radiusSpreadClamp, distributionClamp
) {
'use strict';
var depth = 2 * Math.random() - 1,
t = 6.2832 * Math.random(),
r = Math.sqrt( 1 - depth * depth ),
rand = this.randomFloat( radius,... | [
"function",
"(",
"attribute",
",",
"index",
",",
"base",
",",
"radius",
",",
"radiusSpread",
",",
"radiusScale",
",",
"radiusSpreadClamp",
",",
"distributionClamp",
")",
"{",
"'use strict'",
";",
"var",
"depth",
"=",
"2",
"*",
"Math",
".",
"random",
"(",
"... | Assigns a random vector 3 value to an SPE.ShaderAttribute instance, projecting the
given values onto a sphere.
@param {Object} attribute The instance of SPE.ShaderAttribute to save the result to.
@param {Number} index The offset in the attribute's TypedArray to save the result from.
@param {Object} base ... | [
"Assigns",
"a",
"random",
"vector",
"3",
"value",
"to",
"an",
"SPE",
".",
"ShaderAttribute",
"instance",
"projecting",
"the",
"given",
"values",
"onto",
"a",
"sphere",
"."
] | ecc2886ce952d8f0ae0739f031bead671445f8a9 | https://github.com/squarefeet/ShaderParticleEngine/blob/ecc2886ce952d8f0ae0739f031bead671445f8a9/build/SPE.js#L1611-L1648 | |
9,446 | vitaly-t/pg-promise | lib/database.js | taskProcessor | function taskProcessor(params, isTX) {
if (typeof params.cb !== 'function') {
return $p.reject(new TypeError('Callback function is required.'));
}
if (params.options.reusable) {
return config.$npm.task.callback(obj.ctx, obj, params.cb, config);
... | javascript | function taskProcessor(params, isTX) {
if (typeof params.cb !== 'function') {
return $p.reject(new TypeError('Callback function is required.'));
}
if (params.options.reusable) {
return config.$npm.task.callback(obj.ctx, obj, params.cb, config);
... | [
"function",
"taskProcessor",
"(",
"params",
",",
"isTX",
")",
"{",
"if",
"(",
"typeof",
"params",
".",
"cb",
"!==",
"'function'",
")",
"{",
"return",
"$p",
".",
"reject",
"(",
"new",
"TypeError",
"(",
"'Callback function is required.'",
")",
")",
";",
"}",... | Task method; Resolves with result from the callback function; | [
"Task",
"method",
";",
"Resolves",
"with",
"result",
"from",
"the",
"callback",
"function",
";"
] | a3ccf5a7fb14425c34892b869cb5502b2847180e | https://github.com/vitaly-t/pg-promise/blob/a3ccf5a7fb14425c34892b869cb5502b2847180e/lib/database.js#L1551-L1598 |
9,447 | vitaly-t/pg-promise | lib/task.js | update | function update(start, success, result) {
const c = ctx.ctx;
if (start) {
npm.utils.addReadProp(c, 'start', new Date());
} else {
c.finish = new Date();
c.success = success;
c.result = result;
c.duration = c.finish - c.start;
... | javascript | function update(start, success, result) {
const c = ctx.ctx;
if (start) {
npm.utils.addReadProp(c, 'start', new Date());
} else {
c.finish = new Date();
c.success = success;
c.result = result;
c.duration = c.finish - c.start;
... | [
"function",
"update",
"(",
"start",
",",
"success",
",",
"result",
")",
"{",
"const",
"c",
"=",
"ctx",
".",
"ctx",
";",
"if",
"(",
"start",
")",
"{",
"npm",
".",
"utils",
".",
"addReadProp",
"(",
"c",
",",
"'start'",
",",
"new",
"Date",
"(",
")",... | updates the task context and notifies the client; | [
"updates",
"the",
"task",
"context",
"and",
"notifies",
"the",
"client",
";"
] | a3ccf5a7fb14425c34892b869cb5502b2847180e | https://github.com/vitaly-t/pg-promise/blob/a3ccf5a7fb14425c34892b869cb5502b2847180e/lib/task.js#L232-L248 |
9,448 | get-alex/alex | index.js | htmlParse | function htmlParse(value, config) {
var allow
if (Array.isArray(config)) {
allow = config
} else if (config) {
allow = config.allow
}
return core(
value,
unified()
.use(html)
.use(rehype2retext, makeText(config))
.use(filter, {allow: allow})
)
} | javascript | function htmlParse(value, config) {
var allow
if (Array.isArray(config)) {
allow = config
} else if (config) {
allow = config.allow
}
return core(
value,
unified()
.use(html)
.use(rehype2retext, makeText(config))
.use(filter, {allow: allow})
)
} | [
"function",
"htmlParse",
"(",
"value",
",",
"config",
")",
"{",
"var",
"allow",
"if",
"(",
"Array",
".",
"isArray",
"(",
"config",
")",
")",
"{",
"allow",
"=",
"config",
"}",
"else",
"if",
"(",
"config",
")",
"{",
"allow",
"=",
"config",
".",
"allo... | Alex, for HTML. | [
"Alex",
"for",
"HTML",
"."
] | 4b9a763735b230c5a312afe9427cd87131bbc17d | https://github.com/get-alex/alex/blob/4b9a763735b230c5a312afe9427cd87131bbc17d/index.js#L63-L79 |
9,449 | get-alex/alex | index.js | noMarkdown | function noMarkdown(value, config) {
var allow
if (Array.isArray(config)) {
allow = config
} else if (config) {
allow = config.allow
}
return core(value, makeText(config).use(filter, {allow: allow}))
} | javascript | function noMarkdown(value, config) {
var allow
if (Array.isArray(config)) {
allow = config
} else if (config) {
allow = config.allow
}
return core(value, makeText(config).use(filter, {allow: allow}))
} | [
"function",
"noMarkdown",
"(",
"value",
",",
"config",
")",
"{",
"var",
"allow",
"if",
"(",
"Array",
".",
"isArray",
"(",
"config",
")",
")",
"{",
"allow",
"=",
"config",
"}",
"else",
"if",
"(",
"config",
")",
"{",
"allow",
"=",
"config",
".",
"all... | Alex, without the markdown. | [
"Alex",
"without",
"the",
"markdown",
"."
] | 4b9a763735b230c5a312afe9427cd87131bbc17d | https://github.com/get-alex/alex/blob/4b9a763735b230c5a312afe9427cd87131bbc17d/index.js#L82-L92 |
9,450 | vuejs/vueify | lib/compilers/sass.js | function (err, res) {
if (err) {
cb(err)
} else {
res.stats.includedFiles.forEach(function (file) {
compiler.emit('dependency', file)
})
cb(null, res.css.toString())
}
} | javascript | function (err, res) {
if (err) {
cb(err)
} else {
res.stats.includedFiles.forEach(function (file) {
compiler.emit('dependency', file)
})
cb(null, res.css.toString())
}
} | [
"function",
"(",
"err",
",",
"res",
")",
"{",
"if",
"(",
"err",
")",
"{",
"cb",
"(",
"err",
")",
"}",
"else",
"{",
"res",
".",
"stats",
".",
"includedFiles",
".",
"forEach",
"(",
"function",
"(",
"file",
")",
"{",
"compiler",
".",
"emit",
"(",
... | callback for node-sass > 3.0.0 | [
"callback",
"for",
"node",
"-",
"sass",
">",
"3",
".",
"0",
".",
"0"
] | 0bcabf17b6c44cbe0e4c4ff85e3c79d22a853bd8 | https://github.com/vuejs/vueify/blob/0bcabf17b6c44cbe0e4c4ff85e3c79d22a853bd8/lib/compilers/sass.js#L34-L43 | |
9,451 | csstools/cssdb | tasks/start.js | sortFeatures | function sortFeatures({ stage: a, id: aa }, { stage: b, id: bb }) {
return b - a || (aa < bb ? -1 : aa > bb ? 1 : 0);
} | javascript | function sortFeatures({ stage: a, id: aa }, { stage: b, id: bb }) {
return b - a || (aa < bb ? -1 : aa > bb ? 1 : 0);
} | [
"function",
"sortFeatures",
"(",
"{",
"stage",
":",
"a",
",",
"id",
":",
"aa",
"}",
",",
"{",
"stage",
":",
"b",
",",
"id",
":",
"bb",
"}",
")",
"{",
"return",
"b",
"-",
"a",
"||",
"(",
"aa",
"<",
"bb",
"?",
"-",
"1",
":",
"aa",
">",
"bb"... | sort features by stage or title | [
"sort",
"features",
"by",
"stage",
"or",
"title"
] | 1f69e619ee7fcc4aaf6c879593d120ecc96c2164 | https://github.com/csstools/cssdb/blob/1f69e619ee7fcc4aaf6c879593d120ecc96c2164/tasks/start.js#L97-L99 |
9,452 | csstools/cssdb | tasks/start.js | formatFeature | function formatFeature(feature) {
return Object.assign({}, feature, {
// format title using marked inline lexer
title: marked.inlineLexer(feature.title, [], {}),
// format description using marked inline lexer
description: marked.inlineLexer(feature.description, [], {}),
// format example as syntax-highlight... | javascript | function formatFeature(feature) {
return Object.assign({}, feature, {
// format title using marked inline lexer
title: marked.inlineLexer(feature.title, [], {}),
// format description using marked inline lexer
description: marked.inlineLexer(feature.description, [], {}),
// format example as syntax-highlight... | [
"function",
"formatFeature",
"(",
"feature",
")",
"{",
"return",
"Object",
".",
"assign",
"(",
"{",
"}",
",",
"feature",
",",
"{",
"// format title using marked inline lexer",
"title",
":",
"marked",
".",
"inlineLexer",
"(",
"feature",
".",
"title",
",",
"[",
... | format feature for HTML output | [
"format",
"feature",
"for",
"HTML",
"output"
] | 1f69e619ee7fcc4aaf6c879593d120ecc96c2164 | https://github.com/csstools/cssdb/blob/1f69e619ee7fcc4aaf6c879593d120ecc96c2164/tasks/start.js#L107-L124 |
9,453 | csstools/cssdb | tasks/start.js | postcssToHTML | function postcssToHTML(root, builder) {
function toString(node) {
if ('atrule' === node.type) {
return atruleToString(node);
} if ('rule' === node.type) {
return ruleToString(node);
} else if ('decl' === node.type) {
return declToString(node);
} else if ('comment' === node.type) {
return commentToS... | javascript | function postcssToHTML(root, builder) {
function toString(node) {
if ('atrule' === node.type) {
return atruleToString(node);
} if ('rule' === node.type) {
return ruleToString(node);
} else if ('decl' === node.type) {
return declToString(node);
} else if ('comment' === node.type) {
return commentToS... | [
"function",
"postcssToHTML",
"(",
"root",
",",
"builder",
")",
"{",
"function",
"toString",
"(",
"node",
")",
"{",
"if",
"(",
"'atrule'",
"===",
"node",
".",
"type",
")",
"{",
"return",
"atruleToString",
"(",
"node",
")",
";",
"}",
"if",
"(",
"'rule'",... | format css as syntax-highlighted HTML | [
"format",
"css",
"as",
"syntax",
"-",
"highlighted",
"HTML"
] | 1f69e619ee7fcc4aaf6c879593d120ecc96c2164 | https://github.com/csstools/cssdb/blob/1f69e619ee7fcc4aaf6c879593d120ecc96c2164/tasks/start.js#L166-L211 |
9,454 | stacktracejs/stacktrace.js | stacktrace.js | _merge | function _merge(first, second) {
var target = {};
[first, second].forEach(function(obj) {
for (var prop in obj) {
if (obj.hasOwnProperty(prop)) {
target[prop] = obj[prop];
}
}
return target;
});
ret... | javascript | function _merge(first, second) {
var target = {};
[first, second].forEach(function(obj) {
for (var prop in obj) {
if (obj.hasOwnProperty(prop)) {
target[prop] = obj[prop];
}
}
return target;
});
ret... | [
"function",
"_merge",
"(",
"first",
",",
"second",
")",
"{",
"var",
"target",
"=",
"{",
"}",
";",
"[",
"first",
",",
"second",
"]",
".",
"forEach",
"(",
"function",
"(",
"obj",
")",
"{",
"for",
"(",
"var",
"prop",
"in",
"obj",
")",
"{",
"if",
"... | Merge 2 given Objects. If a conflict occurs the second object wins.
Does not do deep merges.
@param {Object} first base object
@param {Object} second overrides
@returns {Object} merged first and second
@private | [
"Merge",
"2",
"given",
"Objects",
".",
"If",
"a",
"conflict",
"occurs",
"the",
"second",
"object",
"wins",
".",
"Does",
"not",
"do",
"deep",
"merges",
"."
] | 89214a1866da9eb9fb25054d64a65dea06e302dc | https://github.com/stacktracejs/stacktrace.js/blob/89214a1866da9eb9fb25054d64a65dea06e302dc/stacktrace.js#L43-L56 |
9,455 | stacktracejs/stacktrace.js | stacktrace.js | StackTrace$$get | function StackTrace$$get(opts) {
var err = _generateError();
return _isShapedLikeParsableError(err) ? this.fromError(err, opts) : this.generateArtificially(opts);
} | javascript | function StackTrace$$get(opts) {
var err = _generateError();
return _isShapedLikeParsableError(err) ? this.fromError(err, opts) : this.generateArtificially(opts);
} | [
"function",
"StackTrace$$get",
"(",
"opts",
")",
"{",
"var",
"err",
"=",
"_generateError",
"(",
")",
";",
"return",
"_isShapedLikeParsableError",
"(",
"err",
")",
"?",
"this",
".",
"fromError",
"(",
"err",
",",
"opts",
")",
":",
"this",
".",
"generateArtif... | Get a backtrace from invocation point.
@param {Object} opts
@returns {Array} of StackFrame | [
"Get",
"a",
"backtrace",
"from",
"invocation",
"point",
"."
] | 89214a1866da9eb9fb25054d64a65dea06e302dc | https://github.com/stacktracejs/stacktrace.js/blob/89214a1866da9eb9fb25054d64a65dea06e302dc/stacktrace.js#L76-L79 |
9,456 | stacktracejs/stacktrace.js | stacktrace.js | StackTrace$$fromError | function StackTrace$$fromError(error, opts) {
opts = _merge(_options, opts);
var gps = new StackTraceGPS(opts);
return new Promise(function(resolve) {
var stackframes = _filtered(ErrorStackParser.parse(error), opts.filter);
resolve(Promise.all(stackfra... | javascript | function StackTrace$$fromError(error, opts) {
opts = _merge(_options, opts);
var gps = new StackTraceGPS(opts);
return new Promise(function(resolve) {
var stackframes = _filtered(ErrorStackParser.parse(error), opts.filter);
resolve(Promise.all(stackfra... | [
"function",
"StackTrace$$fromError",
"(",
"error",
",",
"opts",
")",
"{",
"opts",
"=",
"_merge",
"(",
"_options",
",",
"opts",
")",
";",
"var",
"gps",
"=",
"new",
"StackTraceGPS",
"(",
"opts",
")",
";",
"return",
"new",
"Promise",
"(",
"function",
"(",
... | Given an error object, parse it.
@param {Error} error object
@param {Object} opts
@returns {Promise} for Array[StackFrame} | [
"Given",
"an",
"error",
"object",
"parse",
"it",
"."
] | 89214a1866da9eb9fb25054d64a65dea06e302dc | https://github.com/stacktracejs/stacktrace.js/blob/89214a1866da9eb9fb25054d64a65dea06e302dc/stacktrace.js#L102-L117 |
9,457 | stacktracejs/stacktrace.js | stacktrace.js | StackTrace$$generateArtificially | function StackTrace$$generateArtificially(opts) {
opts = _merge(_options, opts);
var stackFrames = StackGenerator.backtrace(opts);
if (typeof opts.filter === 'function') {
stackFrames = stackFrames.filter(opts.filter);
}
return Promise.resolve(... | javascript | function StackTrace$$generateArtificially(opts) {
opts = _merge(_options, opts);
var stackFrames = StackGenerator.backtrace(opts);
if (typeof opts.filter === 'function') {
stackFrames = stackFrames.filter(opts.filter);
}
return Promise.resolve(... | [
"function",
"StackTrace$$generateArtificially",
"(",
"opts",
")",
"{",
"opts",
"=",
"_merge",
"(",
"_options",
",",
"opts",
")",
";",
"var",
"stackFrames",
"=",
"StackGenerator",
".",
"backtrace",
"(",
"opts",
")",
";",
"if",
"(",
"typeof",
"opts",
".",
"f... | Use StackGenerator to generate a backtrace.
@param {Object} opts
@returns {Promise} of Array[StackFrame] | [
"Use",
"StackGenerator",
"to",
"generate",
"a",
"backtrace",
"."
] | 89214a1866da9eb9fb25054d64a65dea06e302dc | https://github.com/stacktracejs/stacktrace.js/blob/89214a1866da9eb9fb25054d64a65dea06e302dc/stacktrace.js#L125-L132 |
9,458 | stacktracejs/stacktrace.js | stacktrace.js | StackTrace$$instrument | function StackTrace$$instrument(fn, callback, errback, thisArg) {
if (typeof fn !== 'function') {
throw new Error('Cannot instrument non-function object');
} else if (typeof fn.__stacktraceOriginalFn === 'function') {
// Already instrumented, return given Function... | javascript | function StackTrace$$instrument(fn, callback, errback, thisArg) {
if (typeof fn !== 'function') {
throw new Error('Cannot instrument non-function object');
} else if (typeof fn.__stacktraceOriginalFn === 'function') {
// Already instrumented, return given Function... | [
"function",
"StackTrace$$instrument",
"(",
"fn",
",",
"callback",
",",
"errback",
",",
"thisArg",
")",
"{",
"if",
"(",
"typeof",
"fn",
"!==",
"'function'",
")",
"{",
"throw",
"new",
"Error",
"(",
"'Cannot instrument non-function object'",
")",
";",
"}",
"else"... | Given a function, wrap it such that invocations trigger a callback that
is called with a stack trace.
@param {Function} fn to be instrumented
@param {Function} callback function to call with a stack trace on invocation
@param {Function} errback optional function to call with error if unable to get stack trace.
@param ... | [
"Given",
"a",
"function",
"wrap",
"it",
"such",
"that",
"invocations",
"trigger",
"a",
"callback",
"that",
"is",
"called",
"with",
"a",
"stack",
"trace",
"."
] | 89214a1866da9eb9fb25054d64a65dea06e302dc | https://github.com/stacktracejs/stacktrace.js/blob/89214a1866da9eb9fb25054d64a65dea06e302dc/stacktrace.js#L143-L165 |
9,459 | stacktracejs/stacktrace.js | stacktrace.js | StackTrace$$report | function StackTrace$$report(stackframes, url, errorMsg, requestOptions) {
return new Promise(function(resolve, reject) {
var req = new XMLHttpRequest();
req.onerror = reject;
req.onreadystatechange = function onreadystatechange() {
if (req.... | javascript | function StackTrace$$report(stackframes, url, errorMsg, requestOptions) {
return new Promise(function(resolve, reject) {
var req = new XMLHttpRequest();
req.onerror = reject;
req.onreadystatechange = function onreadystatechange() {
if (req.... | [
"function",
"StackTrace$$report",
"(",
"stackframes",
",",
"url",
",",
"errorMsg",
",",
"requestOptions",
")",
"{",
"return",
"new",
"Promise",
"(",
"function",
"(",
"resolve",
",",
"reject",
")",
"{",
"var",
"req",
"=",
"new",
"XMLHttpRequest",
"(",
")",
... | Given an error message and Array of StackFrames, serialize and POST to given URL.
@param {Array} stackframes
@param {String} url
@param {String} errorMsg
@param {Object} requestOptions | [
"Given",
"an",
"error",
"message",
"and",
"Array",
"of",
"StackFrames",
"serialize",
"and",
"POST",
"to",
"given",
"URL",
"."
] | 89214a1866da9eb9fb25054d64a65dea06e302dc | https://github.com/stacktracejs/stacktrace.js/blob/89214a1866da9eb9fb25054d64a65dea06e302dc/stacktrace.js#L192-L225 |
9,460 | igvteam/igv.js | js/canvas2svg.js | format | function format(str, args) {
var keys = Object.keys(args), i;
for (i=0; i<keys.length; i++) {
str = str.replace(new RegExp("\\{" + keys[i] + "\\}", "gi"), args[keys[i]]);
}
return str;
} | javascript | function format(str, args) {
var keys = Object.keys(args), i;
for (i=0; i<keys.length; i++) {
str = str.replace(new RegExp("\\{" + keys[i] + "\\}", "gi"), args[keys[i]]);
}
return str;
} | [
"function",
"format",
"(",
"str",
",",
"args",
")",
"{",
"var",
"keys",
"=",
"Object",
".",
"keys",
"(",
"args",
")",
",",
"i",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"keys",
".",
"length",
";",
"i",
"++",
")",
"{",
"str",
"=",
"str... | helper function to format a string | [
"helper",
"function",
"to",
"format",
"a",
"string"
] | b9473ee0b8565ee4e5eb98f73f8d6161dda2acb6 | https://github.com/igvteam/igv.js/blob/b9473ee0b8565ee4e5eb98f73f8d6161dda2acb6/js/canvas2svg.js#L22-L28 |
9,461 | igvteam/igv.js | js/canvas2svg.js | randomString | function randomString(holder) {
var chars, randomstring, i;
if (!holder) {
throw new Error("cannot create a random attribute name for an undefined object");
}
chars = "ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";
randomstring = "";
do {
ra... | javascript | function randomString(holder) {
var chars, randomstring, i;
if (!holder) {
throw new Error("cannot create a random attribute name for an undefined object");
}
chars = "ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";
randomstring = "";
do {
ra... | [
"function",
"randomString",
"(",
"holder",
")",
"{",
"var",
"chars",
",",
"randomstring",
",",
"i",
";",
"if",
"(",
"!",
"holder",
")",
"{",
"throw",
"new",
"Error",
"(",
"\"cannot create a random attribute name for an undefined object\"",
")",
";",
"}",
"chars"... | helper function that generates a random string | [
"helper",
"function",
"that",
"generates",
"a",
"random",
"string"
] | b9473ee0b8565ee4e5eb98f73f8d6161dda2acb6 | https://github.com/igvteam/igv.js/blob/b9473ee0b8565ee4e5eb98f73f8d6161dda2acb6/js/canvas2svg.js#L31-L45 |
9,462 | igvteam/igv.js | js/canvas2svg.js | createNamedToNumberedLookup | function createNamedToNumberedLookup(items, radix) {
var i, entity, lookup = {}, base10, base16;
items = items.split(',');
radix = radix || 10;
// Map from named to numbered entities.
for (i = 0; i < items.length; i += 2) {
entity = '&' + items[i + 1] + ';';
... | javascript | function createNamedToNumberedLookup(items, radix) {
var i, entity, lookup = {}, base10, base16;
items = items.split(',');
radix = radix || 10;
// Map from named to numbered entities.
for (i = 0; i < items.length; i += 2) {
entity = '&' + items[i + 1] + ';';
... | [
"function",
"createNamedToNumberedLookup",
"(",
"items",
",",
"radix",
")",
"{",
"var",
"i",
",",
"entity",
",",
"lookup",
"=",
"{",
"}",
",",
"base10",
",",
"base16",
";",
"items",
"=",
"items",
".",
"split",
"(",
"','",
")",
";",
"radix",
"=",
"rad... | helper function to map named to numbered entities | [
"helper",
"function",
"to",
"map",
"named",
"to",
"numbered",
"entities"
] | b9473ee0b8565ee4e5eb98f73f8d6161dda2acb6 | https://github.com/igvteam/igv.js/blob/b9473ee0b8565ee4e5eb98f73f8d6161dda2acb6/js/canvas2svg.js#L48-L61 |
9,463 | igvteam/igv.js | js/canvas2svg.js | function (vector) {
var len = Math.sqrt(vector[0] * vector[0] + vector[1] * vector[1]);
return [vector[0] / len, vector[1] / len];
} | javascript | function (vector) {
var len = Math.sqrt(vector[0] * vector[0] + vector[1] * vector[1]);
return [vector[0] / len, vector[1] / len];
} | [
"function",
"(",
"vector",
")",
"{",
"var",
"len",
"=",
"Math",
".",
"sqrt",
"(",
"vector",
"[",
"0",
"]",
"*",
"vector",
"[",
"0",
"]",
"+",
"vector",
"[",
"1",
"]",
"*",
"vector",
"[",
"1",
"]",
")",
";",
"return",
"[",
"vector",
"[",
"0",
... | Return a new normalized vector of given vector | [
"Return",
"a",
"new",
"normalized",
"vector",
"of",
"given",
"vector"
] | b9473ee0b8565ee4e5eb98f73f8d6161dda2acb6 | https://github.com/igvteam/igv.js/blob/b9473ee0b8565ee4e5eb98f73f8d6161dda2acb6/js/canvas2svg.js#L709-L712 | |
9,464 | skaterdav85/validatorjs | src/validator.js | function (passes, fails) {
var _this = this;
passes = passes || function () {};
fails = fails || function () {};
var failsOne = function (rule, message) {
_this._addFailure(rule, message);
};
var resolvedAll = function (allPassed) {
if (allPassed) {
passes();
} else {... | javascript | function (passes, fails) {
var _this = this;
passes = passes || function () {};
fails = fails || function () {};
var failsOne = function (rule, message) {
_this._addFailure(rule, message);
};
var resolvedAll = function (allPassed) {
if (allPassed) {
passes();
} else {... | [
"function",
"(",
"passes",
",",
"fails",
")",
"{",
"var",
"_this",
"=",
"this",
";",
"passes",
"=",
"passes",
"||",
"function",
"(",
")",
"{",
"}",
";",
"fails",
"=",
"fails",
"||",
"function",
"(",
")",
"{",
"}",
";",
"var",
"failsOne",
"=",
"fu... | Run async validator
@param {function} passes
@param {function} fails
@return {void} | [
"Run",
"async",
"validator"
] | 7cdb58f064a77237de13072057dc35e61755a7f5 | https://github.com/skaterdav85/validatorjs/blob/7cdb58f064a77237de13072057dc35e61755a7f5/src/validator.js#L92-L143 | |
9,465 | skaterdav85/validatorjs | src/validator.js | function (rule) {
var msg = this.messages.render(rule);
this.errors.add(rule.attribute, msg);
this.errorCount++;
} | javascript | function (rule) {
var msg = this.messages.render(rule);
this.errors.add(rule.attribute, msg);
this.errorCount++;
} | [
"function",
"(",
"rule",
")",
"{",
"var",
"msg",
"=",
"this",
".",
"messages",
".",
"render",
"(",
"rule",
")",
";",
"this",
".",
"errors",
".",
"add",
"(",
"rule",
".",
"attribute",
",",
"msg",
")",
";",
"this",
".",
"errorCount",
"++",
";",
"}"... | Add failure and error message for given rule
@param {Rule} rule | [
"Add",
"failure",
"and",
"error",
"message",
"for",
"given",
"rule"
] | 7cdb58f064a77237de13072057dc35e61755a7f5 | https://github.com/skaterdav85/validatorjs/blob/7cdb58f064a77237de13072057dc35e61755a7f5/src/validator.js#L150-L154 | |
9,466 | skaterdav85/validatorjs | src/validator.js | function (obj, path) {
if (Object.prototype.hasOwnProperty.call(obj, path)) {
return obj[path];
}
var keys = path.replace(/\[(\w+)\]/g, ".$1").replace(/^\./, "").split(".");
var copy = {};
for (var attr in obj) {
if (Object.prototype.hasOwnProperty.call(obj, attr)) {
copy[attr] ... | javascript | function (obj, path) {
if (Object.prototype.hasOwnProperty.call(obj, path)) {
return obj[path];
}
var keys = path.replace(/\[(\w+)\]/g, ".$1").replace(/^\./, "").split(".");
var copy = {};
for (var attr in obj) {
if (Object.prototype.hasOwnProperty.call(obj, attr)) {
copy[attr] ... | [
"function",
"(",
"obj",
",",
"path",
")",
"{",
"if",
"(",
"Object",
".",
"prototype",
".",
"hasOwnProperty",
".",
"call",
"(",
"obj",
",",
"path",
")",
")",
"{",
"return",
"obj",
"[",
"path",
"]",
";",
"}",
"var",
"keys",
"=",
"path",
".",
"repla... | Extract value from nested object using string path with dot notation
@param {object} object to search in
@param {string} path inside object
@return {any|void} value under the path | [
"Extract",
"value",
"from",
"nested",
"object",
"using",
"string",
"path",
"with",
"dot",
"notation"
] | 7cdb58f064a77237de13072057dc35e61755a7f5 | https://github.com/skaterdav85/validatorjs/blob/7cdb58f064a77237de13072057dc35e61755a7f5/src/validator.js#L195-L216 | |
9,467 | skaterdav85/validatorjs | src/validator.js | function (rulesArray) {
var rules = [];
for (var i = 0, len = rulesArray.length; i < len; i++) {
if (typeof rulesArray[i] === 'object') {
for (var rule in rulesArray[i]) {
rules.push({
name: rule,
value: rulesArray[i][rule]
});
}
} else {
... | javascript | function (rulesArray) {
var rules = [];
for (var i = 0, len = rulesArray.length; i < len; i++) {
if (typeof rulesArray[i] === 'object') {
for (var rule in rulesArray[i]) {
rules.push({
name: rule,
value: rulesArray[i][rule]
});
}
} else {
... | [
"function",
"(",
"rulesArray",
")",
"{",
"var",
"rules",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"len",
"=",
"rulesArray",
".",
"length",
";",
"i",
"<",
"len",
";",
"i",
"++",
")",
"{",
"if",
"(",
"typeof",
"rulesArray",
"[",... | Prepare rules if it comes in Array. Check for objects. Need for type validation.
@param {array} rulesArray
@return {array} | [
"Prepare",
"rules",
"if",
"it",
"comes",
"in",
"Array",
".",
"Check",
"for",
"objects",
".",
"Need",
"for",
"type",
"validation",
"."
] | 7cdb58f064a77237de13072057dc35e61755a7f5 | https://github.com/skaterdav85/validatorjs/blob/7cdb58f064a77237de13072057dc35e61755a7f5/src/validator.js#L330-L347 | |
9,468 | skaterdav85/validatorjs | src/validator.js | function (attribute, findRules) {
var rules = this.rules[attribute] || [];
for (var i = 0, len = rules.length; i < len; i++) {
if (findRules.indexOf(rules[i].name) > -1) {
return true;
}
}
return false;
} | javascript | function (attribute, findRules) {
var rules = this.rules[attribute] || [];
for (var i = 0, len = rules.length; i < len; i++) {
if (findRules.indexOf(rules[i].name) > -1) {
return true;
}
}
return false;
} | [
"function",
"(",
"attribute",
",",
"findRules",
")",
"{",
"var",
"rules",
"=",
"this",
".",
"rules",
"[",
"attribute",
"]",
"||",
"[",
"]",
";",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"len",
"=",
"rules",
".",
"length",
";",
"i",
"<",
"len",
";... | Determine if attribute has any of the given rules
@param {string} attribute
@param {array} findRules
@return {boolean} | [
"Determine",
"if",
"attribute",
"has",
"any",
"of",
"the",
"given",
"rules"
] | 7cdb58f064a77237de13072057dc35e61755a7f5 | https://github.com/skaterdav85/validatorjs/blob/7cdb58f064a77237de13072057dc35e61755a7f5/src/validator.js#L387-L395 | |
9,469 | skaterdav85/validatorjs | src/validator.js | function (rule, value) {
if (Rules.isImplicit(rule.name)) {
return true;
}
return this.getRule('required').validate(value);
} | javascript | function (rule, value) {
if (Rules.isImplicit(rule.name)) {
return true;
}
return this.getRule('required').validate(value);
} | [
"function",
"(",
"rule",
",",
"value",
")",
"{",
"if",
"(",
"Rules",
".",
"isImplicit",
"(",
"rule",
".",
"name",
")",
")",
"{",
"return",
"true",
";",
"}",
"return",
"this",
".",
"getRule",
"(",
"'required'",
")",
".",
"validate",
"(",
"value",
")... | Determine if rule is validatable
@param {Rule} rule
@param {mixed} value
@return {boolean} | [
"Determine",
"if",
"rule",
"is",
"validatable"
] | 7cdb58f064a77237de13072057dc35e61755a7f5 | https://github.com/skaterdav85/validatorjs/blob/7cdb58f064a77237de13072057dc35e61755a7f5/src/validator.js#L414-L420 | |
9,470 | skaterdav85/validatorjs | src/validator.js | function (attribute, rulePassed) {
var stopOnAttributes = this.stopOnAttributes;
if (typeof stopOnAttributes === 'undefined' || stopOnAttributes === false || rulePassed === true) {
return false;
}
if (stopOnAttributes instanceof Array) {
return stopOnAttributes.indexOf(attribute) > -1;
... | javascript | function (attribute, rulePassed) {
var stopOnAttributes = this.stopOnAttributes;
if (typeof stopOnAttributes === 'undefined' || stopOnAttributes === false || rulePassed === true) {
return false;
}
if (stopOnAttributes instanceof Array) {
return stopOnAttributes.indexOf(attribute) > -1;
... | [
"function",
"(",
"attribute",
",",
"rulePassed",
")",
"{",
"var",
"stopOnAttributes",
"=",
"this",
".",
"stopOnAttributes",
";",
"if",
"(",
"typeof",
"stopOnAttributes",
"===",
"'undefined'",
"||",
"stopOnAttributes",
"===",
"false",
"||",
"rulePassed",
"===",
"... | Determine if we should stop validating.
@param {string} attribute
@param {boolean} rulePassed
@return {boolean} | [
"Determine",
"if",
"we",
"should",
"stop",
"validating",
"."
] | 7cdb58f064a77237de13072057dc35e61755a7f5 | https://github.com/skaterdav85/validatorjs/blob/7cdb58f064a77237de13072057dc35e61755a7f5/src/validator.js#L429-L441 | |
9,471 | skaterdav85/validatorjs | src/rules.js | function(val, req, attribute) {
if (val) {
req = parseFloat(req);
var size = this.getSize();
return size === req;
}
return true;
} | javascript | function(val, req, attribute) {
if (val) {
req = parseFloat(req);
var size = this.getSize();
return size === req;
}
return true;
} | [
"function",
"(",
"val",
",",
"req",
",",
"attribute",
")",
"{",
"if",
"(",
"val",
")",
"{",
"req",
"=",
"parseFloat",
"(",
"req",
")",
";",
"var",
"size",
"=",
"this",
".",
"getSize",
"(",
")",
";",
"return",
"size",
"===",
"req",
";",
"}",
"re... | compares the size of strings with numbers, compares the value | [
"compares",
"the",
"size",
"of",
"strings",
"with",
"numbers",
"compares",
"the",
"value"
] | 7cdb58f064a77237de13072057dc35e61755a7f5 | https://github.com/skaterdav85/validatorjs/blob/7cdb58f064a77237de13072057dc35e61755a7f5/src/rules.js#L121-L131 | |
9,472 | skaterdav85/validatorjs | src/rules.js | function(inputValue, ruleValue, attribute, callback) {
var fn = this.isMissed() ? missedRuleValidator : this.fn;
return fn.apply(this, [inputValue, ruleValue, attribute, callback]);
} | javascript | function(inputValue, ruleValue, attribute, callback) {
var fn = this.isMissed() ? missedRuleValidator : this.fn;
return fn.apply(this, [inputValue, ruleValue, attribute, callback]);
} | [
"function",
"(",
"inputValue",
",",
"ruleValue",
",",
"attribute",
",",
"callback",
")",
"{",
"var",
"fn",
"=",
"this",
".",
"isMissed",
"(",
")",
"?",
"missedRuleValidator",
":",
"this",
".",
"fn",
";",
"return",
"fn",
".",
"apply",
"(",
"this",
",",
... | Apply validation function
@param {mixed} inputValue
@param {mixed} ruleValue
@param {string} attribute
@param {function} callback
@return {boolean|undefined} | [
"Apply",
"validation",
"function"
] | 7cdb58f064a77237de13072057dc35e61755a7f5 | https://github.com/skaterdav85/validatorjs/blob/7cdb58f064a77237de13072057dc35e61755a7f5/src/rules.js#L439-L443 | |
9,473 | skaterdav85/validatorjs | src/rules.js | function() {
var value = this.inputValue;
if (value instanceof Array) {
return value.length;
}
if (typeof value === 'number') {
return value;
}
if (this.validator._hasNumericRule(this.attribute)) {
return parseFloat(value, 10);
}
return value.length;
} | javascript | function() {
var value = this.inputValue;
if (value instanceof Array) {
return value.length;
}
if (typeof value === 'number') {
return value;
}
if (this.validator._hasNumericRule(this.attribute)) {
return parseFloat(value, 10);
}
return value.length;
} | [
"function",
"(",
")",
"{",
"var",
"value",
"=",
"this",
".",
"inputValue",
";",
"if",
"(",
"value",
"instanceof",
"Array",
")",
"{",
"return",
"value",
".",
"length",
";",
"}",
"if",
"(",
"typeof",
"value",
"===",
"'number'",
")",
"{",
"return",
"val... | Get true size of value
@return {integer|float} | [
"Get",
"true",
"size",
"of",
"value"
] | 7cdb58f064a77237de13072057dc35e61755a7f5 | https://github.com/skaterdav85/validatorjs/blob/7cdb58f064a77237de13072057dc35e61755a7f5/src/rules.js#L487-L503 | |
9,474 | skaterdav85/validatorjs | src/rules.js | function(passes, message) {
this.passes = (passes === undefined || passes === true);
this._customMessage = message;
this.callback(this.passes, message);
} | javascript | function(passes, message) {
this.passes = (passes === undefined || passes === true);
this._customMessage = message;
this.callback(this.passes, message);
} | [
"function",
"(",
"passes",
",",
"message",
")",
"{",
"this",
".",
"passes",
"=",
"(",
"passes",
"===",
"undefined",
"||",
"passes",
"===",
"true",
")",
";",
"this",
".",
"_customMessage",
"=",
"message",
";",
"this",
".",
"callback",
"(",
"this",
".",
... | Set the async callback response
@param {boolean|undefined} passes Whether validation passed
@param {string|undefined} message Custom error message
@return {void} | [
"Set",
"the",
"async",
"callback",
"response"
] | 7cdb58f064a77237de13072057dc35e61755a7f5 | https://github.com/skaterdav85/validatorjs/blob/7cdb58f064a77237de13072057dc35e61755a7f5/src/rules.js#L526-L530 | |
9,475 | skaterdav85/validatorjs | src/rules.js | function(name, validator) {
var async = this.isAsync(name);
var rule = new Rule(name, rules[name], async);
rule.setValidator(validator);
return rule;
} | javascript | function(name, validator) {
var async = this.isAsync(name);
var rule = new Rule(name, rules[name], async);
rule.setValidator(validator);
return rule;
} | [
"function",
"(",
"name",
",",
"validator",
")",
"{",
"var",
"async",
"=",
"this",
".",
"isAsync",
"(",
"name",
")",
";",
"var",
"rule",
"=",
"new",
"Rule",
"(",
"name",
",",
"rules",
"[",
"name",
"]",
",",
"async",
")",
";",
"rule",
".",
"setVali... | Get rule by name
@param {string} name
@param {Validator}
@return {Rule} | [
"Get",
"rule",
"by",
"name"
] | 7cdb58f064a77237de13072057dc35e61755a7f5 | https://github.com/skaterdav85/validatorjs/blob/7cdb58f064a77237de13072057dc35e61755a7f5/src/rules.js#L579-L584 | |
9,476 | skaterdav85/validatorjs | src/rules.js | function(name) {
for (var i = 0, len = this.asyncRules.length; i < len; i++) {
if (this.asyncRules[i] === name) {
return true;
}
}
return false;
} | javascript | function(name) {
for (var i = 0, len = this.asyncRules.length; i < len; i++) {
if (this.asyncRules[i] === name) {
return true;
}
}
return false;
} | [
"function",
"(",
"name",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"len",
"=",
"this",
".",
"asyncRules",
".",
"length",
";",
"i",
"<",
"len",
";",
"i",
"++",
")",
"{",
"if",
"(",
"this",
".",
"asyncRules",
"[",
"i",
"]",
"===",
"name"... | Determine if given rule is async
@param {string} name
@return {boolean} | [
"Determine",
"if",
"given",
"rule",
"is",
"async"
] | 7cdb58f064a77237de13072057dc35e61755a7f5 | https://github.com/skaterdav85/validatorjs/blob/7cdb58f064a77237de13072057dc35e61755a7f5/src/rules.js#L592-L599 | |
9,477 | skaterdav85/validatorjs | src/errors.js | function(attribute, message) {
if (!this.has(attribute)) {
this.errors[attribute] = [];
}
if (this.errors[attribute].indexOf(message) === -1) {
this.errors[attribute].push(message);
}
} | javascript | function(attribute, message) {
if (!this.has(attribute)) {
this.errors[attribute] = [];
}
if (this.errors[attribute].indexOf(message) === -1) {
this.errors[attribute].push(message);
}
} | [
"function",
"(",
"attribute",
",",
"message",
")",
"{",
"if",
"(",
"!",
"this",
".",
"has",
"(",
"attribute",
")",
")",
"{",
"this",
".",
"errors",
"[",
"attribute",
"]",
"=",
"[",
"]",
";",
"}",
"if",
"(",
"this",
".",
"errors",
"[",
"attribute"... | Add new error message for given attribute
@param {string} attribute
@param {string} message
@return {void} | [
"Add",
"new",
"error",
"message",
"for",
"given",
"attribute"
] | 7cdb58f064a77237de13072057dc35e61755a7f5 | https://github.com/skaterdav85/validatorjs/blob/7cdb58f064a77237de13072057dc35e61755a7f5/src/errors.js#L15-L23 | |
9,478 | skaterdav85/validatorjs | src/async.js | function(index) {
var rule = this.resolvers[index];
if (rule.passes === true) {
this.passed.push(rule);
} else if (rule.passes === false) {
this.failed.push(rule);
this.onFailedOne(rule);
}
this.fire();
} | javascript | function(index) {
var rule = this.resolvers[index];
if (rule.passes === true) {
this.passed.push(rule);
} else if (rule.passes === false) {
this.failed.push(rule);
this.onFailedOne(rule);
}
this.fire();
} | [
"function",
"(",
"index",
")",
"{",
"var",
"rule",
"=",
"this",
".",
"resolvers",
"[",
"index",
"]",
";",
"if",
"(",
"rule",
".",
"passes",
"===",
"true",
")",
"{",
"this",
".",
"passed",
".",
"push",
"(",
"rule",
")",
";",
"}",
"else",
"if",
"... | Resolve given index
@param {integer} index
@return {void} | [
"Resolve",
"given",
"index"
] | 7cdb58f064a77237de13072057dc35e61755a7f5 | https://github.com/skaterdav85/validatorjs/blob/7cdb58f064a77237de13072057dc35e61755a7f5/src/async.js#L32-L42 | |
9,479 | ionic-team/ng-cordova | demo/www/lib/angular-ui-router/src/common.js | ancestors | function ancestors(first, second) {
var path = [];
for (var n in first.path) {
if (first.path[n] !== second.path[n]) break;
path.push(first.path[n]);
}
return path;
} | javascript | function ancestors(first, second) {
var path = [];
for (var n in first.path) {
if (first.path[n] !== second.path[n]) break;
path.push(first.path[n]);
}
return path;
} | [
"function",
"ancestors",
"(",
"first",
",",
"second",
")",
"{",
"var",
"path",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"n",
"in",
"first",
".",
"path",
")",
"{",
"if",
"(",
"first",
".",
"path",
"[",
"n",
"]",
"!==",
"second",
".",
"path",
"[",
... | Finds the common ancestor path between two states.
@param {Object} first The first state.
@param {Object} second The second state.
@return {Array} Returns an array of state names in descending order, not including the root. | [
"Finds",
"the",
"common",
"ancestor",
"path",
"between",
"two",
"states",
"."
] | 2a401e063eda2889cd54abf17365c22286e32285 | https://github.com/ionic-team/ng-cordova/blob/2a401e063eda2889cd54abf17365c22286e32285/demo/www/lib/angular-ui-router/src/common.js#L36-L44 |
9,480 | ionic-team/ng-cordova | demo/www/lib/angular-ui-router/src/common.js | equalForKeys | function equalForKeys(a, b, keys) {
if (!keys) {
keys = [];
for (var n in a) keys.push(n); // Used instead of Object.keys() for IE8 compatibility
}
for (var i=0; i<keys.length; i++) {
var k = keys[i];
if (a[k] != b[k]) return false; // Not '===', values aren't necessarily normalized
}
return ... | javascript | function equalForKeys(a, b, keys) {
if (!keys) {
keys = [];
for (var n in a) keys.push(n); // Used instead of Object.keys() for IE8 compatibility
}
for (var i=0; i<keys.length; i++) {
var k = keys[i];
if (a[k] != b[k]) return false; // Not '===', values aren't necessarily normalized
}
return ... | [
"function",
"equalForKeys",
"(",
"a",
",",
"b",
",",
"keys",
")",
"{",
"if",
"(",
"!",
"keys",
")",
"{",
"keys",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"n",
"in",
"a",
")",
"keys",
".",
"push",
"(",
"n",
")",
";",
"// Used instead of Object.keys(... | Performs a non-strict comparison of the subset of two objects, defined by a list of keys.
@param {Object} a The first object.
@param {Object} b The second object.
@param {Array} keys The list of keys within each object to compare. If the list is empty or not specified,
it defaults to the list of keys in `a`.
@return {... | [
"Performs",
"a",
"non",
"-",
"strict",
"comparison",
"of",
"the",
"subset",
"of",
"two",
"objects",
"defined",
"by",
"a",
"list",
"of",
"keys",
"."
] | 2a401e063eda2889cd54abf17365c22286e32285 | https://github.com/ionic-team/ng-cordova/blob/2a401e063eda2889cd54abf17365c22286e32285/demo/www/lib/angular-ui-router/src/common.js#L121-L132 |
9,481 | ionic-team/ng-cordova | demo/www/lib/angular-ui-router/src/common.js | filterByKeys | function filterByKeys(keys, values) {
var filtered = {};
forEach(keys, function (name) {
filtered[name] = values[name];
});
return filtered;
} | javascript | function filterByKeys(keys, values) {
var filtered = {};
forEach(keys, function (name) {
filtered[name] = values[name];
});
return filtered;
} | [
"function",
"filterByKeys",
"(",
"keys",
",",
"values",
")",
"{",
"var",
"filtered",
"=",
"{",
"}",
";",
"forEach",
"(",
"keys",
",",
"function",
"(",
"name",
")",
"{",
"filtered",
"[",
"name",
"]",
"=",
"values",
"[",
"name",
"]",
";",
"}",
")",
... | Returns the subset of an object, based on a list of keys.
@param {Array} keys
@param {Object} values
@return {Boolean} Returns a subset of `values`. | [
"Returns",
"the",
"subset",
"of",
"an",
"object",
"based",
"on",
"a",
"list",
"of",
"keys",
"."
] | 2a401e063eda2889cd54abf17365c22286e32285 | https://github.com/ionic-team/ng-cordova/blob/2a401e063eda2889cd54abf17365c22286e32285/demo/www/lib/angular-ui-router/src/common.js#L141-L148 |
9,482 | ionic-team/ng-cordova | demo/www/lib/angular-ui-router/src/common.js | indexBy | function indexBy(array, propName) {
var result = {};
forEach(array, function(item) {
result[item[propName]] = item;
});
return result;
} | javascript | function indexBy(array, propName) {
var result = {};
forEach(array, function(item) {
result[item[propName]] = item;
});
return result;
} | [
"function",
"indexBy",
"(",
"array",
",",
"propName",
")",
"{",
"var",
"result",
"=",
"{",
"}",
";",
"forEach",
"(",
"array",
",",
"function",
"(",
"item",
")",
"{",
"result",
"[",
"item",
"[",
"propName",
"]",
"]",
"=",
"item",
";",
"}",
")",
";... | like _.indexBy when you know that your index values will be unique, or you want last-one-in to win | [
"like",
"_",
".",
"indexBy",
"when",
"you",
"know",
"that",
"your",
"index",
"values",
"will",
"be",
"unique",
"or",
"you",
"want",
"last",
"-",
"one",
"-",
"in",
"to",
"win"
] | 2a401e063eda2889cd54abf17365c22286e32285 | https://github.com/ionic-team/ng-cordova/blob/2a401e063eda2889cd54abf17365c22286e32285/demo/www/lib/angular-ui-router/src/common.js#L152-L158 |
9,483 | ionic-team/ng-cordova | demo/www/lib/angular-ui-router/src/common.js | pick | function pick(obj) {
var copy = {};
var keys = Array.prototype.concat.apply(Array.prototype, Array.prototype.slice.call(arguments, 1));
forEach(keys, function(key) {
if (key in obj) copy[key] = obj[key];
});
return copy;
} | javascript | function pick(obj) {
var copy = {};
var keys = Array.prototype.concat.apply(Array.prototype, Array.prototype.slice.call(arguments, 1));
forEach(keys, function(key) {
if (key in obj) copy[key] = obj[key];
});
return copy;
} | [
"function",
"pick",
"(",
"obj",
")",
"{",
"var",
"copy",
"=",
"{",
"}",
";",
"var",
"keys",
"=",
"Array",
".",
"prototype",
".",
"concat",
".",
"apply",
"(",
"Array",
".",
"prototype",
",",
"Array",
".",
"prototype",
".",
"slice",
".",
"call",
"(",... | extracted from underscore.js Return a copy of the object only containing the whitelisted properties. | [
"extracted",
"from",
"underscore",
".",
"js",
"Return",
"a",
"copy",
"of",
"the",
"object",
"only",
"containing",
"the",
"whitelisted",
"properties",
"."
] | 2a401e063eda2889cd54abf17365c22286e32285 | https://github.com/ionic-team/ng-cordova/blob/2a401e063eda2889cd54abf17365c22286e32285/demo/www/lib/angular-ui-router/src/common.js#L162-L169 |
9,484 | ionic-team/ng-cordova | demo/www/lib/angular-ui-router/src/common.js | omit | function omit(obj) {
var copy = {};
var keys = Array.prototype.concat.apply(Array.prototype, Array.prototype.slice.call(arguments, 1));
for (var key in obj) {
if (indexOf(keys, key) == -1) copy[key] = obj[key];
}
return copy;
} | javascript | function omit(obj) {
var copy = {};
var keys = Array.prototype.concat.apply(Array.prototype, Array.prototype.slice.call(arguments, 1));
for (var key in obj) {
if (indexOf(keys, key) == -1) copy[key] = obj[key];
}
return copy;
} | [
"function",
"omit",
"(",
"obj",
")",
"{",
"var",
"copy",
"=",
"{",
"}",
";",
"var",
"keys",
"=",
"Array",
".",
"prototype",
".",
"concat",
".",
"apply",
"(",
"Array",
".",
"prototype",
",",
"Array",
".",
"prototype",
".",
"slice",
".",
"call",
"(",... | extracted from underscore.js Return a copy of the object omitting the blacklisted properties. | [
"extracted",
"from",
"underscore",
".",
"js",
"Return",
"a",
"copy",
"of",
"the",
"object",
"omitting",
"the",
"blacklisted",
"properties",
"."
] | 2a401e063eda2889cd54abf17365c22286e32285 | https://github.com/ionic-team/ng-cordova/blob/2a401e063eda2889cd54abf17365c22286e32285/demo/www/lib/angular-ui-router/src/common.js#L173-L180 |
9,485 | ionic-team/ng-cordova | demo/www/lib/angular-ui-router/src/state.js | function(state) {
var url = state.url, config = { params: state.params || {} };
if (isString(url)) {
if (url.charAt(0) == '^') return $urlMatcherFactory.compile(url.substring(1), config);
return (state.parent.navigable || root).url.concat(url, config);
}
if (!url || $urlMatcher... | javascript | function(state) {
var url = state.url, config = { params: state.params || {} };
if (isString(url)) {
if (url.charAt(0) == '^') return $urlMatcherFactory.compile(url.substring(1), config);
return (state.parent.navigable || root).url.concat(url, config);
}
if (!url || $urlMatcher... | [
"function",
"(",
"state",
")",
"{",
"var",
"url",
"=",
"state",
".",
"url",
",",
"config",
"=",
"{",
"params",
":",
"state",
".",
"params",
"||",
"{",
"}",
"}",
";",
"if",
"(",
"isString",
"(",
"url",
")",
")",
"{",
"if",
"(",
"url",
".",
"ch... | Build a URLMatcher if necessary, either via a relative or absolute URL | [
"Build",
"a",
"URLMatcher",
"if",
"necessary",
"either",
"via",
"a",
"relative",
"or",
"absolute",
"URL"
] | 2a401e063eda2889cd54abf17365c22286e32285 | https://github.com/ionic-team/ng-cordova/blob/2a401e063eda2889cd54abf17365c22286e32285/demo/www/lib/angular-ui-router/src/state.js#L50-L60 | |
9,486 | ionic-team/ng-cordova | demo/www/lib/angular-ui-router/src/state.js | function(state) {
var params = state.url && state.url.params || new $$UMFP.ParamSet();
forEach(state.params || {}, function(config, id) {
if (!params[id]) params[id] = new $$UMFP.Param(id, null, config, "config");
});
return params;
} | javascript | function(state) {
var params = state.url && state.url.params || new $$UMFP.ParamSet();
forEach(state.params || {}, function(config, id) {
if (!params[id]) params[id] = new $$UMFP.Param(id, null, config, "config");
});
return params;
} | [
"function",
"(",
"state",
")",
"{",
"var",
"params",
"=",
"state",
".",
"url",
"&&",
"state",
".",
"url",
".",
"params",
"||",
"new",
"$$UMFP",
".",
"ParamSet",
"(",
")",
";",
"forEach",
"(",
"state",
".",
"params",
"||",
"{",
"}",
",",
"function",... | Own parameters for this state. state.url.params is already built at this point. Create and add non-url params | [
"Own",
"parameters",
"for",
"this",
"state",
".",
"state",
".",
"url",
".",
"params",
"is",
"already",
"built",
"at",
"this",
"point",
".",
"Create",
"and",
"add",
"non",
"-",
"url",
"params"
] | 2a401e063eda2889cd54abf17365c22286e32285 | https://github.com/ionic-team/ng-cordova/blob/2a401e063eda2889cd54abf17365c22286e32285/demo/www/lib/angular-ui-router/src/state.js#L68-L74 | |
9,487 | ionic-team/ng-cordova | demo/www/lib/angular-ui-router/src/state.js | function(state) {
var views = {};
forEach(isDefined(state.views) ? state.views : { '': state }, function (view, name) {
if (name.indexOf('@') < 0) name += '@' + state.parent.name;
views[name] = view;
});
return views;
} | javascript | function(state) {
var views = {};
forEach(isDefined(state.views) ? state.views : { '': state }, function (view, name) {
if (name.indexOf('@') < 0) name += '@' + state.parent.name;
views[name] = view;
});
return views;
} | [
"function",
"(",
"state",
")",
"{",
"var",
"views",
"=",
"{",
"}",
";",
"forEach",
"(",
"isDefined",
"(",
"state",
".",
"views",
")",
"?",
"state",
".",
"views",
":",
"{",
"''",
":",
"state",
"}",
",",
"function",
"(",
"view",
",",
"name",
")",
... | If there is no explicit multi-view configuration, make one up so we don't have to handle both cases in the view directive later. Note that having an explicit 'views' property will mean the default unnamed view properties are ignored. This is also a good time to resolve view names to absolute names, so everything is a s... | [
"If",
"there",
"is",
"no",
"explicit",
"multi",
"-",
"view",
"configuration",
"make",
"one",
"up",
"so",
"we",
"don",
"t",
"have",
"to",
"handle",
"both",
"cases",
"in",
"the",
"view",
"directive",
"later",
".",
"Note",
"that",
"having",
"an",
"explicit"... | 2a401e063eda2889cd54abf17365c22286e32285 | https://github.com/ionic-team/ng-cordova/blob/2a401e063eda2889cd54abf17365c22286e32285/demo/www/lib/angular-ui-router/src/state.js#L86-L94 | |
9,488 | ionic-team/ng-cordova | demo/www/lib/angular-ui-router/src/state.js | handleRedirect | function handleRedirect(redirect, state, params, options) {
/**
* @ngdoc event
* @name ui.router.state.$state#$stateNotFound
* @eventOf ui.router.state.$state
* @eventType broadcast on root scope
* @description
* Fired when a requested state **cannot be found** using the ... | javascript | function handleRedirect(redirect, state, params, options) {
/**
* @ngdoc event
* @name ui.router.state.$state#$stateNotFound
* @eventOf ui.router.state.$state
* @eventType broadcast on root scope
* @description
* Fired when a requested state **cannot be found** using the ... | [
"function",
"handleRedirect",
"(",
"redirect",
",",
"state",
",",
"params",
",",
"options",
")",
"{",
"/**\n * @ngdoc event\n * @name ui.router.state.$state#$stateNotFound\n * @eventOf ui.router.state.$state\n * @eventType broadcast on root scope\n * @descriptio... | Handles the case where a state which is the target of a transition is not found, and the user can optionally retry or defer the transition | [
"Handles",
"the",
"case",
"where",
"a",
"state",
"which",
"is",
"the",
"target",
"of",
"a",
"transition",
"is",
"not",
"found",
"and",
"the",
"user",
"can",
"optionally",
"retry",
"or",
"defer",
"the",
"transition"
] | 2a401e063eda2889cd54abf17365c22286e32285 | https://github.com/ionic-team/ng-cordova/blob/2a401e063eda2889cd54abf17365c22286e32285/demo/www/lib/angular-ui-router/src/state.js#L713-L774 |
9,489 | ionic-team/ng-cordova | demo/www/lib/angular-ui-router/src/urlMatcherFactory.js | getSquashPolicy | function getSquashPolicy(config, isOptional) {
var squash = config.squash;
if (!isOptional || squash === false) return false;
if (!isDefined(squash) || squash == null) return defaultSquashPolicy;
if (squash === true || isString(squash)) return squash;
throw new Error("Invalid squash policy... | javascript | function getSquashPolicy(config, isOptional) {
var squash = config.squash;
if (!isOptional || squash === false) return false;
if (!isDefined(squash) || squash == null) return defaultSquashPolicy;
if (squash === true || isString(squash)) return squash;
throw new Error("Invalid squash policy... | [
"function",
"getSquashPolicy",
"(",
"config",
",",
"isOptional",
")",
"{",
"var",
"squash",
"=",
"config",
".",
"squash",
";",
"if",
"(",
"!",
"isOptional",
"||",
"squash",
"===",
"false",
")",
"return",
"false",
";",
"if",
"(",
"!",
"isDefined",
"(",
... | returns false, true, or the squash value to indicate the "default parameter url squash policy". | [
"returns",
"false",
"true",
"or",
"the",
"squash",
"value",
"to",
"indicate",
"the",
"default",
"parameter",
"url",
"squash",
"policy",
"."
] | 2a401e063eda2889cd54abf17365c22286e32285 | https://github.com/ionic-team/ng-cordova/blob/2a401e063eda2889cd54abf17365c22286e32285/demo/www/lib/angular-ui-router/src/urlMatcherFactory.js#L923-L929 |
9,490 | ionic-team/ng-cordova | src/plugins/bluetoothSerial.js | function (address) {
var q = $q.defer();
$window.bluetoothSerial.connectInsecure(address, function () {
q.resolve();
}, function (error) {
q.reject(error);
});
return q.promise;
} | javascript | function (address) {
var q = $q.defer();
$window.bluetoothSerial.connectInsecure(address, function () {
q.resolve();
}, function (error) {
q.reject(error);
});
return q.promise;
} | [
"function",
"(",
"address",
")",
"{",
"var",
"q",
"=",
"$q",
".",
"defer",
"(",
")",
";",
"$window",
".",
"bluetoothSerial",
".",
"connectInsecure",
"(",
"address",
",",
"function",
"(",
")",
"{",
"q",
".",
"resolve",
"(",
")",
";",
"}",
",",
"func... | not supported on iOS | [
"not",
"supported",
"on",
"iOS"
] | 2a401e063eda2889cd54abf17365c22286e32285 | https://github.com/ionic-team/ng-cordova/blob/2a401e063eda2889cd54abf17365c22286e32285/src/plugins/bluetoothSerial.js#L26-L34 | |
9,491 | ionic-team/ng-cordova | dist/ng-cordova.js | function (workout) {
var q = $q.defer();
$window.plugins.healthkit.saveWorkout(workout,
function (success) {
q.resolve(success);
},
function (err) {
q.resolve(err);
}
);
return q.promise;
} | javascript | function (workout) {
var q = $q.defer();
$window.plugins.healthkit.saveWorkout(workout,
function (success) {
q.resolve(success);
},
function (err) {
q.resolve(err);
}
);
return q.promise;
} | [
"function",
"(",
"workout",
")",
"{",
"var",
"q",
"=",
"$q",
".",
"defer",
"(",
")",
";",
"$window",
".",
"plugins",
".",
"healthkit",
".",
"saveWorkout",
"(",
"workout",
",",
"function",
"(",
"success",
")",
"{",
"q",
".",
"resolve",
"(",
"success",... | Save a workout.
Workout param should be of the format:
{
'activityType': 'HKWorkoutActivityTypeCycling', // HKWorkoutActivityType constant (https://developer.apple.com/library/ios/documentation/HealthKit/Reference/HKWorkout_Class/#//apple_ref/c/tdef/HKWorkoutActivityType)
'quantityType': 'HKQuantityTypeIdentifierDista... | [
"Save",
"a",
"workout",
"."
] | 2a401e063eda2889cd54abf17365c22286e32285 | https://github.com/ionic-team/ng-cordova/blob/2a401e063eda2889cd54abf17365c22286e32285/dist/ng-cordova.js#L4451-L4462 | |
9,492 | ionic-team/ng-cordova | dist/ng-cordova.js | function (promise){
promise.success = function (fn) {
promise.then(fn);
return promise;
};
promise.error = function (fn) {
promise.then(null, fn);
return promise;
};
} | javascript | function (promise){
promise.success = function (fn) {
promise.then(fn);
return promise;
};
promise.error = function (fn) {
promise.then(null, fn);
return promise;
};
} | [
"function",
"(",
"promise",
")",
"{",
"promise",
".",
"success",
"=",
"function",
"(",
"fn",
")",
"{",
"promise",
".",
"then",
"(",
"fn",
")",
";",
"return",
"promise",
";",
"}",
";",
"promise",
".",
"error",
"=",
"function",
"(",
"fn",
")",
"{",
... | Decorate the promise object.
@param promise The promise object. | [
"Decorate",
"the",
"promise",
"object",
"."
] | 2a401e063eda2889cd54abf17365c22286e32285 | https://github.com/ionic-team/ng-cordova/blob/2a401e063eda2889cd54abf17365c22286e32285/dist/ng-cordova.js#L6040-L6050 | |
9,493 | ionic-team/ng-cordova | dist/ng-cordova.js | function (key, value, dict) {
var deferred = $q.defer();
var promise = deferred.promise;
function ok(value){
deferred.resolve(value);
}
function errorCallback(error){
deferred.reject(new Error(error));
... | javascript | function (key, value, dict) {
var deferred = $q.defer();
var promise = deferred.promise;
function ok(value){
deferred.resolve(value);
}
function errorCallback(error){
deferred.reject(new Error(error));
... | [
"function",
"(",
"key",
",",
"value",
",",
"dict",
")",
"{",
"var",
"deferred",
"=",
"$q",
".",
"defer",
"(",
")",
";",
"var",
"promise",
"=",
"deferred",
".",
"promise",
";",
"function",
"ok",
"(",
"value",
")",
"{",
"deferred",
".",
"resolve",
"(... | Store the value of the given dictionary and key.
@param key The key of the preference.
@param value The value to set.
@param dict The dictionary. It's optional.
@returns Returns a promise. | [
"Store",
"the",
"value",
"of",
"the",
"given",
"dictionary",
"and",
"key",
"."
] | 2a401e063eda2889cd54abf17365c22286e32285 | https://github.com/ionic-team/ng-cordova/blob/2a401e063eda2889cd54abf17365c22286e32285/dist/ng-cordova.js#L6059-L6086 | |
9,494 | ionic-team/ng-cordova | dist/ng-cordova.js | function () {
var deferred = $q.defer();
var promise = deferred.promise;
function ok(value){
deferred.resolve(value);
}
function errorCallback(error){
deferred.reject(new Error(error));
}
... | javascript | function () {
var deferred = $q.defer();
var promise = deferred.promise;
function ok(value){
deferred.resolve(value);
}
function errorCallback(error){
deferred.reject(new Error(error));
}
... | [
"function",
"(",
")",
"{",
"var",
"deferred",
"=",
"$q",
".",
"defer",
"(",
")",
";",
"var",
"promise",
"=",
"deferred",
".",
"promise",
";",
"function",
"ok",
"(",
"value",
")",
"{",
"deferred",
".",
"resolve",
"(",
"value",
")",
";",
"}",
"functi... | Show the application preferences.
@returns Returns a promise. | [
"Show",
"the",
"application",
"preferences",
"."
] | 2a401e063eda2889cd54abf17365c22286e32285 | https://github.com/ionic-team/ng-cordova/blob/2a401e063eda2889cd54abf17365c22286e32285/dist/ng-cordova.js#L6160-L6181 | |
9,495 | ionic-team/ng-cordova | demo/www/lib/ionic/js/ionic.bundle.js | triggerEvent | function triggerEvent(gesture, eventData){
// create DOM event
var event = ionic.Gestures.DOCUMENT.createEvent('Event');
event.initEvent(gesture, true, true);
event.gesture = eventData;
// trigger on the target if it is in the instance element,
// this is for event delegation tricks... | javascript | function triggerEvent(gesture, eventData){
// create DOM event
var event = ionic.Gestures.DOCUMENT.createEvent('Event');
event.initEvent(gesture, true, true);
event.gesture = eventData;
// trigger on the target if it is in the instance element,
// this is for event delegation tricks... | [
"function",
"triggerEvent",
"(",
"gesture",
",",
"eventData",
")",
"{",
"// create DOM event",
"var",
"event",
"=",
"ionic",
".",
"Gestures",
".",
"DOCUMENT",
".",
"createEvent",
"(",
"'Event'",
")",
";",
"event",
".",
"initEvent",
"(",
"gesture",
",",
"true... | trigger gesture event
@param {String} gesture
@param {Object} eventData
@returns {ionic.Gestures.Instance} | [
"trigger",
"gesture",
"event"
] | 2a401e063eda2889cd54abf17365c22286e32285 | https://github.com/ionic-team/ng-cordova/blob/2a401e063eda2889cd54abf17365c22286e32285/demo/www/lib/ionic/js/ionic.bundle.js#L785-L800 |
9,496 | ionic-team/ng-cordova | demo/www/lib/ionic/js/ionic.bundle.js | getDirection | function getDirection(touch1, touch2) {
var x = Math.abs(touch1.pageX - touch2.pageX),
y = Math.abs(touch1.pageY - touch2.pageY);
if(x >= y) {
return touch1.pageX - touch2.pageX > 0 ? ionic.Gestures.DIRECTION_LEFT : ionic.Gestures.DIRECTION_RIGHT;
}
else {
return touch1.pa... | javascript | function getDirection(touch1, touch2) {
var x = Math.abs(touch1.pageX - touch2.pageX),
y = Math.abs(touch1.pageY - touch2.pageY);
if(x >= y) {
return touch1.pageX - touch2.pageX > 0 ? ionic.Gestures.DIRECTION_LEFT : ionic.Gestures.DIRECTION_RIGHT;
}
else {
return touch1.pa... | [
"function",
"getDirection",
"(",
"touch1",
",",
"touch2",
")",
"{",
"var",
"x",
"=",
"Math",
".",
"abs",
"(",
"touch1",
".",
"pageX",
"-",
"touch2",
".",
"pageX",
")",
",",
"y",
"=",
"Math",
".",
"abs",
"(",
"touch1",
".",
"pageY",
"-",
"touch2",
... | angle to direction define
@param {Touch} touch1
@param {Touch} touch2
@returns {String} direction constant, like ionic.Gestures.DIRECTION_LEFT | [
"angle",
"to",
"direction",
"define"
] | 2a401e063eda2889cd54abf17365c22286e32285 | https://github.com/ionic-team/ng-cordova/blob/2a401e063eda2889cd54abf17365c22286e32285/demo/www/lib/ionic/js/ionic.bundle.js#L1227-L1237 |
9,497 | ionic-team/ng-cordova | demo/www/lib/ionic/js/ionic.bundle.js | isVertical | function isVertical(direction) {
return (direction == ionic.Gestures.DIRECTION_UP || direction == ionic.Gestures.DIRECTION_DOWN);
} | javascript | function isVertical(direction) {
return (direction == ionic.Gestures.DIRECTION_UP || direction == ionic.Gestures.DIRECTION_DOWN);
} | [
"function",
"isVertical",
"(",
"direction",
")",
"{",
"return",
"(",
"direction",
"==",
"ionic",
".",
"Gestures",
".",
"DIRECTION_UP",
"||",
"direction",
"==",
"ionic",
".",
"Gestures",
".",
"DIRECTION_DOWN",
")",
";",
"}"
] | boolean if the direction is vertical
@param {String} direction
@returns {Boolean} is_vertical | [
"boolean",
"if",
"the",
"direction",
"is",
"vertical"
] | 2a401e063eda2889cd54abf17365c22286e32285 | https://github.com/ionic-team/ng-cordova/blob/2a401e063eda2889cd54abf17365c22286e32285/demo/www/lib/ionic/js/ionic.bundle.js#L1291-L1293 |
9,498 | ionic-team/ng-cordova | demo/www/lib/ionic/js/ionic.bundle.js | stopDefaultBrowserBehavior | function stopDefaultBrowserBehavior(element, css_class) {
// changed from making many style changes to just adding a preset classname
// less DOM manipulations, less code, and easier to control in the CSS side of things
// hammer.js doesn't come with CSS, but ionic does, which is why we prefer this me... | javascript | function stopDefaultBrowserBehavior(element, css_class) {
// changed from making many style changes to just adding a preset classname
// less DOM manipulations, less code, and easier to control in the CSS side of things
// hammer.js doesn't come with CSS, but ionic does, which is why we prefer this me... | [
"function",
"stopDefaultBrowserBehavior",
"(",
"element",
",",
"css_class",
")",
"{",
"// changed from making many style changes to just adding a preset classname",
"// less DOM manipulations, less code, and easier to control in the CSS side of things",
"// hammer.js doesn't come with CSS, but i... | stop browser default behavior with css class
@param {HtmlElement} element
@param {Object} css_class | [
"stop",
"browser",
"default",
"behavior",
"with",
"css",
"class"
] | 2a401e063eda2889cd54abf17365c22286e32285 | https://github.com/ionic-team/ng-cordova/blob/2a401e063eda2889cd54abf17365c22286e32285/demo/www/lib/ionic/js/ionic.bundle.js#L1301-L1311 |
9,499 | ionic-team/ng-cordova | demo/www/lib/ionic/js/ionic.bundle.js | detect | function detect(eventData) {
if(!this.current || this.stopped) {
return;
}
// extend event data with calculations about scale, distance etc
eventData = this.extendEventData(eventData);
// instance options
var inst_options = this.current.inst.options;
// call ionic.Ge... | javascript | function detect(eventData) {
if(!this.current || this.stopped) {
return;
}
// extend event data with calculations about scale, distance etc
eventData = this.extendEventData(eventData);
// instance options
var inst_options = this.current.inst.options;
// call ionic.Ge... | [
"function",
"detect",
"(",
"eventData",
")",
"{",
"if",
"(",
"!",
"this",
".",
"current",
"||",
"this",
".",
"stopped",
")",
"{",
"return",
";",
"}",
"// extend event data with calculations about scale, distance etc",
"eventData",
"=",
"this",
".",
"extendEventDat... | ionic.Gestures.gesture detection
@param {Object} eventData | [
"ionic",
".",
"Gestures",
".",
"gesture",
"detection"
] | 2a401e063eda2889cd54abf17365c22286e32285 | https://github.com/ionic-team/ng-cordova/blob/2a401e063eda2889cd54abf17365c22286e32285/demo/www/lib/ionic/js/ionic.bundle.js#L1358-L1394 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.