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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
17,000 | hflabs/suggestions-jquery | src/includes/suggestions.js | function () {
var that = this,
parentInstance = that.getParentInstance(),
parentValue = parentInstance && parentInstance.extendedCurrentValue(),
currentValue = $.trim(that.el.val());
return utils.compact([parentValue, currentValue]).join(' ');
} | javascript | function () {
var that = this,
parentInstance = that.getParentInstance(),
parentValue = parentInstance && parentInstance.extendedCurrentValue(),
currentValue = $.trim(that.el.val());
return utils.compact([parentValue, currentValue]).join(' ');
} | [
"function",
"(",
")",
"{",
"var",
"that",
"=",
"this",
",",
"parentInstance",
"=",
"that",
".",
"getParentInstance",
"(",
")",
",",
"parentValue",
"=",
"parentInstance",
"&&",
"parentInstance",
".",
"extendedCurrentValue",
"(",
")",
",",
"currentValue",
"=",
... | Querying related methods
Looks up parent instances
@returns {String} current value prepended by parents' values | [
"Querying",
"related",
"methods",
"Looks",
"up",
"parent",
"instances"
] | 17e3ac383790069ad4d3dd92185d9fb9e30382a7 | https://github.com/hflabs/suggestions-jquery/blob/17e3ac383790069ad4d3dd92185d9fb9e30382a7/src/includes/suggestions.js#L471-L478 | |
17,001 | hflabs/suggestions-jquery | src/includes/suggestions.js | function (query, customParams, requestOptions) {
var response,
that = this,
options = that.options,
noCallbacks = requestOptions && requestOptions.noCallbacks,
useEnrichmentCache = requestOptions && requestOptions.useEnrichmentCache,
method = requestOp... | javascript | function (query, customParams, requestOptions) {
var response,
that = this,
options = that.options,
noCallbacks = requestOptions && requestOptions.noCallbacks,
useEnrichmentCache = requestOptions && requestOptions.useEnrichmentCache,
method = requestOp... | [
"function",
"(",
"query",
",",
"customParams",
",",
"requestOptions",
")",
"{",
"var",
"response",
",",
"that",
"=",
"this",
",",
"options",
"=",
"that",
".",
"options",
",",
"noCallbacks",
"=",
"requestOptions",
"&&",
"requestOptions",
".",
"noCallbacks",
"... | Get suggestions from cache or from server
@param {String} query
@param {Object} customParams parameters specified here will be passed to request body
@param {Object} requestOptions
@param {Boolean} [requestOptions.noCallbacks] flag, request competence callbacks will not be invoked
@param {Boolean} [requestOptions.useE... | [
"Get",
"suggestions",
"from",
"cache",
"or",
"from",
"server"
] | 17e3ac383790069ad4d3dd92185d9fb9e30382a7 | https://github.com/hflabs/suggestions-jquery/blob/17e3ac383790069ad4d3dd92185d9fb9e30382a7/src/includes/suggestions.js#L595-L651 | |
17,002 | hflabs/suggestions-jquery | src/includes/suggestions.js | function (params, method) {
var that = this,
request = $.ajax(
that.getAjaxParams(method, { data: utils.serialize(params) })
);
that.abortRequest();
that.currentRequest = request;
that.notify('request');
request.always(function () {
... | javascript | function (params, method) {
var that = this,
request = $.ajax(
that.getAjaxParams(method, { data: utils.serialize(params) })
);
that.abortRequest();
that.currentRequest = request;
that.notify('request');
request.always(function () {
... | [
"function",
"(",
"params",
",",
"method",
")",
"{",
"var",
"that",
"=",
"this",
",",
"request",
"=",
"$",
".",
"ajax",
"(",
"that",
".",
"getAjaxParams",
"(",
"method",
",",
"{",
"data",
":",
"utils",
".",
"serialize",
"(",
"params",
")",
"}",
")",... | Sends an AJAX request to server suggest method.
@param {Object} params request params
@returns {$.Deferred} response promise | [
"Sends",
"an",
"AJAX",
"request",
"to",
"server",
"suggest",
"method",
"."
] | 17e3ac383790069ad4d3dd92185d9fb9e30382a7 | https://github.com/hflabs/suggestions-jquery/blob/17e3ac383790069ad4d3dd92185d9fb9e30382a7/src/includes/suggestions.js#L658-L674 | |
17,003 | hflabs/suggestions-jquery | src/includes/suggestions.js | function (response) {
var that = this,
suggestions;
if (!response || !$.isArray(response.suggestions)) {
return false;
}
that.verifySuggestionsFormat(response.suggestions);
that.setUnrestrictedValues(response.suggestions);
if ($.isFunction(that.... | javascript | function (response) {
var that = this,
suggestions;
if (!response || !$.isArray(response.suggestions)) {
return false;
}
that.verifySuggestionsFormat(response.suggestions);
that.setUnrestrictedValues(response.suggestions);
if ($.isFunction(that.... | [
"function",
"(",
"response",
")",
"{",
"var",
"that",
"=",
"this",
",",
"suggestions",
";",
"if",
"(",
"!",
"response",
"||",
"!",
"$",
".",
"isArray",
"(",
"response",
".",
"suggestions",
")",
")",
"{",
"return",
"false",
";",
"}",
"that",
".",
"v... | Checks response format and data
@return {Boolean} response contains acceptable data | [
"Checks",
"response",
"format",
"and",
"data"
] | 17e3ac383790069ad4d3dd92185d9fb9e30382a7 | https://github.com/hflabs/suggestions-jquery/blob/17e3ac383790069ad4d3dd92185d9fb9e30382a7/src/includes/suggestions.js#L700-L719 | |
17,004 | hflabs/suggestions-jquery | src/includes/suggestions.js | function (suggestion, selectionOptions) {
var that = this,
formatSelected = that.options.formatSelected || that.type.formatSelected,
hasSameValues = selectionOptions && selectionOptions.hasSameValues,
hasBeenEnriched = selectionOptions && selectionOptions.hasBeenEnriched,
... | javascript | function (suggestion, selectionOptions) {
var that = this,
formatSelected = that.options.formatSelected || that.type.formatSelected,
hasSameValues = selectionOptions && selectionOptions.hasSameValues,
hasBeenEnriched = selectionOptions && selectionOptions.hasBeenEnriched,
... | [
"function",
"(",
"suggestion",
",",
"selectionOptions",
")",
"{",
"var",
"that",
"=",
"this",
",",
"formatSelected",
"=",
"that",
".",
"options",
".",
"formatSelected",
"||",
"that",
".",
"type",
".",
"formatSelected",
",",
"hasSameValues",
"=",
"selectionOpti... | Gets string to set as input value
@param suggestion
@param {Object} [selectionOptions]
@param {boolean} selectionOptions.hasBeenEnriched
@param {boolean} selectionOptions.hasSameValues
@return {string} | [
"Gets",
"string",
"to",
"set",
"as",
"input",
"value"
] | 17e3ac383790069ad4d3dd92185d9fb9e30382a7 | https://github.com/hflabs/suggestions-jquery/blob/17e3ac383790069ad4d3dd92185d9fb9e30382a7/src/includes/suggestions.js#L738-L768 | |
17,005 | hflabs/suggestions-jquery | src/includes/suggestions.js | function (suggestions) {
var that = this,
shouldRestrict = that.shouldRestrictValues(),
label = that.getFirstConstraintLabel();
$.each(suggestions, function (i, suggestion) {
if (!suggestion.unrestricted_value) {
suggestion.unrestricted_value = should... | javascript | function (suggestions) {
var that = this,
shouldRestrict = that.shouldRestrictValues(),
label = that.getFirstConstraintLabel();
$.each(suggestions, function (i, suggestion) {
if (!suggestion.unrestricted_value) {
suggestion.unrestricted_value = should... | [
"function",
"(",
"suggestions",
")",
"{",
"var",
"that",
"=",
"this",
",",
"shouldRestrict",
"=",
"that",
".",
"shouldRestrictValues",
"(",
")",
",",
"label",
"=",
"that",
".",
"getFirstConstraintLabel",
"(",
")",
";",
"$",
".",
"each",
"(",
"suggestions",... | Fills suggestion.unrestricted_value property | [
"Fills",
"suggestion",
".",
"unrestricted_value",
"property"
] | 17e3ac383790069ad4d3dd92185d9fb9e30382a7 | https://github.com/hflabs/suggestions-jquery/blob/17e3ac383790069ad4d3dd92185d9fb9e30382a7/src/includes/suggestions.js#L801-L811 | |
17,006 | hflabs/suggestions-jquery | src/includes/matchers.js | sameParentChecker | function sameParentChecker (preprocessFn) {
return function (suggestions) {
if (suggestions.length === 0) {
return false;
}
if (suggestions.length === 1) {
return true;
}
var parentValue = preprocessFn(suggestions[0].value),
aliens = sugge... | javascript | function sameParentChecker (preprocessFn) {
return function (suggestions) {
if (suggestions.length === 0) {
return false;
}
if (suggestions.length === 1) {
return true;
}
var parentValue = preprocessFn(suggestions[0].value),
aliens = sugge... | [
"function",
"sameParentChecker",
"(",
"preprocessFn",
")",
"{",
"return",
"function",
"(",
"suggestions",
")",
"{",
"if",
"(",
"suggestions",
".",
"length",
"===",
"0",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"suggestions",
".",
"length",
"===",
... | Factory to create same parent checker function
@param preprocessFn called on each value before comparison
@returns {Function} same parent checker function | [
"Factory",
"to",
"create",
"same",
"parent",
"checker",
"function"
] | 17e3ac383790069ad4d3dd92185d9fb9e30382a7 | https://github.com/hflabs/suggestions-jquery/blob/17e3ac383790069ad4d3dd92185d9fb9e30382a7/src/includes/matchers.js#L10-L26 |
17,007 | hflabs/suggestions-jquery | src/includes/constraints.js | belongsToArea | function belongsToArea(suggestion, instance){
var parentSuggestion = instance.selection,
result = parentSuggestion && parentSuggestion.data && instance.bounds;
if (result) {
collection_util.each(instance.bounds.all, function (bound, i) {
return (result = parentSuggestion.data[bound]... | javascript | function belongsToArea(suggestion, instance){
var parentSuggestion = instance.selection,
result = parentSuggestion && parentSuggestion.data && instance.bounds;
if (result) {
collection_util.each(instance.bounds.all, function (bound, i) {
return (result = parentSuggestion.data[bound]... | [
"function",
"belongsToArea",
"(",
"suggestion",
",",
"instance",
")",
"{",
"var",
"parentSuggestion",
"=",
"instance",
".",
"selection",
",",
"result",
"=",
"parentSuggestion",
"&&",
"parentSuggestion",
".",
"data",
"&&",
"instance",
".",
"bounds",
";",
"if",
... | Compares two suggestion objects
@param suggestion
@param instance other Suggestions instance | [
"Compares",
"two",
"suggestion",
"objects"
] | 17e3ac383790069ad4d3dd92185d9fb9e30382a7 | https://github.com/hflabs/suggestions-jquery/blob/17e3ac383790069ad4d3dd92185d9fb9e30382a7/src/includes/constraints.js#L34-L44 |
17,008 | hflabs/suggestions-jquery | src/includes/constraints.js | function (data) {
var that = this,
restrictedKeys = [],
unrestrictedData = {},
maxSpecificity = -1;
// Find most specific location that could restrict current data
collection_util.each(that.constraints, function (constraint, id) {
collection_util.... | javascript | function (data) {
var that = this,
restrictedKeys = [],
unrestrictedData = {},
maxSpecificity = -1;
// Find most specific location that could restrict current data
collection_util.each(that.constraints, function (constraint, id) {
collection_util.... | [
"function",
"(",
"data",
")",
"{",
"var",
"that",
"=",
"this",
",",
"restrictedKeys",
"=",
"[",
"]",
",",
"unrestrictedData",
"=",
"{",
"}",
",",
"maxSpecificity",
"=",
"-",
"1",
";",
"// Find most specific location that could restrict current data",
"collection_u... | Pick only fields that absent in restriction | [
"Pick",
"only",
"fields",
"that",
"absent",
"in",
"restriction"
] | 17e3ac383790069ad4d3dd92185d9fb9e30382a7 | https://github.com/hflabs/suggestions-jquery/blob/17e3ac383790069ad4d3dd92185d9fb9e30382a7/src/includes/constraints.js#L467-L505 | |
17,009 | marcoslin/angularAMD | dist/angularAMD.js | setAlternateAngular | function setAlternateAngular() {
// This method cannot be called more than once
if (alt_angular) {
throw new Error('setAlternateAngular can only be called once.');
} else {
alt_angular = {};
}
// Make sure that bootstrap has been called
checkBoots... | javascript | function setAlternateAngular() {
// This method cannot be called more than once
if (alt_angular) {
throw new Error('setAlternateAngular can only be called once.');
} else {
alt_angular = {};
}
// Make sure that bootstrap has been called
checkBoots... | [
"function",
"setAlternateAngular",
"(",
")",
"{",
"// This method cannot be called more than once",
"if",
"(",
"alt_angular",
")",
"{",
"throw",
"new",
"Error",
"(",
"'setAlternateAngular can only be called once.'",
")",
";",
"}",
"else",
"{",
"alt_angular",
"=",
"{",
... | Create an alternate angular so that subsequent call to angular.module will queue up
the module created for later processing via the .processQueue method.
This delaying processing is needed as angular does not recognize any newly created
module after angular.bootstrap has ran. The only way to add new objects to angula... | [
"Create",
"an",
"alternate",
"angular",
"so",
"that",
"subsequent",
"call",
"to",
"angular",
".",
"module",
"will",
"queue",
"up",
"the",
"module",
"created",
"for",
"later",
"processing",
"via",
"the",
".",
"processQueue",
"method",
"."
] | f379eb66a9e4d2ab5e49b2455ee48e624ccde047 | https://github.com/marcoslin/angularAMD/blob/f379eb66a9e4d2ab5e49b2455ee48e624ccde047/dist/angularAMD.js#L56-L104 |
17,010 | MathieuLoutre/mock-aws-s3 | lib/mock.js | applyBasePath | function applyBasePath(search) {
if (_.isUndefined(config.basePath)) {
return search;
}
var modifyKeys = ['Bucket', 'CopySource'];
var ret = _.mapObject(search, function (value, key) {
if (_.indexOf(modifyKeys, key) === -1) {
return value;
}
else {
return config.basePath + '/' + value;
}
})
re... | javascript | function applyBasePath(search) {
if (_.isUndefined(config.basePath)) {
return search;
}
var modifyKeys = ['Bucket', 'CopySource'];
var ret = _.mapObject(search, function (value, key) {
if (_.indexOf(modifyKeys, key) === -1) {
return value;
}
else {
return config.basePath + '/' + value;
}
})
re... | [
"function",
"applyBasePath",
"(",
"search",
")",
"{",
"if",
"(",
"_",
".",
"isUndefined",
"(",
"config",
".",
"basePath",
")",
")",
"{",
"return",
"search",
";",
"}",
"var",
"modifyKeys",
"=",
"[",
"'Bucket'",
",",
"'CopySource'",
"]",
";",
"var",
"ret... | Add basePath to selected keys | [
"Add",
"basePath",
"to",
"selected",
"keys"
] | ee822c5659c9e1bb6b359ef5def5abb781ff5de2 | https://github.com/MathieuLoutre/mock-aws-s3/blob/ee822c5659c9e1bb6b359ef5def5abb781ff5de2/lib/mock.js#L43-L61 |
17,011 | MathieuLoutre/mock-aws-s3 | lib/mock.js | S3Mock | function S3Mock(options) {
if (!_.isUndefined(options) && !_.isUndefined(options.params)) {
this.defaultOptions = _.extend({}, applyBasePath(options.params));
}
this.config = {
update: function() {}
};
} | javascript | function S3Mock(options) {
if (!_.isUndefined(options) && !_.isUndefined(options.params)) {
this.defaultOptions = _.extend({}, applyBasePath(options.params));
}
this.config = {
update: function() {}
};
} | [
"function",
"S3Mock",
"(",
"options",
")",
"{",
"if",
"(",
"!",
"_",
".",
"isUndefined",
"(",
"options",
")",
"&&",
"!",
"_",
".",
"isUndefined",
"(",
"options",
".",
"params",
")",
")",
"{",
"this",
".",
"defaultOptions",
"=",
"_",
".",
"extend",
... | Mocks key pieces of the amazon s3 sdk | [
"Mocks",
"key",
"pieces",
"of",
"the",
"amazon",
"s3",
"sdk"
] | ee822c5659c9e1bb6b359ef5def5abb781ff5de2 | https://github.com/MathieuLoutre/mock-aws-s3/blob/ee822c5659c9e1bb6b359ef5def5abb781ff5de2/lib/mock.js#L104-L112 |
17,012 | MathieuLoutre/mock-aws-s3 | lib/mock.js | function(params, callback) {
var err = null;
if (typeof(params) === "object" && params !== null)
{
if(typeof(params.Bucket) !== "string" || params.Bucket.length <= 0)
{
err = new Error("Mock-AWS-S3: Argument 'params' must contain a 'Bucket' (String) prope... | javascript | function(params, callback) {
var err = null;
if (typeof(params) === "object" && params !== null)
{
if(typeof(params.Bucket) !== "string" || params.Bucket.length <= 0)
{
err = new Error("Mock-AWS-S3: Argument 'params' must contain a 'Bucket' (String) prope... | [
"function",
"(",
"params",
",",
"callback",
")",
"{",
"var",
"err",
"=",
"null",
";",
"if",
"(",
"typeof",
"(",
"params",
")",
"===",
"\"object\"",
"&&",
"params",
"!==",
"null",
")",
"{",
"if",
"(",
"typeof",
"(",
"params",
".",
"Bucket",
")",
"!=... | Deletes a bucket. Behaviour as createBucket
@param params {Bucket: bucketName}. Name of bucket to delete
@param callback
@returns void | [
"Deletes",
"a",
"bucket",
".",
"Behaviour",
"as",
"createBucket"
] | ee822c5659c9e1bb6b359ef5def5abb781ff5de2 | https://github.com/MathieuLoutre/mock-aws-s3/blob/ee822c5659c9e1bb6b359ef5def5abb781ff5de2/lib/mock.js#L390-L416 | |
17,013 | publiclab/webjack | examples/crc8/crc8.js | CRC8 | function CRC8(polynomial) { // constructor takes an optional polynomial type from CRC8.POLY
if (polynomial == null) polynomial = CRC8.POLY.CRC8_CCITT
//if (polynomial == null) polynomial = CRC8.POLY.CRC8_DALLAS_MAXIM
this.table = CRC8.generateTable(polynomial);
} | javascript | function CRC8(polynomial) { // constructor takes an optional polynomial type from CRC8.POLY
if (polynomial == null) polynomial = CRC8.POLY.CRC8_CCITT
//if (polynomial == null) polynomial = CRC8.POLY.CRC8_DALLAS_MAXIM
this.table = CRC8.generateTable(polynomial);
} | [
"function",
"CRC8",
"(",
"polynomial",
")",
"{",
"// constructor takes an optional polynomial type from CRC8.POLY",
"if",
"(",
"polynomial",
"==",
"null",
")",
"polynomial",
"=",
"CRC8",
".",
"POLY",
".",
"CRC8_CCITT",
"//if (polynomial == null) polynomial = CRC8.POLY.CRC8_DA... | "Class" for calculating CRC8 checksums... | [
"Class",
"for",
"calculating",
"CRC8",
"checksums",
"..."
] | 0976e0da7ff6bbb536637e8d12398ca1d20ce7ca | https://github.com/publiclab/webjack/blob/0976e0da7ff6bbb536637e8d12398ca1d20ce7ca/examples/crc8/crc8.js#L3-L8 |
17,014 | alecsgone/jsx-render | src/dom.js | createElements | function createElements(tagName, attrs, children) {
const element = isSVG(tagName)
? document.createElementNS('http://www.w3.org/2000/svg', tagName)
: document.createElement(tagName)
// one or multiple will be evaluated to append as string or HTMLElement
const fragment = createFragmentFrom(children)
el... | javascript | function createElements(tagName, attrs, children) {
const element = isSVG(tagName)
? document.createElementNS('http://www.w3.org/2000/svg', tagName)
: document.createElement(tagName)
// one or multiple will be evaluated to append as string or HTMLElement
const fragment = createFragmentFrom(children)
el... | [
"function",
"createElements",
"(",
"tagName",
",",
"attrs",
",",
"children",
")",
"{",
"const",
"element",
"=",
"isSVG",
"(",
"tagName",
")",
"?",
"document",
".",
"createElementNS",
"(",
"'http://www.w3.org/2000/svg'",
",",
"tagName",
")",
":",
"document",
".... | The tag name and create an html together with the attributes
@param {String} tagName name as string, e.g. 'div', 'span', 'svg'
@param {Object} attrs html attributes e.g. data-, width, src
@param {Array} children html nodes from inside de elements
@return {HTMLElement} html node with attrs | [
"The",
"tag",
"name",
"and",
"create",
"an",
"html",
"together",
"with",
"the",
"attributes"
] | e7b261c7e4b4e516eaca40cc2c3d219a123af989 | https://github.com/alecsgone/jsx-render/blob/e7b261c7e4b4e516eaca40cc2c3d219a123af989/src/dom.js#L11-L40 |
17,015 | alecsgone/jsx-render | src/dom.js | composeToFunction | function composeToFunction(JSXTag, elementProps, children) {
const props = Object.assign({}, JSXTag.defaultProps || {}, elementProps, { children })
const bridge = JSXTag.prototype.render ? new JSXTag(props).render : JSXTag
const result = bridge(props)
switch (result) {
case 'FRAGMENT':
return createF... | javascript | function composeToFunction(JSXTag, elementProps, children) {
const props = Object.assign({}, JSXTag.defaultProps || {}, elementProps, { children })
const bridge = JSXTag.prototype.render ? new JSXTag(props).render : JSXTag
const result = bridge(props)
switch (result) {
case 'FRAGMENT':
return createF... | [
"function",
"composeToFunction",
"(",
"JSXTag",
",",
"elementProps",
",",
"children",
")",
"{",
"const",
"props",
"=",
"Object",
".",
"assign",
"(",
"{",
"}",
",",
"JSXTag",
".",
"defaultProps",
"||",
"{",
"}",
",",
"elementProps",
",",
"{",
"children",
... | The JSXTag will be unwrapped returning the html
@param {Function} JSXTag name as string, e.g. 'div', 'span', 'svg'
@param {Object} elementProps custom jsx attributes e.g. fn, strings
@param {Array} children html nodes from inside de elements
@return {Function} returns de 'dom' (fn) executed, leaving the HTMLElemen... | [
"The",
"JSXTag",
"will",
"be",
"unwrapped",
"returning",
"the",
"html"
] | e7b261c7e4b4e516eaca40cc2c3d219a123af989 | https://github.com/alecsgone/jsx-render/blob/e7b261c7e4b4e516eaca40cc2c3d219a123af989/src/dom.js#L55-L73 |
17,016 | coatyio/coaty-js | scripts/release.js | versionRelease | function versionRelease(version) {
return new Promise((resolve, reject) => {
const [pkgPath, pkg] = getPackageObject();
const bumpVersion = (version, isReleaseType, throwOnEqual) => {
const newVersion = isReleaseType ? semver.inc(pkg.version, version) : semver.valid(version);
... | javascript | function versionRelease(version) {
return new Promise((resolve, reject) => {
const [pkgPath, pkg] = getPackageObject();
const bumpVersion = (version, isReleaseType, throwOnEqual) => {
const newVersion = isReleaseType ? semver.inc(pkg.version, version) : semver.valid(version);
... | [
"function",
"versionRelease",
"(",
"version",
")",
"{",
"return",
"new",
"Promise",
"(",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"const",
"[",
"pkgPath",
",",
"pkg",
"]",
"=",
"getPackageObject",
"(",
")",
";",
"const",
"bumpVersion",
"=",
"(",
... | Automatically bumps the package version according to the
specified version parameter.
The given version parameter can have the following values:
"recommended", "first", major", "minor", "patch", or a valid
semantic version string.
If the version is `recommended`, a recommended version bump is computed based
on conven... | [
"Automatically",
"bumps",
"the",
"package",
"version",
"according",
"to",
"the",
"specified",
"version",
"parameter",
"."
] | 0c4f6d725d7e02b36857dfabc083bc65fd92c585 | https://github.com/coatyio/coaty-js/blob/0c4f6d725d7e02b36857dfabc083bc65fd92c585/scripts/release.js#L43-L98 |
17,017 | coatyio/coaty-js | scripts/release.js | cutRelease | function cutRelease(releaseNote) {
const [pkgPath, pkg] = getPackageObject();
const msg = getCommitTagMessage(pkg.version);
return updateChangelogInternal(pkg.version, releaseNote)
// Stage and commit all new, modified, and deleted files in the entire working directory
.then(() => runCommand... | javascript | function cutRelease(releaseNote) {
const [pkgPath, pkg] = getPackageObject();
const msg = getCommitTagMessage(pkg.version);
return updateChangelogInternal(pkg.version, releaseNote)
// Stage and commit all new, modified, and deleted files in the entire working directory
.then(() => runCommand... | [
"function",
"cutRelease",
"(",
"releaseNote",
")",
"{",
"const",
"[",
"pkgPath",
",",
"pkg",
"]",
"=",
"getPackageObject",
"(",
")",
";",
"const",
"msg",
"=",
"getCommitTagMessage",
"(",
"pkg",
".",
"version",
")",
";",
"return",
"updateChangelogInternal",
"... | Updates the CHANGELOG with release information from the conventional commits,
commits all pending changes and creates an annotated git tag for the release.
If supplied with releaseNote, this text is prepended to the release information generated
by conventional commits. | [
"Updates",
"the",
"CHANGELOG",
"with",
"release",
"information",
"from",
"the",
"conventional",
"commits",
"commits",
"all",
"pending",
"changes",
"and",
"creates",
"an",
"annotated",
"git",
"tag",
"for",
"the",
"release",
"."
] | 0c4f6d725d7e02b36857dfabc083bc65fd92c585 | https://github.com/coatyio/coaty-js/blob/0c4f6d725d7e02b36857dfabc083bc65fd92c585/scripts/release.js#L109-L122 |
17,018 | coatyio/coaty-js | scripts/release.js | publishRelease | function publishRelease(npmDistTag) {
const tag = npmDistTag || "latest";
const distPath = path.resolve(process.cwd(), "dist");
const distFolders = [];
const asyncInSeries = (items, asyncFunc) => {
return new Promise((resolve, reject) => {
const series = index => {
i... | javascript | function publishRelease(npmDistTag) {
const tag = npmDistTag || "latest";
const distPath = path.resolve(process.cwd(), "dist");
const distFolders = [];
const asyncInSeries = (items, asyncFunc) => {
return new Promise((resolve, reject) => {
const series = index => {
i... | [
"function",
"publishRelease",
"(",
"npmDistTag",
")",
"{",
"const",
"tag",
"=",
"npmDistTag",
"||",
"\"latest\"",
";",
"const",
"distPath",
"=",
"path",
".",
"resolve",
"(",
"process",
".",
"cwd",
"(",
")",
",",
"\"dist\"",
")",
";",
"const",
"distFolders"... | Publishes all the distribution packages of the new release on an
npm registry. Authentication is required to publish packages. The
registry location is determined by the `publishConfig` section in the
package.json, if present. If not present, the public npm registry is used.
Registers the published packages with the g... | [
"Publishes",
"all",
"the",
"distribution",
"packages",
"of",
"the",
"new",
"release",
"on",
"an",
"npm",
"registry",
".",
"Authentication",
"is",
"required",
"to",
"publish",
"packages",
".",
"The",
"registry",
"location",
"is",
"determined",
"by",
"the",
"pub... | 0c4f6d725d7e02b36857dfabc083bc65fd92c585 | https://github.com/coatyio/coaty-js/blob/0c4f6d725d7e02b36857dfabc083bc65fd92c585/scripts/release.js#L147-L189 |
17,019 | coatyio/coaty-js | scripts/release.js | runCommand | function runCommand(command) {
return new Promise((resolve, reject) => {
utils.logInfo(`Command: ${command}`);
childProcess.exec(command, (error, stdout, stderr) => {
// If exec returns content in stderr, but no error, print it as a warning.
// If exec returns an error, rejec... | javascript | function runCommand(command) {
return new Promise((resolve, reject) => {
utils.logInfo(`Command: ${command}`);
childProcess.exec(command, (error, stdout, stderr) => {
// If exec returns content in stderr, but no error, print it as a warning.
// If exec returns an error, rejec... | [
"function",
"runCommand",
"(",
"command",
")",
"{",
"return",
"new",
"Promise",
"(",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"utils",
".",
"logInfo",
"(",
"`",
"${",
"command",
"}",
"`",
")",
";",
"childProcess",
".",
"exec",
"(",
"command",
"... | Runs the given command in a child process.
Returns a promise that is resolved with the generated
stdout of the command (as UTF-8 string) when the child process
terminates normally or rejected if the child process
terminates with a non-zero exit code. | [
"Runs",
"the",
"given",
"command",
"in",
"a",
"child",
"process",
"."
] | 0c4f6d725d7e02b36857dfabc083bc65fd92c585 | https://github.com/coatyio/coaty-js/blob/0c4f6d725d7e02b36857dfabc083bc65fd92c585/scripts/release.js#L240-L255 |
17,020 | coatyio/coaty-js | build/builder.js | clean | function clean() {
const distDir = "./dist";
try {
fse.readdirSync(distDir).forEach(file => {
let filePath = path.resolve(distDir, file);
if (fse.lstatSync(filePath).isDirectory()) {
logInfo("Clean distribution package " + file);
try {
... | javascript | function clean() {
const distDir = "./dist";
try {
fse.readdirSync(distDir).forEach(file => {
let filePath = path.resolve(distDir, file);
if (fse.lstatSync(filePath).isDirectory()) {
logInfo("Clean distribution package " + file);
try {
... | [
"function",
"clean",
"(",
")",
"{",
"const",
"distDir",
"=",
"\"./dist\"",
";",
"try",
"{",
"fse",
".",
"readdirSync",
"(",
"distDir",
")",
".",
"forEach",
"(",
"file",
"=>",
"{",
"let",
"filePath",
"=",
"path",
".",
"resolve",
"(",
"distDir",
",",
"... | Clean all distribution packages. | [
"Clean",
"all",
"distribution",
"packages",
"."
] | 0c4f6d725d7e02b36857dfabc083bc65fd92c585 | https://github.com/coatyio/coaty-js/blob/0c4f6d725d7e02b36857dfabc083bc65fd92c585/build/builder.js#L84-L100 |
17,021 | coatyio/coaty-js | build/builder.js | build | function build(pkgName, pkgVersion) {
clean();
// Update framework name/version/build date in Runtime class
updateRuntimeInfo(Date.now(), pkgName, pkgVersion);
const buildDir = "./build";
fse.readdirSync(buildDir).forEach(file => {
if (file.match(/tsconfig\..+\.json/gi)) {
con... | javascript | function build(pkgName, pkgVersion) {
clean();
// Update framework name/version/build date in Runtime class
updateRuntimeInfo(Date.now(), pkgName, pkgVersion);
const buildDir = "./build";
fse.readdirSync(buildDir).forEach(file => {
if (file.match(/tsconfig\..+\.json/gi)) {
con... | [
"function",
"build",
"(",
"pkgName",
",",
"pkgVersion",
")",
"{",
"clean",
"(",
")",
";",
"// Update framework name/version/build date in Runtime class",
"updateRuntimeInfo",
"(",
"Date",
".",
"now",
"(",
")",
",",
"pkgName",
",",
"pkgVersion",
")",
";",
"const",
... | Build distribution packages with modules and test specs for all defined
ECMAScript versions and module formats. | [
"Build",
"distribution",
"packages",
"with",
"modules",
"and",
"test",
"specs",
"for",
"all",
"defined",
"ECMAScript",
"versions",
"and",
"module",
"formats",
"."
] | 0c4f6d725d7e02b36857dfabc083bc65fd92c585 | https://github.com/coatyio/coaty-js/blob/0c4f6d725d7e02b36857dfabc083bc65fd92c585/build/builder.js#L106-L168 |
17,022 | coatyio/coaty-js | scripts/info.js | info | function info(agentInfoFolder, defaultBuildMode) {
return new Promise((resolve, reject) => {
const result = generateAgentInfoFile(agentInfoFolder || "./src/", undefined, undefined, defaultBuildMode);
resolve(result[1]);
});
} | javascript | function info(agentInfoFolder, defaultBuildMode) {
return new Promise((resolve, reject) => {
const result = generateAgentInfoFile(agentInfoFolder || "./src/", undefined, undefined, defaultBuildMode);
resolve(result[1]);
});
} | [
"function",
"info",
"(",
"agentInfoFolder",
",",
"defaultBuildMode",
")",
"{",
"return",
"new",
"Promise",
"(",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"const",
"result",
"=",
"generateAgentInfoFile",
"(",
"agentInfoFolder",
"||",
"\"./src/\"",
",",
"un... | Coaty script command for generating agent info file.
Returns a promise that resolves to the generated `AgentInfo` object. | [
"Coaty",
"script",
"command",
"for",
"generating",
"agent",
"info",
"file",
".",
"Returns",
"a",
"promise",
"that",
"resolves",
"to",
"the",
"generated",
"AgentInfo",
"object",
"."
] | 0c4f6d725d7e02b36857dfabc083bc65fd92c585 | https://github.com/coatyio/coaty-js/blob/0c4f6d725d7e02b36857dfabc083bc65fd92c585/scripts/info.js#L9-L14 |
17,023 | coatyio/coaty-js | scripts/info.js | gulpBuildAgentInfo | function gulpBuildAgentInfo(agentInfoFolder, agentInfoFilename, packageFile) {
if (agentInfoFilename === undefined) {
agentInfoFilename = "agent.info.ts";
}
if (packageFile === undefined) {
packageFile = "package.json";
}
return () => {
const gulp = require("gulp");
c... | javascript | function gulpBuildAgentInfo(agentInfoFolder, agentInfoFilename, packageFile) {
if (agentInfoFilename === undefined) {
agentInfoFilename = "agent.info.ts";
}
if (packageFile === undefined) {
packageFile = "package.json";
}
return () => {
const gulp = require("gulp");
c... | [
"function",
"gulpBuildAgentInfo",
"(",
"agentInfoFolder",
",",
"agentInfoFilename",
",",
"packageFile",
")",
"{",
"if",
"(",
"agentInfoFilename",
"===",
"undefined",
")",
"{",
"agentInfoFilename",
"=",
"\"agent.info.ts\"",
";",
"}",
"if",
"(",
"packageFile",
"===",
... | Returns a gulp task function for generating a TypeScript file including agent
info in the specified folder.
Agent project package information is acquired from the specified package.json
file and the build mode is determined by environment variable setting
`COATY_ENV`. Set `COATY_ENV` to "development", "production", "t... | [
"Returns",
"a",
"gulp",
"task",
"function",
"for",
"generating",
"a",
"TypeScript",
"file",
"including",
"agent",
"info",
"in",
"the",
"specified",
"folder",
"."
] | 0c4f6d725d7e02b36857dfabc083bc65fd92c585 | https://github.com/coatyio/coaty-js/blob/0c4f6d725d7e02b36857dfabc083bc65fd92c585/scripts/info.js#L37-L49 |
17,024 | coatyio/coaty-js | scripts/info.js | generateAgentInfoFile | function generateAgentInfoFile(agentInfoFolder, agentInfoFilename, packageFile, defaultBuildMode) {
if (agentInfoFilename === undefined) {
agentInfoFilename = "agent.info.ts";
}
if (packageFile === undefined) {
packageFile = "package.json";
}
const fs = require("fs");
const path ... | javascript | function generateAgentInfoFile(agentInfoFolder, agentInfoFilename, packageFile, defaultBuildMode) {
if (agentInfoFilename === undefined) {
agentInfoFilename = "agent.info.ts";
}
if (packageFile === undefined) {
packageFile = "package.json";
}
const fs = require("fs");
const path ... | [
"function",
"generateAgentInfoFile",
"(",
"agentInfoFolder",
",",
"agentInfoFilename",
",",
"packageFile",
",",
"defaultBuildMode",
")",
"{",
"if",
"(",
"agentInfoFilename",
"===",
"undefined",
")",
"{",
"agentInfoFilename",
"=",
"\"agent.info.ts\"",
";",
"}",
"if",
... | Generates a TypeScript file including agent info in the specified folder and
returns its absolute file path and the build mode as a tuple array.
Agent project package information is acquired from the specified package.json
file and the build mode is determined by environment variable setting
`COATY_ENV`. Set `COATY_EN... | [
"Generates",
"a",
"TypeScript",
"file",
"including",
"agent",
"info",
"in",
"the",
"specified",
"folder",
"and",
"returns",
"its",
"absolute",
"file",
"path",
"and",
"the",
"build",
"mode",
"as",
"a",
"tuple",
"array",
"."
] | 0c4f6d725d7e02b36857dfabc083bc65fd92c585 | https://github.com/coatyio/coaty-js/blob/0c4f6d725d7e02b36857dfabc083bc65fd92c585/scripts/info.js#L75-L93 |
17,025 | coatyio/coaty-js | scripts/info.js | generateAgentInfo | function generateAgentInfo(packageFile, defaultBuildMode) {
if (defaultBuildMode === undefined) {
defaultBuildMode = "development";
}
const path = require("path");
const pkg = require(path.resolve(packageFile));
const buildMode = process.env.COATY_ENV || defaultBuildMode;
const buildDate... | javascript | function generateAgentInfo(packageFile, defaultBuildMode) {
if (defaultBuildMode === undefined) {
defaultBuildMode = "development";
}
const path = require("path");
const pkg = require(path.resolve(packageFile));
const buildMode = process.env.COATY_ENV || defaultBuildMode;
const buildDate... | [
"function",
"generateAgentInfo",
"(",
"packageFile",
",",
"defaultBuildMode",
")",
"{",
"if",
"(",
"defaultBuildMode",
"===",
"undefined",
")",
"{",
"defaultBuildMode",
"=",
"\"development\"",
";",
"}",
"const",
"path",
"=",
"require",
"(",
"\"path\"",
")",
";",... | Generates code for a TypeScript file which exports agent information as a
`AgentInfo` object on a variable named `agentInfo`. The information is
acquired from the specified package.json file and build mode from environment
variable setting `COATY_ENV`, unless overriden by the given
`defaultBuildMode` parameter. The ser... | [
"Generates",
"code",
"for",
"a",
"TypeScript",
"file",
"which",
"exports",
"agent",
"information",
"as",
"a",
"AgentInfo",
"object",
"on",
"a",
"variable",
"named",
"agentInfo",
".",
"The",
"information",
"is",
"acquired",
"from",
"the",
"specified",
"package",
... | 0c4f6d725d7e02b36857dfabc083bc65fd92c585 | https://github.com/coatyio/coaty-js/blob/0c4f6d725d7e02b36857dfabc083bc65fd92c585/scripts/info.js#L109-L121 |
17,026 | coatyio/coaty-js | scripts/utils.js | toLocalIsoString | function toLocalIsoString(date, includeMillis) {
if (includeMillis === undefined) {
includeMillis = false;
}
const pad = (n, length, padChar) => {
if (length === undefined) { length = 2; }
if (padChar === undefined) { padChar = "0"; }
let str = "" + n;
while (str.leng... | javascript | function toLocalIsoString(date, includeMillis) {
if (includeMillis === undefined) {
includeMillis = false;
}
const pad = (n, length, padChar) => {
if (length === undefined) { length = 2; }
if (padChar === undefined) { padChar = "0"; }
let str = "" + n;
while (str.leng... | [
"function",
"toLocalIsoString",
"(",
"date",
",",
"includeMillis",
")",
"{",
"if",
"(",
"includeMillis",
"===",
"undefined",
")",
"{",
"includeMillis",
"=",
"false",
";",
"}",
"const",
"pad",
"=",
"(",
"n",
",",
"length",
",",
"padChar",
")",
"=>",
"{",
... | Returns a string in ISO 8601 format including timezone offset information.
@param date a Date object
@param includeMillis whether to include milliseconds in the string (defaults to false) | [
"Returns",
"a",
"string",
"in",
"ISO",
"8601",
"format",
"including",
"timezone",
"offset",
"information",
"."
] | 0c4f6d725d7e02b36857dfabc083bc65fd92c585 | https://github.com/coatyio/coaty-js/blob/0c4f6d725d7e02b36857dfabc083bc65fd92c585/scripts/utils.js#L30-L60 |
17,027 | mapbox/execcommand-copy | index.js | copy | function copy(text) {
var fakeElem = document.body.appendChild(document.createElement('textarea'));
fakeElem.style.position = 'absolute';
fakeElem.style.left = '-9999px';
fakeElem.setAttribute('readonly', '');
fakeElem.value = text;
fakeElem.select();
try {
return document.execCommand('copy');
} cat... | javascript | function copy(text) {
var fakeElem = document.body.appendChild(document.createElement('textarea'));
fakeElem.style.position = 'absolute';
fakeElem.style.left = '-9999px';
fakeElem.setAttribute('readonly', '');
fakeElem.value = text;
fakeElem.select();
try {
return document.execCommand('copy');
} cat... | [
"function",
"copy",
"(",
"text",
")",
"{",
"var",
"fakeElem",
"=",
"document",
".",
"body",
".",
"appendChild",
"(",
"document",
".",
"createElement",
"(",
"'textarea'",
")",
")",
";",
"fakeElem",
".",
"style",
".",
"position",
"=",
"'absolute'",
";",
"f... | Copy a snippet of text to a user's pasteboard if the user has
proper browser support.
@param {string} text text snippet
@returns {boolean} whether the text was copied
@example
// using browser events with a click
var eCopy = require('execcommand-copy');
var a = document.getElementById('mybutton');
a.addEventListener('... | [
"Copy",
"a",
"snippet",
"of",
"text",
"to",
"a",
"user",
"s",
"pasteboard",
"if",
"the",
"user",
"has",
"proper",
"browser",
"support",
"."
] | 5b306826fe6b831a2354dd19383273eb8b132a04 | https://github.com/mapbox/execcommand-copy/blob/5b306826fe6b831a2354dd19383273eb8b132a04/index.js#L24-L38 |
17,028 | pubkey/broadcast-channel | dist/es/methods/node.js | cleanPipeName | function cleanPipeName(str) {
if (process.platform === 'win32' && !str.startsWith('\\\\.\\pipe\\')) {
str = str.replace(/^\//, '');
str = str.replace(/\//g, '-');
return '\\\\.\\pipe\\' + str;
} else {
return str;
}
} | javascript | function cleanPipeName(str) {
if (process.platform === 'win32' && !str.startsWith('\\\\.\\pipe\\')) {
str = str.replace(/^\//, '');
str = str.replace(/\//g, '-');
return '\\\\.\\pipe\\' + str;
} else {
return str;
}
} | [
"function",
"cleanPipeName",
"(",
"str",
")",
"{",
"if",
"(",
"process",
".",
"platform",
"===",
"'win32'",
"&&",
"!",
"str",
".",
"startsWith",
"(",
"'\\\\\\\\.\\\\pipe\\\\'",
")",
")",
"{",
"str",
"=",
"str",
".",
"replace",
"(",
"/",
"^\\/",
"/",
",... | windows sucks, so we have handle windows-type of socket-paths
@link https://gist.github.com/domenic/2790533#gistcomment-331356 | [
"windows",
"sucks",
"so",
"we",
"have",
"handle",
"windows",
"-",
"type",
"of",
"socket",
"-",
"paths"
] | b1a1c4538d33be91ce950a800140289fbdf9f792 | https://github.com/pubkey/broadcast-channel/blob/b1a1c4538d33be91ce950a800140289fbdf9f792/dist/es/methods/node.js#L44-L52 |
17,029 | pubkey/broadcast-channel | dist/es/methods/node.js | emitOverFastPath | function emitOverFastPath(state, msgObj, messageJson) {
if (!state.options.node.useFastPath) return; // disabled
var others = OTHER_INSTANCES[state.channelName].filter(function (s) {
return s !== state;
});
var checkObj = {
time: msgObj.time,
senderUuid: msgObj.uuid,
token: msgObj.token
};
... | javascript | function emitOverFastPath(state, msgObj, messageJson) {
if (!state.options.node.useFastPath) return; // disabled
var others = OTHER_INSTANCES[state.channelName].filter(function (s) {
return s !== state;
});
var checkObj = {
time: msgObj.time,
senderUuid: msgObj.uuid,
token: msgObj.token
};
... | [
"function",
"emitOverFastPath",
"(",
"state",
",",
"msgObj",
",",
"messageJson",
")",
"{",
"if",
"(",
"!",
"state",
".",
"options",
".",
"node",
".",
"useFastPath",
")",
"return",
";",
"// disabled",
"var",
"others",
"=",
"OTHER_INSTANCES",
"[",
"state",
"... | When multiple BroadcastChannels with the same name
are created in a single node-process, we can access them directly and emit messages.
This might not happen often in production
but will speed up things when this module is used in unit-tests. | [
"When",
"multiple",
"BroadcastChannels",
"with",
"the",
"same",
"name",
"are",
"created",
"in",
"a",
"single",
"node",
"-",
"process",
"we",
"can",
"access",
"them",
"directly",
"and",
"emit",
"messages",
".",
"This",
"might",
"not",
"happen",
"often",
"in",... | b1a1c4538d33be91ce950a800140289fbdf9f792 | https://github.com/pubkey/broadcast-channel/blob/b1a1c4538d33be91ce950a800140289fbdf9f792/dist/es/methods/node.js#L1050-L1066 |
17,030 | pubkey/broadcast-channel | dist/es/leader-election/index.js | whenDeathListener | function whenDeathListener(msg) {
if (msg.context === 'leader' && msg.action === 'death') {
leaderElector.applyOnce().then(function () {
if (leaderElector.isLeader) finish();
});
}
} | javascript | function whenDeathListener(msg) {
if (msg.context === 'leader' && msg.action === 'death') {
leaderElector.applyOnce().then(function () {
if (leaderElector.isLeader) finish();
});
}
} | [
"function",
"whenDeathListener",
"(",
"msg",
")",
"{",
"if",
"(",
"msg",
".",
"context",
"===",
"'leader'",
"&&",
"msg",
".",
"action",
"===",
"'death'",
")",
"{",
"leaderElector",
".",
"applyOnce",
"(",
")",
".",
"then",
"(",
"function",
"(",
")",
"{"... | try when other leader dies | [
"try",
"when",
"other",
"leader",
"dies"
] | b1a1c4538d33be91ce950a800140289fbdf9f792 | https://github.com/pubkey/broadcast-channel/blob/b1a1c4538d33be91ce950a800140289fbdf9f792/dist/es/leader-election/index.js#L150-L156 |
17,031 | pubkey/broadcast-channel | dist/lib/methods/indexed-db.js | writeMessage | function writeMessage(db, readerUuid, messageJson) {
var time = new Date().getTime();
var writeObject = {
uuid: readerUuid,
time: time,
data: messageJson
};
var transaction = db.transaction([OBJECT_STORE_ID], 'readwrite');
return new Promise(function (res, rej) {
transaction.oncomplete = funct... | javascript | function writeMessage(db, readerUuid, messageJson) {
var time = new Date().getTime();
var writeObject = {
uuid: readerUuid,
time: time,
data: messageJson
};
var transaction = db.transaction([OBJECT_STORE_ID], 'readwrite');
return new Promise(function (res, rej) {
transaction.oncomplete = funct... | [
"function",
"writeMessage",
"(",
"db",
",",
"readerUuid",
",",
"messageJson",
")",
"{",
"var",
"time",
"=",
"new",
"Date",
"(",
")",
".",
"getTime",
"(",
")",
";",
"var",
"writeObject",
"=",
"{",
"uuid",
":",
"readerUuid",
",",
"time",
":",
"time",
"... | writes the new message to the database
so other readers can find it | [
"writes",
"the",
"new",
"message",
"to",
"the",
"database",
"so",
"other",
"readers",
"can",
"find",
"it"
] | b1a1c4538d33be91ce950a800140289fbdf9f792 | https://github.com/pubkey/broadcast-channel/blob/b1a1c4538d33be91ce950a800140289fbdf9f792/dist/lib/methods/indexed-db.js#L83-L103 |
17,032 | pubkey/broadcast-channel | dist/lib/methods/indexed-db.js | readNewMessages | function readNewMessages(state) {
// channel already closed
if (state.closed) return Promise.resolve(); // if no one is listening, we do not need to scan for new messages
if (!state.messagesCallback) return Promise.resolve();
return getMessagesHigherThen(state.db, state.lastCursorId).then(function (newerMessag... | javascript | function readNewMessages(state) {
// channel already closed
if (state.closed) return Promise.resolve(); // if no one is listening, we do not need to scan for new messages
if (!state.messagesCallback) return Promise.resolve();
return getMessagesHigherThen(state.db, state.lastCursorId).then(function (newerMessag... | [
"function",
"readNewMessages",
"(",
"state",
")",
"{",
"// channel already closed",
"if",
"(",
"state",
".",
"closed",
")",
"return",
"Promise",
".",
"resolve",
"(",
")",
";",
"// if no one is listening, we do not need to scan for new messages",
"if",
"(",
"!",
"state... | reads all new messages from the database and emits them | [
"reads",
"all",
"new",
"messages",
"from",
"the",
"database",
"and",
"emits",
"them"
] | b1a1c4538d33be91ce950a800140289fbdf9f792 | https://github.com/pubkey/broadcast-channel/blob/b1a1c4538d33be91ce950a800140289fbdf9f792/dist/lib/methods/indexed-db.js#L243-L269 |
17,033 | pubkey/broadcast-channel | dist/lib/index.js | listenerFn | function listenerFn(msgObj) {
channel._addEL[msgObj.type].forEach(function (obj) {
if (msgObj.time >= obj.time) {
obj.fn(msgObj.data);
}
});
} | javascript | function listenerFn(msgObj) {
channel._addEL[msgObj.type].forEach(function (obj) {
if (msgObj.time >= obj.time) {
obj.fn(msgObj.data);
}
});
} | [
"function",
"listenerFn",
"(",
"msgObj",
")",
"{",
"channel",
".",
"_addEL",
"[",
"msgObj",
".",
"type",
"]",
".",
"forEach",
"(",
"function",
"(",
"obj",
")",
"{",
"if",
"(",
"msgObj",
".",
"time",
">=",
"obj",
".",
"time",
")",
"{",
"obj",
".",
... | someone is listening, start subscribing | [
"someone",
"is",
"listening",
"start",
"subscribing"
] | b1a1c4538d33be91ce950a800140289fbdf9f792 | https://github.com/pubkey/broadcast-channel/blob/b1a1c4538d33be91ce950a800140289fbdf9f792/dist/lib/index.js#L201-L207 |
17,034 | pubkey/broadcast-channel | src/leader-election/index.js | _sendMessage | function _sendMessage(leaderElector, action) {
const msgJson = {
context: 'leader',
action,
token: leaderElector.token
};
return leaderElector._channel.postInternal(msgJson);
} | javascript | function _sendMessage(leaderElector, action) {
const msgJson = {
context: 'leader',
action,
token: leaderElector.token
};
return leaderElector._channel.postInternal(msgJson);
} | [
"function",
"_sendMessage",
"(",
"leaderElector",
",",
"action",
")",
"{",
"const",
"msgJson",
"=",
"{",
"context",
":",
"'leader'",
",",
"action",
",",
"token",
":",
"leaderElector",
".",
"token",
"}",
";",
"return",
"leaderElector",
".",
"_channel",
".",
... | sends and internal message over the broadcast-channel | [
"sends",
"and",
"internal",
"message",
"over",
"the",
"broadcast",
"-",
"channel"
] | b1a1c4538d33be91ce950a800140289fbdf9f792 | https://github.com/pubkey/broadcast-channel/blob/b1a1c4538d33be91ce950a800140289fbdf9f792/src/leader-election/index.js#L153-L160 |
17,035 | pubkey/broadcast-channel | src/methods/node.js | createSocketInfoFile | function createSocketInfoFile(channelName, readerUuid, paths) {
const pathToFile = socketInfoPath(channelName, readerUuid, paths);
return writeFile(
pathToFile,
JSON.stringify({
time: microSeconds()
})
).then(() => pathToFile);
} | javascript | function createSocketInfoFile(channelName, readerUuid, paths) {
const pathToFile = socketInfoPath(channelName, readerUuid, paths);
return writeFile(
pathToFile,
JSON.stringify({
time: microSeconds()
})
).then(() => pathToFile);
} | [
"function",
"createSocketInfoFile",
"(",
"channelName",
",",
"readerUuid",
",",
"paths",
")",
"{",
"const",
"pathToFile",
"=",
"socketInfoPath",
"(",
"channelName",
",",
"readerUuid",
",",
"paths",
")",
";",
"return",
"writeFile",
"(",
"pathToFile",
",",
"JSON",... | Because it is not possible to get all socket-files in a folder,
when used under fucking windows,
we have to set a normal file so other readers know our socket exists | [
"Because",
"it",
"is",
"not",
"possible",
"to",
"get",
"all",
"socket",
"-",
"files",
"in",
"a",
"folder",
"when",
"used",
"under",
"fucking",
"windows",
"we",
"have",
"to",
"set",
"a",
"normal",
"file",
"so",
"other",
"readers",
"know",
"our",
"socket",... | b1a1c4538d33be91ce950a800140289fbdf9f792 | https://github.com/pubkey/broadcast-channel/blob/b1a1c4538d33be91ce950a800140289fbdf9f792/src/methods/node.js#L159-L167 |
17,036 | pubkey/broadcast-channel | src/methods/node.js | countChannelFolders | async function countChannelFolders() {
await ensureBaseFolderExists();
const folders = await readdir(TMP_FOLDER_BASE);
return folders.length;
} | javascript | async function countChannelFolders() {
await ensureBaseFolderExists();
const folders = await readdir(TMP_FOLDER_BASE);
return folders.length;
} | [
"async",
"function",
"countChannelFolders",
"(",
")",
"{",
"await",
"ensureBaseFolderExists",
"(",
")",
";",
"const",
"folders",
"=",
"await",
"readdir",
"(",
"TMP_FOLDER_BASE",
")",
";",
"return",
"folders",
".",
"length",
";",
"}"
] | returns the amount of channel-folders in the tmp-directory
@return {Promise<number>} | [
"returns",
"the",
"amount",
"of",
"channel",
"-",
"folders",
"in",
"the",
"tmp",
"-",
"directory"
] | b1a1c4538d33be91ce950a800140289fbdf9f792 | https://github.com/pubkey/broadcast-channel/blob/b1a1c4538d33be91ce950a800140289fbdf9f792/src/methods/node.js#L173-L177 |
17,037 | pubkey/broadcast-channel | src/methods/node.js | getReadersUuids | async function getReadersUuids(channelName, paths) {
paths = paths || getPaths(channelName);
const readersPath = paths.readers;
const files = await readdir(readersPath);
return files
.map(file => file.split('.'))
.filter(split => split[1] === 'json') // do not scan .socket-files
... | javascript | async function getReadersUuids(channelName, paths) {
paths = paths || getPaths(channelName);
const readersPath = paths.readers;
const files = await readdir(readersPath);
return files
.map(file => file.split('.'))
.filter(split => split[1] === 'json') // do not scan .socket-files
... | [
"async",
"function",
"getReadersUuids",
"(",
"channelName",
",",
"paths",
")",
"{",
"paths",
"=",
"paths",
"||",
"getPaths",
"(",
"channelName",
")",
";",
"const",
"readersPath",
"=",
"paths",
".",
"readers",
";",
"const",
"files",
"=",
"await",
"readdir",
... | returns the uuids of all readers
@return {string[]} | [
"returns",
"the",
"uuids",
"of",
"all",
"readers"
] | b1a1c4538d33be91ce950a800140289fbdf9f792 | https://github.com/pubkey/broadcast-channel/blob/b1a1c4538d33be91ce950a800140289fbdf9f792/src/methods/node.js#L287-L296 |
17,038 | pubkey/broadcast-channel | src/methods/node.js | create | async function create(channelName, options = {}) {
options = fillOptionsWithDefaults(options);
const time = microSeconds();
const paths = getPaths(channelName);
const ensureFolderExistsPromise = ensureFoldersExist(channelName, paths);
const uuid = randomToken(10);
const state = {
time,
... | javascript | async function create(channelName, options = {}) {
options = fillOptionsWithDefaults(options);
const time = microSeconds();
const paths = getPaths(channelName);
const ensureFolderExistsPromise = ensureFoldersExist(channelName, paths);
const uuid = randomToken(10);
const state = {
time,
... | [
"async",
"function",
"create",
"(",
"channelName",
",",
"options",
"=",
"{",
"}",
")",
"{",
"options",
"=",
"fillOptionsWithDefaults",
"(",
"options",
")",
";",
"const",
"time",
"=",
"microSeconds",
"(",
")",
";",
"const",
"paths",
"=",
"getPaths",
"(",
... | creates a new channelState
@return {Promise<any>} | [
"creates",
"a",
"new",
"channelState"
] | b1a1c4538d33be91ce950a800140289fbdf9f792 | https://github.com/pubkey/broadcast-channel/blob/b1a1c4538d33be91ce950a800140289fbdf9f792/src/methods/node.js#L365-L424 |
17,039 | pubkey/broadcast-channel | src/methods/node.js | handleMessagePing | async function handleMessagePing(state, msgObj) {
/**
* when there are no listener, we do nothing
*/
if (!state.messagesCallback) return;
let messages;
if (!msgObj) {
// get all
messages = await getAllMessages(state.channelName, state.paths);
} else {
// get singl... | javascript | async function handleMessagePing(state, msgObj) {
/**
* when there are no listener, we do nothing
*/
if (!state.messagesCallback) return;
let messages;
if (!msgObj) {
// get all
messages = await getAllMessages(state.channelName, state.paths);
} else {
// get singl... | [
"async",
"function",
"handleMessagePing",
"(",
"state",
",",
"msgObj",
")",
"{",
"/**\n * when there are no listener, we do nothing\n */",
"if",
"(",
"!",
"state",
".",
"messagesCallback",
")",
"return",
";",
"let",
"messages",
";",
"if",
"(",
"!",
"msgObj",... | when the socket pings, so that we now new messages came,
run this | [
"when",
"the",
"socket",
"pings",
"so",
"that",
"we",
"now",
"new",
"messages",
"came",
"run",
"this"
] | b1a1c4538d33be91ce950a800140289fbdf9f792 | https://github.com/pubkey/broadcast-channel/blob/b1a1c4538d33be91ce950a800140289fbdf9f792/src/methods/node.js#L441-L483 |
17,040 | angular-ui/ui-ace | src/ui-ace.js | function () {
/**
* The callback function grabbed from the array-like arguments
* object. The first argument should always be the callback.
*
* @see [arguments]{@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions_and_function_scope/arg... | javascript | function () {
/**
* The callback function grabbed from the array-like arguments
* object. The first argument should always be the callback.
*
* @see [arguments]{@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions_and_function_scope/arg... | [
"function",
"(",
")",
"{",
"/**\n * The callback function grabbed from the array-like arguments\n * object. The first argument should always be the callback.\n *\n * @see [arguments]{@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions_and... | Calls a callback by checking its existing. The argument list
is variable and thus this function is relying on the arguments
object.
@throws {Error} If the callback isn't a function | [
"Calls",
"a",
"callback",
"by",
"checking",
"its",
"existing",
".",
"The",
"argument",
"list",
"is",
"variable",
"and",
"thus",
"this",
"function",
"is",
"relying",
"on",
"the",
"arguments",
"object",
"."
] | 4c62a97e0adc60b7cde2be4caf902ac95c5c8c34 | https://github.com/angular-ui/ui-ace/blob/4c62a97e0adc60b7cde2be4caf902ac95c5c8c34/src/ui-ace.js#L177-L207 | |
17,041 | angular-ui/ui-ace | src/ui-ace.js | function (callback) {
return function (e) {
var newValue = session.getValue();
if (ngModel && newValue !== ngModel.$viewValue &&
// HACK make sure to only trigger the apply outside of the
// digest loop 'cause ACE is actually using this callba... | javascript | function (callback) {
return function (e) {
var newValue = session.getValue();
if (ngModel && newValue !== ngModel.$viewValue &&
// HACK make sure to only trigger the apply outside of the
// digest loop 'cause ACE is actually using this callba... | [
"function",
"(",
"callback",
")",
"{",
"return",
"function",
"(",
"e",
")",
"{",
"var",
"newValue",
"=",
"session",
".",
"getValue",
"(",
")",
";",
"if",
"(",
"ngModel",
"&&",
"newValue",
"!==",
"ngModel",
".",
"$viewValue",
"&&",
"// HACK make sure to onl... | Creates a change listener which propagates the change event
and the editor session to the callback from the user option
onChange. It might be exchanged during runtime, if this
happens the old listener will be unbound.
@param callback callback function defined in the user options
@see onChangeListener | [
"Creates",
"a",
"change",
"listener",
"which",
"propagates",
"the",
"change",
"event",
"and",
"the",
"editor",
"session",
"to",
"the",
"callback",
"from",
"the",
"user",
"option",
"onChange",
".",
"It",
"might",
"be",
"exchanged",
"during",
"runtime",
"if",
... | 4c62a97e0adc60b7cde2be4caf902ac95c5c8c34 | https://github.com/angular-ui/ui-ace/blob/4c62a97e0adc60b7cde2be4caf902ac95c5c8c34/src/ui-ace.js#L223-L239 | |
17,042 | angular-ui/ui-ace | src/ui-ace.js | function (current, previous) {
if (current === previous) return;
opts = angular.extend({}, options, scope.$eval(attrs.uiAce));
opts.callbacks = [ opts.onLoad ];
if (opts.onLoad !== options.onLoad) {
// also call the global onLoad handler
opts.callbacks.un... | javascript | function (current, previous) {
if (current === previous) return;
opts = angular.extend({}, options, scope.$eval(attrs.uiAce));
opts.callbacks = [ opts.onLoad ];
if (opts.onLoad !== options.onLoad) {
// also call the global onLoad handler
opts.callbacks.un... | [
"function",
"(",
"current",
",",
"previous",
")",
"{",
"if",
"(",
"current",
"===",
"previous",
")",
"return",
";",
"opts",
"=",
"angular",
".",
"extend",
"(",
"{",
"}",
",",
"options",
",",
"scope",
".",
"$eval",
"(",
"attrs",
".",
"uiAce",
")",
"... | Listen for option updates | [
"Listen",
"for",
"option",
"updates"
] | 4c62a97e0adc60b7cde2be4caf902ac95c5c8c34 | https://github.com/angular-ui/ui-ace/blob/4c62a97e0adc60b7cde2be4caf902ac95c5c8c34/src/ui-ace.js#L278-L306 | |
17,043 | Esri/angular-esri-map | site/app/examples/chaining-promises.js | addGraphics | function addGraphics(buffer) {
layer.add(new Graphic({
geometry: meteorPoint,
symbol: pointSym
}));
layer.add(new Graphic({
geometry: buffer,
symbol: polySym
}));
... | javascript | function addGraphics(buffer) {
layer.add(new Graphic({
geometry: meteorPoint,
symbol: pointSym
}));
layer.add(new Graphic({
geometry: buffer,
symbol: polySym
}));
... | [
"function",
"addGraphics",
"(",
"buffer",
")",
"{",
"layer",
".",
"add",
"(",
"new",
"Graphic",
"(",
"{",
"geometry",
":",
"meteorPoint",
",",
"symbol",
":",
"pointSym",
"}",
")",
")",
";",
"layer",
".",
"add",
"(",
"new",
"Graphic",
"(",
"{",
"geome... | adds the point and buffer graphics to the layer | [
"adds",
"the",
"point",
"and",
"buffer",
"graphics",
"to",
"the",
"layer"
] | 4623710f54adcd847c79df08180d6b1ec6d25f88 | https://github.com/Esri/angular-esri-map/blob/4623710f54adcd847c79df08180d6b1ec6d25f88/site/app/examples/chaining-promises.js#L84-L95 |
17,044 | Esri/angular-esri-map | site/app/examples/chaining-promises.js | zoomTo | function zoomTo(geom) {
// when the view is ready
return self.view.when(function() {
// zoom to the buffer geometry
return self.view.goTo({
target: geom,
scale: 24000,
tilt: 0,... | javascript | function zoomTo(geom) {
// when the view is ready
return self.view.when(function() {
// zoom to the buffer geometry
return self.view.goTo({
target: geom,
scale: 24000,
tilt: 0,... | [
"function",
"zoomTo",
"(",
"geom",
")",
"{",
"// when the view is ready",
"return",
"self",
".",
"view",
".",
"when",
"(",
"function",
"(",
")",
"{",
"// zoom to the buffer geometry",
"return",
"self",
".",
"view",
".",
"goTo",
"(",
"{",
"target",
":",
"geom... | zooms to the buffer location | [
"zooms",
"to",
"the",
"buffer",
"location"
] | 4623710f54adcd847c79df08180d6b1ec6d25f88 | https://github.com/Esri/angular-esri-map/blob/4623710f54adcd847c79df08180d6b1ec6d25f88/site/app/examples/chaining-promises.js#L98-L112 |
17,045 | Esri/angular-esri-map | site/app/common/pathService.js | function(path) {
var pathParts = this.getPathParts(path),
tabs,
page;
if (pathParts.length === 0) {
return;
}
page = pathParts[0];
if (!page) {
return;
... | javascript | function(path) {
var pathParts = this.getPathParts(path),
tabs,
page;
if (pathParts.length === 0) {
return;
}
page = pathParts[0];
if (!page) {
return;
... | [
"function",
"(",
"path",
")",
"{",
"var",
"pathParts",
"=",
"this",
".",
"getPathParts",
"(",
"path",
")",
",",
"tabs",
",",
"page",
";",
"if",
"(",
"pathParts",
".",
"length",
"===",
"0",
")",
"{",
"return",
";",
"}",
"page",
"=",
"pathParts",
"["... | parse snippet include file locations from route | [
"parse",
"snippet",
"include",
"file",
"locations",
"from",
"route"
] | 4623710f54adcd847c79df08180d6b1ec6d25f88 | https://github.com/Esri/angular-esri-map/blob/4623710f54adcd847c79df08180d6b1ec6d25f88/site/app/common/pathService.js#L14-L31 | |
17,046 | witoldsz/angular-http-auth | dist/http-auth-interceptor.js | function(data, configUpdater) {
var updater = configUpdater || function(config) {return config;};
$rootScope.$broadcast('event:auth-loginConfirmed', data);
httpBuffer.retryAll(updater);
} | javascript | function(data, configUpdater) {
var updater = configUpdater || function(config) {return config;};
$rootScope.$broadcast('event:auth-loginConfirmed', data);
httpBuffer.retryAll(updater);
} | [
"function",
"(",
"data",
",",
"configUpdater",
")",
"{",
"var",
"updater",
"=",
"configUpdater",
"||",
"function",
"(",
"config",
")",
"{",
"return",
"config",
";",
"}",
";",
"$rootScope",
".",
"$broadcast",
"(",
"'event:auth-loginConfirmed'",
",",
"data",
"... | Call this function to indicate that authentication was successful and trigger a
retry of all deferred requests.
@param data an optional argument to pass on to $broadcast which may be useful for
example if you need to pass through details of the user that was logged in
@param configUpdater an optional transformation fun... | [
"Call",
"this",
"function",
"to",
"indicate",
"that",
"authentication",
"was",
"successful",
"and",
"trigger",
"a",
"retry",
"of",
"all",
"deferred",
"requests",
"."
] | 8563641456cd84be1c8ed778c6346d01fb51daa8 | https://github.com/witoldsz/angular-http-auth/blob/8563641456cd84be1c8ed778c6346d01fb51daa8/dist/http-auth-interceptor.js#L25-L29 | |
17,047 | witoldsz/angular-http-auth | dist/http-auth-interceptor.js | function(updater) {
for (var i = 0; i < buffer.length; ++i) {
var _cfg = updater(buffer[i].config);
if (_cfg !== false)
retryHttpRequest(_cfg, buffer[i].deferred);
}
buffer = [];
} | javascript | function(updater) {
for (var i = 0; i < buffer.length; ++i) {
var _cfg = updater(buffer[i].config);
if (_cfg !== false)
retryHttpRequest(_cfg, buffer[i].deferred);
}
buffer = [];
} | [
"function",
"(",
"updater",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"buffer",
".",
"length",
";",
"++",
"i",
")",
"{",
"var",
"_cfg",
"=",
"updater",
"(",
"buffer",
"[",
"i",
"]",
".",
"config",
")",
";",
"if",
"(",
"_cfg",... | Retries all the buffered requests clears the buffer. | [
"Retries",
"all",
"the",
"buffered",
"requests",
"clears",
"the",
"buffer",
"."
] | 8563641456cd84be1c8ed778c6346d01fb51daa8 | https://github.com/witoldsz/angular-http-auth/blob/8563641456cd84be1c8ed778c6346d01fb51daa8/dist/http-auth-interceptor.js#L126-L133 | |
17,048 | tkrotoff/jquery-simplecolorpicker | jquery.simplecolorpicker.js | function(color) {
var self = this;
var $colorSpan = self.$colorList.find('> span.color').filter(function() {
return $(this).data('color').toLowerCase() === color.toLowerCase();
});
if ($colorSpan.length > 0) {
self.selectColorSpan($colorSpan);
} else {
console.err... | javascript | function(color) {
var self = this;
var $colorSpan = self.$colorList.find('> span.color').filter(function() {
return $(this).data('color').toLowerCase() === color.toLowerCase();
});
if ($colorSpan.length > 0) {
self.selectColorSpan($colorSpan);
} else {
console.err... | [
"function",
"(",
"color",
")",
"{",
"var",
"self",
"=",
"this",
";",
"var",
"$colorSpan",
"=",
"self",
".",
"$colorList",
".",
"find",
"(",
"'> span.color'",
")",
".",
"filter",
"(",
"function",
"(",
")",
"{",
"return",
"$",
"(",
"this",
")",
".",
... | Changes the selected color.
@param color the hexadecimal color to select, ex: '#fbd75b' | [
"Changes",
"the",
"selected",
"color",
"."
] | 5ab2a268766825c46247e37e7c8875de6f85aa6e | https://github.com/tkrotoff/jquery-simplecolorpicker/blob/5ab2a268766825c46247e37e7c8875de6f85aa6e/jquery.simplecolorpicker.js#L112-L124 | |
17,049 | olofd/react-native-photos-framework | local-cli/runIOS/findMatchingSimulator.js | findMatchingSimulator | function findMatchingSimulator(simulators, simulatorName) {
if (!simulators.devices) {
return null;
}
const devices = simulators.devices;
var match;
for (let version in devices) {
// Making sure the version of the simulator is an iOS (Removes Apple Watch, etc)
if (version.indexOf('iOS') !== 0) {
... | javascript | function findMatchingSimulator(simulators, simulatorName) {
if (!simulators.devices) {
return null;
}
const devices = simulators.devices;
var match;
for (let version in devices) {
// Making sure the version of the simulator is an iOS (Removes Apple Watch, etc)
if (version.indexOf('iOS') !== 0) {
... | [
"function",
"findMatchingSimulator",
"(",
"simulators",
",",
"simulatorName",
")",
"{",
"if",
"(",
"!",
"simulators",
".",
"devices",
")",
"{",
"return",
"null",
";",
"}",
"const",
"devices",
"=",
"simulators",
".",
"devices",
";",
"var",
"match",
";",
"fo... | Takes in a parsed simulator list and a desired name, and returns an object with the matching simulator.
If the simulatorName argument is null, we'll go into default mode and return the currently booted simulator, or if
none is booted, it will be the first in the list.
@param Object simulators a parsed list from `xcru... | [
"Takes",
"in",
"a",
"parsed",
"simulator",
"list",
"and",
"a",
"desired",
"name",
"and",
"returns",
"an",
"object",
"with",
"the",
"matching",
"simulator",
"."
] | adaa91d8bd13e93cb18c5884d9fde27228a44ebb | https://github.com/olofd/react-native-photos-framework/blob/adaa91d8bd13e93cb18c5884d9fde27228a44ebb/local-cli/runIOS/findMatchingSimulator.js#L22-L71 |
17,050 | olofd/react-native-photos-framework | local-cli/bundle/signedsource.js | sign | function sign(file_data) {
var first_time = file_data.indexOf(TOKEN) !== -1;
if (!first_time) {
if (is_signed(file_data))
file_data = file_data.replace(PATTERN, signing_token());
else
throw exports.TokenNotFoundError;
}
var signature = md5_hash_hex(file_data, 'utf8');
var signed_data = fil... | javascript | function sign(file_data) {
var first_time = file_data.indexOf(TOKEN) !== -1;
if (!first_time) {
if (is_signed(file_data))
file_data = file_data.replace(PATTERN, signing_token());
else
throw exports.TokenNotFoundError;
}
var signature = md5_hash_hex(file_data, 'utf8');
var signed_data = fil... | [
"function",
"sign",
"(",
"file_data",
")",
"{",
"var",
"first_time",
"=",
"file_data",
".",
"indexOf",
"(",
"TOKEN",
")",
"!==",
"-",
"1",
";",
"if",
"(",
"!",
"first_time",
")",
"{",
"if",
"(",
"is_signed",
"(",
"file_data",
")",
")",
"file_data",
"... | Sign a source file which you have previously embedded a signing token into. Signing modifies only the signing token, so the semantics of the file will not change if you've put it in a comment. @param str File contents as a string (with embedded token). @return str Signed data. | [
"Sign",
"a",
"source",
"file",
"which",
"you",
"have",
"previously",
"embedded",
"a",
"signing",
"token",
"into",
".",
"Signing",
"modifies",
"only",
"the",
"signing",
"token",
"so",
"the",
"semantics",
"of",
"the",
"file",
"will",
"not",
"change",
"if",
"... | adaa91d8bd13e93cb18c5884d9fde27228a44ebb | https://github.com/olofd/react-native-photos-framework/blob/adaa91d8bd13e93cb18c5884d9fde27228a44ebb/local-cli/bundle/signedsource.js#L59-L70 |
17,051 | olofd/react-native-photos-framework | local-cli/bundle/signedsource.js | verify_signature | function verify_signature(file_data) {
var match = PATTERN.exec(file_data);
if (!match)
return exports.SIGN_UNSIGNED;
// Replace the signature with the TOKEN, then hash and see if it matches
// the value in the file. For backwards compatibility, also try with
// OLDTOKEN if that doesn't match.
var k, t... | javascript | function verify_signature(file_data) {
var match = PATTERN.exec(file_data);
if (!match)
return exports.SIGN_UNSIGNED;
// Replace the signature with the TOKEN, then hash and see if it matches
// the value in the file. For backwards compatibility, also try with
// OLDTOKEN if that doesn't match.
var k, t... | [
"function",
"verify_signature",
"(",
"file_data",
")",
"{",
"var",
"match",
"=",
"PATTERN",
".",
"exec",
"(",
"file_data",
")",
";",
"if",
"(",
"!",
"match",
")",
"return",
"exports",
".",
"SIGN_UNSIGNED",
";",
"// Replace the signature with the TOKEN, then hash a... | Verify a file's signature. @param str File contents as a string. @return Returns SIGN_OK if the data contains a valid signature, SIGN_UNSIGNED if it contains no signature, or SIGN_INVALID if it contains an invalid signature. | [
"Verify",
"a",
"file",
"s",
"signature",
"."
] | adaa91d8bd13e93cb18c5884d9fde27228a44ebb | https://github.com/olofd/react-native-photos-framework/blob/adaa91d8bd13e93cb18c5884d9fde27228a44ebb/local-cli/bundle/signedsource.js#L79-L95 |
17,052 | olofd/react-native-photos-framework | local-cli/server/util/copyToClipBoard.js | copyToClipBoard | function copyToClipBoard(content) {
switch (process.platform) {
case 'darwin':
var child = spawn('pbcopy', []);
child.stdin.end(new Buffer(content, 'utf8'));
return true;
default:
return false;
}
} | javascript | function copyToClipBoard(content) {
switch (process.platform) {
case 'darwin':
var child = spawn('pbcopy', []);
child.stdin.end(new Buffer(content, 'utf8'));
return true;
default:
return false;
}
} | [
"function",
"copyToClipBoard",
"(",
"content",
")",
"{",
"switch",
"(",
"process",
".",
"platform",
")",
"{",
"case",
"'darwin'",
":",
"var",
"child",
"=",
"spawn",
"(",
"'pbcopy'",
",",
"[",
"]",
")",
";",
"child",
".",
"stdin",
".",
"end",
"(",
"ne... | Copy the content to host system clipboard.
This is only supported on Mac for now. | [
"Copy",
"the",
"content",
"to",
"host",
"system",
"clipboard",
".",
"This",
"is",
"only",
"supported",
"on",
"Mac",
"for",
"now",
"."
] | adaa91d8bd13e93cb18c5884d9fde27228a44ebb | https://github.com/olofd/react-native-photos-framework/blob/adaa91d8bd13e93cb18c5884d9fde27228a44ebb/local-cli/server/util/copyToClipBoard.js#L18-L27 |
17,053 | olofd/react-native-photos-framework | local-cli/generate/generate.js | generate | function generate(argv, config) {
return new Promise((resolve, reject) => {
_generate(argv, config, resolve, reject);
});
} | javascript | function generate(argv, config) {
return new Promise((resolve, reject) => {
_generate(argv, config, resolve, reject);
});
} | [
"function",
"generate",
"(",
"argv",
",",
"config",
")",
"{",
"return",
"new",
"Promise",
"(",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"_generate",
"(",
"argv",
",",
"config",
",",
"resolve",
",",
"reject",
")",
";",
"}",
")",
";",
"}"
] | Generates the template for the given platform. | [
"Generates",
"the",
"template",
"for",
"the",
"given",
"platform",
"."
] | adaa91d8bd13e93cb18c5884d9fde27228a44ebb | https://github.com/olofd/react-native-photos-framework/blob/adaa91d8bd13e93cb18c5884d9fde27228a44ebb/local-cli/generate/generate.js#L19-L23 |
17,054 | olofd/react-native-photos-framework | local-cli/server/server.js | server | function server(argv, config, args) {
const roots = args.projectRoots.concat(args.root);
args.projectRoots = roots.concat(
findSymlinksPaths(NODE_MODULES, roots)
);
console.log(formatBanner(
'Running packager on port ' + args.port + '.\n\n' +
'Keep this packager running while developing on any JS p... | javascript | function server(argv, config, args) {
const roots = args.projectRoots.concat(args.root);
args.projectRoots = roots.concat(
findSymlinksPaths(NODE_MODULES, roots)
);
console.log(formatBanner(
'Running packager on port ' + args.port + '.\n\n' +
'Keep this packager running while developing on any JS p... | [
"function",
"server",
"(",
"argv",
",",
"config",
",",
"args",
")",
"{",
"const",
"roots",
"=",
"args",
".",
"projectRoots",
".",
"concat",
"(",
"args",
".",
"root",
")",
";",
"args",
".",
"projectRoots",
"=",
"roots",
".",
"concat",
"(",
"findSymlinks... | Starts the React Native Packager Server. | [
"Starts",
"the",
"React",
"Native",
"Packager",
"Server",
"."
] | adaa91d8bd13e93cb18c5884d9fde27228a44ebb | https://github.com/olofd/react-native-photos-framework/blob/adaa91d8bd13e93cb18c5884d9fde27228a44ebb/local-cli/server/server.js#L21-L71 |
17,055 | olofd/react-native-photos-framework | local-cli/util/Config.js | findParentDirectory | function findParentDirectory(currentFullPath, filename) {
const root = path.parse(currentFullPath).root;
const testDir = (parts) => {
if (parts.length === 0) {
return null;
}
const fullPath = path.join(root, parts.join(path.sep));
var exists = fs.existsSync(path.join(fullPath, filename));
... | javascript | function findParentDirectory(currentFullPath, filename) {
const root = path.parse(currentFullPath).root;
const testDir = (parts) => {
if (parts.length === 0) {
return null;
}
const fullPath = path.join(root, parts.join(path.sep));
var exists = fs.existsSync(path.join(fullPath, filename));
... | [
"function",
"findParentDirectory",
"(",
"currentFullPath",
",",
"filename",
")",
"{",
"const",
"root",
"=",
"path",
".",
"parse",
"(",
"currentFullPath",
")",
".",
"root",
";",
"const",
"testDir",
"=",
"(",
"parts",
")",
"=>",
"{",
"if",
"(",
"parts",
".... | Finds the most near ancestor starting at `currentFullPath` that has a file named `filename` | [
"Finds",
"the",
"most",
"near",
"ancestor",
"starting",
"at",
"currentFullPath",
"that",
"has",
"a",
"file",
"named",
"filename"
] | adaa91d8bd13e93cb18c5884d9fde27228a44ebb | https://github.com/olofd/react-native-photos-framework/blob/adaa91d8bd13e93cb18c5884d9fde27228a44ebb/local-cli/util/Config.js#L63-L77 |
17,056 | ember-redux/ember-redux | addon/core.js | changedKeys | function changedKeys(props, newProps) {
return Object.keys(props).filter(key => {
return props[key] !== newProps[key];
});
} | javascript | function changedKeys(props, newProps) {
return Object.keys(props).filter(key => {
return props[key] !== newProps[key];
});
} | [
"function",
"changedKeys",
"(",
"props",
",",
"newProps",
")",
"{",
"return",
"Object",
".",
"keys",
"(",
"props",
")",
".",
"filter",
"(",
"key",
"=>",
"{",
"return",
"props",
"[",
"key",
"]",
"!==",
"newProps",
"[",
"key",
"]",
";",
"}",
")",
";"... | Returns a list of keys that have different values between the two objects.
@method changedKeys
@return {Array} keys that have changed
@private | [
"Returns",
"a",
"list",
"of",
"keys",
"that",
"have",
"different",
"values",
"between",
"the",
"two",
"objects",
"."
] | 6f4f643e83ded175041cf36dc2f4aee4212da518 | https://github.com/ember-redux/ember-redux/blob/6f4f643e83ded175041cf36dc2f4aee4212da518/addon/core.js#L13-L17 |
17,057 | ember-redux/ember-redux | addon/core.js | computedReduxProperty | function computedReduxProperty(key, getProps) {
return computed({
get: () => getProps()[key],
set: () => { assert(`Cannot set redux property "${key}". Try dispatching a redux action instead.`); }
});
} | javascript | function computedReduxProperty(key, getProps) {
return computed({
get: () => getProps()[key],
set: () => { assert(`Cannot set redux property "${key}". Try dispatching a redux action instead.`); }
});
} | [
"function",
"computedReduxProperty",
"(",
"key",
",",
"getProps",
")",
"{",
"return",
"computed",
"(",
"{",
"get",
":",
"(",
")",
"=>",
"getProps",
"(",
")",
"[",
"key",
"]",
",",
"set",
":",
"(",
")",
"=>",
"{",
"assert",
"(",
"`",
"${",
"key",
... | Creates a read-only computed property for accessing redux state.
@method computedReduxProperty
@return {Function} an Ember computed property
@private | [
"Creates",
"a",
"read",
"-",
"only",
"computed",
"property",
"for",
"accessing",
"redux",
"state",
"."
] | 6f4f643e83ded175041cf36dc2f4aee4212da518 | https://github.com/ember-redux/ember-redux/blob/6f4f643e83ded175041cf36dc2f4aee4212da518/addon/core.js#L26-L31 |
17,058 | ember-redux/ember-redux | addon/core.js | getAttrs | function getAttrs(context) {
const keys = Object.keys(context.attrs || {});
return getProperties(context, keys);
} | javascript | function getAttrs(context) {
const keys = Object.keys(context.attrs || {});
return getProperties(context, keys);
} | [
"function",
"getAttrs",
"(",
"context",
")",
"{",
"const",
"keys",
"=",
"Object",
".",
"keys",
"(",
"context",
".",
"attrs",
"||",
"{",
"}",
")",
";",
"return",
"getProperties",
"(",
"context",
",",
"keys",
")",
";",
"}"
] | Return an object of attrs passed to this Component.
`Component.attrs` is an object that can look like this:
{
myAttr: {
value: 'myValue'
}
}
Ember provides that a `get` will return the value:
this.get('myAttr') === 'myValue'
@method getAttrs
@private | [
"Return",
"an",
"object",
"of",
"attrs",
"passed",
"to",
"this",
"Component",
"."
] | 6f4f643e83ded175041cf36dc2f4aee4212da518 | https://github.com/ember-redux/ember-redux/blob/6f4f643e83ded175041cf36dc2f4aee4212da518/addon/core.js#L51-L54 |
17,059 | dreyescat/bootstrap-rating | bootstrap-rating.js | function (index) {
var $rating = this.$rating;
// Get the index of the last whole symbol.
var i = Math.floor(index);
// Hide completely hidden symbols background.
$rating.find('.rating-symbol-background')
.css('visibility', 'visible')
.slice(0, i).css('visibility', 'hidden'... | javascript | function (index) {
var $rating = this.$rating;
// Get the index of the last whole symbol.
var i = Math.floor(index);
// Hide completely hidden symbols background.
$rating.find('.rating-symbol-background')
.css('visibility', 'visible')
.slice(0, i).css('visibility', 'hidden'... | [
"function",
"(",
"index",
")",
"{",
"var",
"$rating",
"=",
"this",
".",
"$rating",
";",
"// Get the index of the last whole symbol.",
"var",
"i",
"=",
"Math",
".",
"floor",
"(",
"index",
")",
";",
"// Hide completely hidden symbols background.",
"$rating",
".",
"f... | Fill rating symbols until index. | [
"Fill",
"rating",
"symbols",
"until",
"index",
"."
] | af10cba7c9e27ae891ae4e517b8e828f2eb23c10 | https://github.com/dreyescat/bootstrap-rating/blob/af10cba7c9e27ae891ae4e517b8e828f2eb23c10/bootstrap-rating.js#L152-L171 | |
17,060 | dreyescat/bootstrap-rating | bootstrap-rating.js | function (index) {
return this.options.start + Math.floor(index) * this.options.step +
this.options.step * this._roundToFraction(index % 1);
} | javascript | function (index) {
return this.options.start + Math.floor(index) * this.options.step +
this.options.step * this._roundToFraction(index % 1);
} | [
"function",
"(",
"index",
")",
"{",
"return",
"this",
".",
"options",
".",
"start",
"+",
"Math",
".",
"floor",
"(",
"index",
")",
"*",
"this",
".",
"options",
".",
"step",
"+",
"this",
".",
"options",
".",
"step",
"*",
"this",
".",
"_roundToFraction"... | Calculate the rate of an index according the the start and step. | [
"Calculate",
"the",
"rate",
"of",
"an",
"index",
"according",
"the",
"the",
"start",
"and",
"step",
"."
] | af10cba7c9e27ae891ae4e517b8e828f2eb23c10 | https://github.com/dreyescat/bootstrap-rating/blob/af10cba7c9e27ae891ae4e517b8e828f2eb23c10/bootstrap-rating.js#L173-L176 | |
17,061 | dreyescat/bootstrap-rating | bootstrap-rating.js | function (index) {
// Get the closest top fraction.
var fraction = Math.ceil(index % 1 * this.options.fractions) / this.options.fractions;
// Truncate decimal trying to avoid float precission issues.
var p = Math.pow(10, this.options.scale);
return Math.floor(index) + Math.floor(fraction *... | javascript | function (index) {
// Get the closest top fraction.
var fraction = Math.ceil(index % 1 * this.options.fractions) / this.options.fractions;
// Truncate decimal trying to avoid float precission issues.
var p = Math.pow(10, this.options.scale);
return Math.floor(index) + Math.floor(fraction *... | [
"function",
"(",
"index",
")",
"{",
"// Get the closest top fraction.",
"var",
"fraction",
"=",
"Math",
".",
"ceil",
"(",
"index",
"%",
"1",
"*",
"this",
".",
"options",
".",
"fractions",
")",
"/",
"this",
".",
"options",
".",
"fractions",
";",
"// Truncat... | Round index to the configured opts.fractions. | [
"Round",
"index",
"to",
"the",
"configured",
"opts",
".",
"fractions",
"."
] | af10cba7c9e27ae891ae4e517b8e828f2eb23c10 | https://github.com/dreyescat/bootstrap-rating/blob/af10cba7c9e27ae891ae4e517b8e828f2eb23c10/bootstrap-rating.js#L182-L188 | |
17,062 | dreyescat/bootstrap-rating | bootstrap-rating.js | function (rate) {
var value = parseFloat(rate);
if (this._contains(value)) {
this._fillUntil(this._rateToIndex(value));
this.$input.val(value);
} else if (rate === '') {
this._fillUntil(0);
this.$input.val('');
}
} | javascript | function (rate) {
var value = parseFloat(rate);
if (this._contains(value)) {
this._fillUntil(this._rateToIndex(value));
this.$input.val(value);
} else if (rate === '') {
this._fillUntil(0);
this.$input.val('');
}
} | [
"function",
"(",
"rate",
")",
"{",
"var",
"value",
"=",
"parseFloat",
"(",
"rate",
")",
";",
"if",
"(",
"this",
".",
"_contains",
"(",
"value",
")",
")",
"{",
"this",
".",
"_fillUntil",
"(",
"this",
".",
"_rateToIndex",
"(",
"value",
")",
")",
";",... | Update empty and filled rating symbols according to a rate. | [
"Update",
"empty",
"and",
"filled",
"rating",
"symbols",
"according",
"to",
"a",
"rate",
"."
] | af10cba7c9e27ae891ae4e517b8e828f2eb23c10 | https://github.com/dreyescat/bootstrap-rating/blob/af10cba7c9e27ae891ae4e517b8e828f2eb23c10/bootstrap-rating.js#L196-L205 | |
17,063 | wikimedia/restbase | sys/parsoid.js | isModifiedSince | function isModifiedSince(req, res) {
try {
if (req.headers['if-unmodified-since']) {
const jobTime = Date.parse(req.headers['if-unmodified-since']);
const revInfo = mwUtil.parseETag(res.headers.etag);
return revInfo && uuid.fromString(revInfo.tid).getDate() >= jobTime;
... | javascript | function isModifiedSince(req, res) {
try {
if (req.headers['if-unmodified-since']) {
const jobTime = Date.parse(req.headers['if-unmodified-since']);
const revInfo = mwUtil.parseETag(res.headers.etag);
return revInfo && uuid.fromString(revInfo.tid).getDate() >= jobTime;
... | [
"function",
"isModifiedSince",
"(",
"req",
",",
"res",
")",
"{",
"try",
"{",
"if",
"(",
"req",
".",
"headers",
"[",
"'if-unmodified-since'",
"]",
")",
"{",
"const",
"jobTime",
"=",
"Date",
".",
"parse",
"(",
"req",
".",
"headers",
"[",
"'if-unmodified-si... | Checks whether the content has been modified since the timestamp
in `if-unmodified-since` header of the request
@param {Object} req the request
@param {Object} res the response
@return {boolean} true if content has beed modified | [
"Checks",
"whether",
"the",
"content",
"has",
"been",
"modified",
"since",
"the",
"timestamp",
"in",
"if",
"-",
"unmodified",
"-",
"since",
"header",
"of",
"the",
"request"
] | 91b5176b7d5d38a7c4d3fa9c31f297f9737c3fcb | https://github.com/wikimedia/restbase/blob/91b5176b7d5d38a7c4d3fa9c31f297f9737c3fcb/sys/parsoid.js#L57-L68 |
17,064 | wikimedia/restbase | sys/parsoid.js | _dependenciesUpdate | function _dependenciesUpdate(hyper, req, newContent = true) {
const rp = req.params;
return mwUtil.getSiteInfo(hyper, req)
.then((siteInfo) => {
const baseUri = siteInfo.baseUri.replace(/^https?:/, '');
const publicURI = `${baseUri}/page/html/${encodeURIComponent(rp.title)}`;
const b... | javascript | function _dependenciesUpdate(hyper, req, newContent = true) {
const rp = req.params;
return mwUtil.getSiteInfo(hyper, req)
.then((siteInfo) => {
const baseUri = siteInfo.baseUri.replace(/^https?:/, '');
const publicURI = `${baseUri}/page/html/${encodeURIComponent(rp.title)}`;
const b... | [
"function",
"_dependenciesUpdate",
"(",
"hyper",
",",
"req",
",",
"newContent",
"=",
"true",
")",
"{",
"const",
"rp",
"=",
"req",
".",
"params",
";",
"return",
"mwUtil",
".",
"getSiteInfo",
"(",
"hyper",
",",
"req",
")",
".",
"then",
"(",
"(",
"siteInf... | HTML resource_change event emission
@param {HyperSwitch} hyper the hyperswitch router object
@param {Object} req the request
@param {boolean} [newContent] whether this is the newest revision
@return {Object} update response | [
"HTML",
"resource_change",
"event",
"emission"
] | 91b5176b7d5d38a7c4d3fa9c31f297f9737c3fcb | https://github.com/wikimedia/restbase/blob/91b5176b7d5d38a7c4d3fa9c31f297f9737c3fcb/sys/parsoid.js#L76-L93 |
17,065 | wikimedia/restbase | lib/ensure_content_type.js | checkContentType | function checkContentType(hyper, req, next, expectedContentType, responsePromise) {
return responsePromise
.then((res) => {
// Do not check or re-render if the response was only rendered within
// the last two minutes.
if (res.headers && res.headers.etag &&
Date.now() - mwUti... | javascript | function checkContentType(hyper, req, next, expectedContentType, responsePromise) {
return responsePromise
.then((res) => {
// Do not check or re-render if the response was only rendered within
// the last two minutes.
if (res.headers && res.headers.etag &&
Date.now() - mwUti... | [
"function",
"checkContentType",
"(",
"hyper",
",",
"req",
",",
"next",
",",
"expectedContentType",
",",
"responsePromise",
")",
"{",
"return",
"responsePromise",
".",
"then",
"(",
"(",
"res",
")",
"=>",
"{",
"// Do not check or re-render if the response was only rende... | Simple content type enforcement
- Assumes that the first `produces` array entry is the latest.
- Repeats request with `no-cache` header set if the content-type does not
match the latest version. | [
"Simple",
"content",
"type",
"enforcement"
] | 91b5176b7d5d38a7c4d3fa9c31f297f9737c3fcb | https://github.com/wikimedia/restbase/blob/91b5176b7d5d38a7c4d3fa9c31f297f9737c3fcb/lib/ensure_content_type.js#L25-L78 |
17,066 | ioBroker/ioBroker.socketio | lib/socket.js | getUserFromSocket | function getUserFromSocket(socket, callback) {
let wait = false;
try {
if (socket.handshake.headers.cookie && (!socket.request || !socket.request._query || !socket.request._query.user)) {
let cookie = decodeURIComponent(socket.handshake.headers.cookie);
l... | javascript | function getUserFromSocket(socket, callback) {
let wait = false;
try {
if (socket.handshake.headers.cookie && (!socket.request || !socket.request._query || !socket.request._query.user)) {
let cookie = decodeURIComponent(socket.handshake.headers.cookie);
l... | [
"function",
"getUserFromSocket",
"(",
"socket",
",",
"callback",
")",
"{",
"let",
"wait",
"=",
"false",
";",
"try",
"{",
"if",
"(",
"socket",
".",
"handshake",
".",
"headers",
".",
"cookie",
"&&",
"(",
"!",
"socket",
".",
"request",
"||",
"!",
"socket"... | Extract user name from socket | [
"Extract",
"user",
"name",
"from",
"socket"
] | 40d46b71d7341e00b796e85aa80a02941cd7f93f | https://github.com/ioBroker/ioBroker.socketio/blob/40d46b71d7341e00b796e85aa80a02941cd7f93f/lib/socket.js#L37-L100 |
17,067 | ioBroker/ioBroker.socketio | lib/socket.js | updateSession | function updateSession(socket) {
if (socket._sessionID) {
let time = (new Date()).getTime();
if (socket._lastActivity && time - socket._lastActivity > settings.ttl * 1000) {
socket.emit('reauthenticate');
socket.disconnect();
return f... | javascript | function updateSession(socket) {
if (socket._sessionID) {
let time = (new Date()).getTime();
if (socket._lastActivity && time - socket._lastActivity > settings.ttl * 1000) {
socket.emit('reauthenticate');
socket.disconnect();
return f... | [
"function",
"updateSession",
"(",
"socket",
")",
"{",
"if",
"(",
"socket",
".",
"_sessionID",
")",
"{",
"let",
"time",
"=",
"(",
"new",
"Date",
"(",
")",
")",
".",
"getTime",
"(",
")",
";",
"if",
"(",
"socket",
".",
"_lastActivity",
"&&",
"time",
"... | update session ID, but not ofter than 60 seconds | [
"update",
"session",
"ID",
"but",
"not",
"ofter",
"than",
"60",
"seconds"
] | 40d46b71d7341e00b796e85aa80a02941cd7f93f | https://github.com/ioBroker/ioBroker.socketio/blob/40d46b71d7341e00b796e85aa80a02941cd7f93f/lib/socket.js#L470-L494 |
17,068 | rtfeldman/node-test-runner | lib/runner.js | verifyModules | function verifyModules(filePaths) {
return Promise.all(
_.map(filePaths, function(filePath) {
return firstline(filePath).then(function(line) {
var matches = line.match(/^(?:(?:port|effect)\s+)?module\s+(\S+)\s*/);
if (matches) {
var moduleName = matches[1];
var testModul... | javascript | function verifyModules(filePaths) {
return Promise.all(
_.map(filePaths, function(filePath) {
return firstline(filePath).then(function(line) {
var matches = line.match(/^(?:(?:port|effect)\s+)?module\s+(\S+)\s*/);
if (matches) {
var moduleName = matches[1];
var testModul... | [
"function",
"verifyModules",
"(",
"filePaths",
")",
"{",
"return",
"Promise",
".",
"all",
"(",
"_",
".",
"map",
"(",
"filePaths",
",",
"function",
"(",
"filePath",
")",
"{",
"return",
"firstline",
"(",
"filePath",
")",
".",
"then",
"(",
"function",
"(",
... | Check for modules where the name doesn't match the filename. elm-make won't get a chance to detect this; they'll be filtered out first. | [
"Check",
"for",
"modules",
"where",
"the",
"name",
"doesn",
"t",
"match",
"the",
"filename",
".",
"elm",
"-",
"make",
"won",
"t",
"get",
"a",
"chance",
"to",
"detect",
"this",
";",
"they",
"ll",
"be",
"filtered",
"out",
"first",
"."
] | ad469a238e0c686823aebe1c92c61f6c57de3cfe | https://github.com/rtfeldman/node-test-runner/blob/ad469a238e0c686823aebe1c92c61f6c57de3cfe/lib/runner.js#L186-L219 |
17,069 | rtfeldman/node-test-runner | fixtures/elm-home/0.19.0/package/elm/virtual-dom/1.0.0/src/Elm/Kernel/VirtualDom.js | _VirtualDom_pairwiseRefEqual | function _VirtualDom_pairwiseRefEqual(as, bs)
{
for (var i = 0; i < as.length; i++)
{
if (as[i] !== bs[i])
{
return false;
}
}
return true;
} | javascript | function _VirtualDom_pairwiseRefEqual(as, bs)
{
for (var i = 0; i < as.length; i++)
{
if (as[i] !== bs[i])
{
return false;
}
}
return true;
} | [
"function",
"_VirtualDom_pairwiseRefEqual",
"(",
"as",
",",
"bs",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"as",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"as",
"[",
"i",
"]",
"!==",
"bs",
"[",
"i",
"]",
")",
"{",
... | assumes the incoming arrays are the same length | [
"assumes",
"the",
"incoming",
"arrays",
"are",
"the",
"same",
"length"
] | ad469a238e0c686823aebe1c92c61f6c57de3cfe | https://github.com/rtfeldman/node-test-runner/blob/ad469a238e0c686823aebe1c92c61f6c57de3cfe/fixtures/elm-home/0.19.0/package/elm/virtual-dom/1.0.0/src/Elm/Kernel/VirtualDom.js#L834-L845 |
17,070 | krescruz/angular-materialize | js/materialize.clockpicker.js | mousedown | function mousedown(e, space) {
var offset = plate.offset(),
isTouch = /^touch/.test(e.type),
x0 = offset.left + dialRadius,
y0 = offset.top + dialRadius,
dx = (isTouch ? e.originalEvent.touches[0] : e).pageX - x0,
dy = (isTouch ... | javascript | function mousedown(e, space) {
var offset = plate.offset(),
isTouch = /^touch/.test(e.type),
x0 = offset.left + dialRadius,
y0 = offset.top + dialRadius,
dx = (isTouch ? e.originalEvent.touches[0] : e).pageX - x0,
dy = (isTouch ... | [
"function",
"mousedown",
"(",
"e",
",",
"space",
")",
"{",
"var",
"offset",
"=",
"plate",
".",
"offset",
"(",
")",
",",
"isTouch",
"=",
"/",
"^touch",
"/",
".",
"test",
"(",
"e",
".",
"type",
")",
",",
"x0",
"=",
"offset",
".",
"left",
"+",
"di... | Mousedown or touchstart | [
"Mousedown",
"or",
"touchstart"
] | 121a131b49ee699f43d66a46ed2ae64d50faa3bd | https://github.com/krescruz/angular-materialize/blob/121a131b49ee699f43d66a46ed2ae64d50faa3bd/js/materialize.clockpicker.js#L257-L324 |
17,071 | krescruz/angular-materialize | src/angular-materialize.js | setScopeValues | function setScopeValues(scope, attrs) {
scope.List = [];
scope.Hide = false;
scope.page = parseInt(scope.page) || 1;
scope.total = parseInt(scope.total) || 0;
scope.dots = scope.dots || '...';
scope.ulClass = scope.ulClass |... | javascript | function setScopeValues(scope, attrs) {
scope.List = [];
scope.Hide = false;
scope.page = parseInt(scope.page) || 1;
scope.total = parseInt(scope.total) || 0;
scope.dots = scope.dots || '...';
scope.ulClass = scope.ulClass |... | [
"function",
"setScopeValues",
"(",
"scope",
",",
"attrs",
")",
"{",
"scope",
".",
"List",
"=",
"[",
"]",
";",
"scope",
".",
"Hide",
"=",
"false",
";",
"scope",
".",
"page",
"=",
"parseInt",
"(",
"scope",
".",
"page",
")",
"||",
"1",
";",
"scope",
... | Assign null-able scope values from settings | [
"Assign",
"null",
"-",
"able",
"scope",
"values",
"from",
"settings"
] | 121a131b49ee699f43d66a46ed2ae64d50faa3bd | https://github.com/krescruz/angular-materialize/blob/121a131b49ee699f43d66a46ed2ae64d50faa3bd/src/angular-materialize.js#L880-L895 |
17,072 | krescruz/angular-materialize | src/angular-materialize.js | validateScopeValues | function validateScopeValues(scope, pageCount) {
// Block where the page is larger than the pageCount
if (scope.page > pageCount) {
scope.page = pageCount;
}
// Block where the page is less than 0
if (scope.page <= 0) {... | javascript | function validateScopeValues(scope, pageCount) {
// Block where the page is larger than the pageCount
if (scope.page > pageCount) {
scope.page = pageCount;
}
// Block where the page is less than 0
if (scope.page <= 0) {... | [
"function",
"validateScopeValues",
"(",
"scope",
",",
"pageCount",
")",
"{",
"// Block where the page is larger than the pageCount",
"if",
"(",
"scope",
".",
"page",
">",
"pageCount",
")",
"{",
"scope",
".",
"page",
"=",
"pageCount",
";",
"}",
"// Block where the pa... | Validate and clean up any scope values This happens after we have set the scope values | [
"Validate",
"and",
"clean",
"up",
"any",
"scope",
"values",
"This",
"happens",
"after",
"we",
"have",
"set",
"the",
"scope",
"values"
] | 121a131b49ee699f43d66a46ed2ae64d50faa3bd | https://github.com/krescruz/angular-materialize/blob/121a131b49ee699f43d66a46ed2ae64d50faa3bd/src/angular-materialize.js#L900-L921 |
17,073 | krescruz/angular-materialize | src/angular-materialize.js | internalAction | function internalAction(scope, page) {
page = page.valueOf();
// Block clicks we try to load the active page
if (scope.page == page) {
return;
}
// Update the page in scope and fire any paging actions
sc... | javascript | function internalAction(scope, page) {
page = page.valueOf();
// Block clicks we try to load the active page
if (scope.page == page) {
return;
}
// Update the page in scope and fire any paging actions
sc... | [
"function",
"internalAction",
"(",
"scope",
",",
"page",
")",
"{",
"page",
"=",
"page",
".",
"valueOf",
"(",
")",
";",
"// Block clicks we try to load the active page",
"if",
"(",
"scope",
".",
"page",
"==",
"page",
")",
"{",
"return",
";",
"}",
"// Update t... | Internal Pagination Click Action | [
"Internal",
"Pagination",
"Click",
"Action"
] | 121a131b49ee699f43d66a46ed2ae64d50faa3bd | https://github.com/krescruz/angular-materialize/blob/121a131b49ee699f43d66a46ed2ae64d50faa3bd/src/angular-materialize.js#L924-L941 |
17,074 | krescruz/angular-materialize | src/angular-materialize.js | addRange | function addRange(start, finish, scope) {
var i = 0;
for (i = start; i <= finish; i++) {
var item = {
value: $sce.trustAsHtml(i.toString()),
liClass: scope.page == i ? scope.activeClass : 'waves-effect',
... | javascript | function addRange(start, finish, scope) {
var i = 0;
for (i = start; i <= finish; i++) {
var item = {
value: $sce.trustAsHtml(i.toString()),
liClass: scope.page == i ? scope.activeClass : 'waves-effect',
... | [
"function",
"addRange",
"(",
"start",
",",
"finish",
",",
"scope",
")",
"{",
"var",
"i",
"=",
"0",
";",
"for",
"(",
"i",
"=",
"start",
";",
"i",
"<=",
"finish",
";",
"i",
"++",
")",
"{",
"var",
"item",
"=",
"{",
"value",
":",
"$sce",
".",
"tr... | Add Range of Numbers | [
"Add",
"Range",
"of",
"Numbers"
] | 121a131b49ee699f43d66a46ed2ae64d50faa3bd | https://github.com/krescruz/angular-materialize/blob/121a131b49ee699f43d66a46ed2ae64d50faa3bd/src/angular-materialize.js#L944-L957 |
17,075 | krescruz/angular-materialize | src/angular-materialize.js | build | function build(scope, attrs) {
// Block divide by 0 and empty page size
if (!scope.pageSize || scope.pageSize < 0)
{
return;
}
// Assign scope values
setScopeValues(scope, attrs);
// lo... | javascript | function build(scope, attrs) {
// Block divide by 0 and empty page size
if (!scope.pageSize || scope.pageSize < 0)
{
return;
}
// Assign scope values
setScopeValues(scope, attrs);
// lo... | [
"function",
"build",
"(",
"scope",
",",
"attrs",
")",
"{",
"// Block divide by 0 and empty page size",
"if",
"(",
"!",
"scope",
".",
"pageSize",
"||",
"scope",
".",
"pageSize",
"<",
"0",
")",
"{",
"return",
";",
"}",
"// Assign scope values",
"setScopeValues",
... | Main build function | [
"Main",
"build",
"function"
] | 121a131b49ee699f43d66a46ed2ae64d50faa3bd | https://github.com/krescruz/angular-materialize/blob/121a131b49ee699f43d66a46ed2ae64d50faa3bd/src/angular-materialize.js#L1057-L1116 |
17,076 | krescruz/angular-materialize | src/angular-materialize.js | init | function init() {
element.addClass("tooltipped");
$compile(element.contents())(scope);
$timeout(function () {
// https://github.com/Dogfalo/materialize/issues/3546
// if element.addClass("too... | javascript | function init() {
element.addClass("tooltipped");
$compile(element.contents())(scope);
$timeout(function () {
// https://github.com/Dogfalo/materialize/issues/3546
// if element.addClass("too... | [
"function",
"init",
"(",
")",
"{",
"element",
".",
"addClass",
"(",
"\"tooltipped\"",
")",
";",
"$compile",
"(",
"element",
".",
"contents",
"(",
")",
")",
"(",
"scope",
")",
";",
"$timeout",
"(",
"function",
"(",
")",
"{",
"// https://github.com/Dogfalo/m... | assigning to noop | [
"assigning",
"to",
"noop"
] | 121a131b49ee699f43d66a46ed2ae64d50faa3bd | https://github.com/krescruz/angular-materialize/blob/121a131b49ee699f43d66a46ed2ae64d50faa3bd/src/angular-materialize.js#L1244-L1259 |
17,077 | simonh1000/angular-http-server | lib/get-file-path-from-url.js | getFilePathFromUrl | function getFilePathFromUrl(url, basePath, { pathLib = path } = {}) {
if (!basePath) {
throw new Error('basePath must be specified');
}
if (!pathLib.isAbsolute(basePath)) {
throw new Error(`${basePath} is invalid - must be absolute`);
}
const relativePath = url.split('?')[0];
if (relativePath.inde... | javascript | function getFilePathFromUrl(url, basePath, { pathLib = path } = {}) {
if (!basePath) {
throw new Error('basePath must be specified');
}
if (!pathLib.isAbsolute(basePath)) {
throw new Error(`${basePath} is invalid - must be absolute`);
}
const relativePath = url.split('?')[0];
if (relativePath.inde... | [
"function",
"getFilePathFromUrl",
"(",
"url",
",",
"basePath",
",",
"{",
"pathLib",
"=",
"path",
"}",
"=",
"{",
"}",
")",
"{",
"if",
"(",
"!",
"basePath",
")",
"{",
"throw",
"new",
"Error",
"(",
"'basePath must be specified'",
")",
";",
"}",
"if",
"(",... | Safely get the path for a file in the project directory, or reject by returning "dummy"
@param {string} url
@param {string} basePath - absolute path to base directory
@param {object} [pathLib=path] - path library, override for testing
@return {string} - will return 'dummy' if the path is bad | [
"Safely",
"get",
"the",
"path",
"for",
"a",
"file",
"in",
"the",
"project",
"directory",
"or",
"reject",
"by",
"returning",
"dummy"
] | 6c86b7a763f4234098d6911f952773aa190cac47 | https://github.com/simonh1000/angular-http-server/blob/6c86b7a763f4234098d6911f952773aa190cac47/lib/get-file-path-from-url.js#L11-L35 |
17,078 | wxajs/wxa | packages/wxa-core/src/utils/decorators.js | Lock | function Lock(target, name, descriptor) {
let fn = descriptor.value;
let $$LockIsDoing = false;
let reset = ()=>$$LockIsDoing=false;
descriptor.value = function(...args) {
if ($$LockIsDoing) return;
$$LockIsDoing = true;
let ret = fn.apply(this, args);
if (ret && ret.t... | javascript | function Lock(target, name, descriptor) {
let fn = descriptor.value;
let $$LockIsDoing = false;
let reset = ()=>$$LockIsDoing=false;
descriptor.value = function(...args) {
if ($$LockIsDoing) return;
$$LockIsDoing = true;
let ret = fn.apply(this, args);
if (ret && ret.t... | [
"function",
"Lock",
"(",
"target",
",",
"name",
",",
"descriptor",
")",
"{",
"let",
"fn",
"=",
"descriptor",
".",
"value",
";",
"let",
"$$LockIsDoing",
"=",
"false",
";",
"let",
"reset",
"=",
"(",
")",
"=>",
"$$LockIsDoing",
"=",
"false",
";",
"descrip... | Lock function util fn finish process
@param {any} target
@param {any} name
@param {any} descriptor
@return {any} | [
"Lock",
"function",
"util",
"fn",
"finish",
"process"
] | f957458cb4a08d3d9cd1aa166666c36961682c90 | https://github.com/wxajs/wxa/blob/f957458cb4a08d3d9cd1aa166666c36961682c90/packages/wxa-core/src/utils/decorators.js#L229-L256 |
17,079 | wxajs/wxa | packages/wxa-core/src/decorators/methods.decorators.js | Deprecate | function Deprecate(methodDescriptor) {
let {descriptor, key} = methodDescriptor;
let fn = descriptor.value;
descriptor.value = function(...args) {
console.warn(`DEPRECATE: [${key}] This function will be removed in future versions.`);
return fn.apply(this, args);
};
return {
... | javascript | function Deprecate(methodDescriptor) {
let {descriptor, key} = methodDescriptor;
let fn = descriptor.value;
descriptor.value = function(...args) {
console.warn(`DEPRECATE: [${key}] This function will be removed in future versions.`);
return fn.apply(this, args);
};
return {
... | [
"function",
"Deprecate",
"(",
"methodDescriptor",
")",
"{",
"let",
"{",
"descriptor",
",",
"key",
"}",
"=",
"methodDescriptor",
";",
"let",
"fn",
"=",
"descriptor",
".",
"value",
";",
"descriptor",
".",
"value",
"=",
"function",
"(",
"...",
"args",
")",
... | mark methods to deprecate. while developer call it, print a warning text to console
@param {any} methodDescriptor
@return {any} | [
"mark",
"methods",
"to",
"deprecate",
".",
"while",
"developer",
"call",
"it",
"print",
"a",
"warning",
"text",
"to",
"console"
] | f957458cb4a08d3d9cd1aa166666c36961682c90 | https://github.com/wxajs/wxa/blob/f957458cb4a08d3d9cd1aa166666c36961682c90/packages/wxa-core/src/decorators/methods.decorators.js#L13-L27 |
17,080 | tbranyen/backbone.layoutmanager | node/index.js | function(template) {
// Automatically add the `.html` extension.
template = template + ".html";
// Put this fetch into `async` mode to work better in the Node environment.
var done = this.async();
// By default read in the file from the filesystem relative to the code
// being executed.
fs... | javascript | function(template) {
// Automatically add the `.html` extension.
template = template + ".html";
// Put this fetch into `async` mode to work better in the Node environment.
var done = this.async();
// By default read in the file from the filesystem relative to the code
// being executed.
fs... | [
"function",
"(",
"template",
")",
"{",
"// Automatically add the `.html` extension.",
"template",
"=",
"template",
"+",
"\".html\"",
";",
"// Put this fetch into `async` mode to work better in the Node environment.",
"var",
"done",
"=",
"this",
".",
"async",
"(",
")",
";",
... | Sensible default for Node.js is to load templates from the filesystem. This is similar to how we default to script tags in browser-land. | [
"Sensible",
"default",
"for",
"Node",
".",
"js",
"is",
"to",
"load",
"templates",
"from",
"the",
"filesystem",
".",
"This",
"is",
"similar",
"to",
"how",
"we",
"default",
"to",
"script",
"tags",
"in",
"browser",
"-",
"land",
"."
] | ba2a8ae3dc4c2519765cad3761cb59c7bb179312 | https://github.com/tbranyen/backbone.layoutmanager/blob/ba2a8ae3dc4c2519765cad3761cb59c7bb179312/node/index.js#L43-L66 | |
17,081 | tbranyen/backbone.layoutmanager | backbone.layoutmanager.js | function(rendered, manager, def) {
// Actually put the rendered contents into the element.
if (_.isString(rendered)) {
// If no container is specified, we must replace the content.
if (manager.noel) {
rendered = $.parseHTML(rendered, true);
// Remove extra root elements.
thi... | javascript | function(rendered, manager, def) {
// Actually put the rendered contents into the element.
if (_.isString(rendered)) {
// If no container is specified, we must replace the content.
if (manager.noel) {
rendered = $.parseHTML(rendered, true);
// Remove extra root elements.
thi... | [
"function",
"(",
"rendered",
",",
"manager",
",",
"def",
")",
"{",
"// Actually put the rendered contents into the element.",
"if",
"(",
"_",
".",
"isString",
"(",
"rendered",
")",
")",
"{",
"// If no container is specified, we must replace the content.",
"if",
"(",
"ma... | This function is responsible for pairing the rendered template into the DOM element. | [
"This",
"function",
"is",
"responsible",
"for",
"pairing",
"the",
"rendered",
"template",
"into",
"the",
"DOM",
"element",
"."
] | ba2a8ae3dc4c2519765cad3761cb59c7bb179312 | https://github.com/tbranyen/backbone.layoutmanager/blob/ba2a8ae3dc4c2519765cad3761cb59c7bb179312/backbone.layoutmanager.js#L113-L136 | |
17,082 | tbranyen/backbone.layoutmanager | backbone.layoutmanager.js | done | function done(context, template) {
// Store the rendered template someplace so it can be re-assignable.
var rendered;
// Trigger this once the render method has completed.
manager.callback = function(rendered) {
// Clean up asynchronous manager properties.
delete manager.isAsync... | javascript | function done(context, template) {
// Store the rendered template someplace so it can be re-assignable.
var rendered;
// Trigger this once the render method has completed.
manager.callback = function(rendered) {
// Clean up asynchronous manager properties.
delete manager.isAsync... | [
"function",
"done",
"(",
"context",
",",
"template",
")",
"{",
"// Store the rendered template someplace so it can be re-assignable.",
"var",
"rendered",
";",
"// Trigger this once the render method has completed.",
"manager",
".",
"callback",
"=",
"function",
"(",
"rendered",
... | Once the template is successfully fetched, use its contents to proceed. Context argument is first, since it is bound for partial application reasons. | [
"Once",
"the",
"template",
"is",
"successfully",
"fetched",
"use",
"its",
"contents",
"to",
"proceed",
".",
"Context",
"argument",
"is",
"first",
"since",
"it",
"is",
"bound",
"for",
"partial",
"application",
"reasons",
"."
] | ba2a8ae3dc4c2519765cad3761cb59c7bb179312 | https://github.com/tbranyen/backbone.layoutmanager/blob/ba2a8ae3dc4c2519765cad3761cb59c7bb179312/backbone.layoutmanager.js#L148-L173 |
17,083 | tbranyen/backbone.layoutmanager | backbone.layoutmanager.js | Layout | function Layout(options) {
// Grant this View superpowers.
this.manage = true;
// Give this View access to all passed options as instance properties.
_.extend(this, options);
// Have Backbone set up the rest of this View.
Backbone.View.apply(this, arguments);
} | javascript | function Layout(options) {
// Grant this View superpowers.
this.manage = true;
// Give this View access to all passed options as instance properties.
_.extend(this, options);
// Have Backbone set up the rest of this View.
Backbone.View.apply(this, arguments);
} | [
"function",
"Layout",
"(",
"options",
")",
"{",
"// Grant this View superpowers.",
"this",
".",
"manage",
"=",
"true",
";",
"// Give this View access to all passed options as instance properties.",
"_",
".",
"extend",
"(",
"this",
",",
"options",
")",
";",
"// Have Back... | This named function allows for significantly easier debugging. | [
"This",
"named",
"function",
"allows",
"for",
"significantly",
"easier",
"debugging",
"."
] | ba2a8ae3dc4c2519765cad3761cb59c7bb179312 | https://github.com/tbranyen/backbone.layoutmanager/blob/ba2a8ae3dc4c2519765cad3761cb59c7bb179312/backbone.layoutmanager.js#L237-L246 |
17,084 | tbranyen/backbone.layoutmanager | backbone.layoutmanager.js | function(selector, view) {
// If the `view` argument exists, then a selector was passed in. This code
// path will forward the selector on to `setView`.
if (view) {
return this.setView(selector, view, true);
}
// If no `view` argument is defined, then assume the first argument is the
// ... | javascript | function(selector, view) {
// If the `view` argument exists, then a selector was passed in. This code
// path will forward the selector on to `setView`.
if (view) {
return this.setView(selector, view, true);
}
// If no `view` argument is defined, then assume the first argument is the
// ... | [
"function",
"(",
"selector",
",",
"view",
")",
"{",
"// If the `view` argument exists, then a selector was passed in. This code",
"// path will forward the selector on to `setView`.",
"if",
"(",
"view",
")",
"{",
"return",
"this",
".",
"setView",
"(",
"selector",
",",
"vie... | Shorthand to `setView` function with the `insert` flag set. | [
"Shorthand",
"to",
"setView",
"function",
"with",
"the",
"insert",
"flag",
"set",
"."
] | ba2a8ae3dc4c2519765cad3761cb59c7bb179312 | https://github.com/tbranyen/backbone.layoutmanager/blob/ba2a8ae3dc4c2519765cad3761cb59c7bb179312/backbone.layoutmanager.js#L304-L314 | |
17,085 | tbranyen/backbone.layoutmanager | backbone.layoutmanager.js | function(views) {
// If an array of views was passed it should be inserted into the
// root view. Much like calling insertView without a selector.
if (_.isArray(views)) {
return this.setViews({ "": views });
}
_.each(views, function(view, selector) {
views[selector] = _.isArray(view) ? ... | javascript | function(views) {
// If an array of views was passed it should be inserted into the
// root view. Much like calling insertView without a selector.
if (_.isArray(views)) {
return this.setViews({ "": views });
}
_.each(views, function(view, selector) {
views[selector] = _.isArray(view) ? ... | [
"function",
"(",
"views",
")",
"{",
"// If an array of views was passed it should be inserted into the",
"// root view. Much like calling insertView without a selector.",
"if",
"(",
"_",
".",
"isArray",
"(",
"views",
")",
")",
"{",
"return",
"this",
".",
"setViews",
"(",
... | Iterate over an object and ensure every value is wrapped in an array to ensure they will be inserted, then pass that object to `setViews`. | [
"Iterate",
"over",
"an",
"object",
"and",
"ensure",
"every",
"value",
"is",
"wrapped",
"in",
"an",
"array",
"to",
"ensure",
"they",
"will",
"be",
"inserted",
"then",
"pass",
"that",
"object",
"to",
"setViews",
"."
] | ba2a8ae3dc4c2519765cad3761cb59c7bb179312 | https://github.com/tbranyen/backbone.layoutmanager/blob/ba2a8ae3dc4c2519765cad3761cb59c7bb179312/backbone.layoutmanager.js#L318-L330 | |
17,086 | tbranyen/backbone.layoutmanager | backbone.layoutmanager.js | function(fn) {
var views;
// If the filter argument is a String, then return a chained Version of the
// elements. The value at the specified filter may be undefined, a single
// view, or an array of views; in all cases, chain on a flat array.
if (typeof fn === "string") {
fn = this.sections[... | javascript | function(fn) {
var views;
// If the filter argument is a String, then return a chained Version of the
// elements. The value at the specified filter may be undefined, a single
// view, or an array of views; in all cases, chain on a flat array.
if (typeof fn === "string") {
fn = this.sections[... | [
"function",
"(",
"fn",
")",
"{",
"var",
"views",
";",
"// If the filter argument is a String, then return a chained Version of the",
"// elements. The value at the specified filter may be undefined, a single",
"// view, or an array of views; in all cases, chain on a flat array.",
"if",
"(",
... | Provide a filter function to get a flattened array of all the subviews. If the filter function is omitted it will return all subviews. If a String is passed instead, it will return the Views for that selector. | [
"Provide",
"a",
"filter",
"function",
"to",
"get",
"a",
"flattened",
"array",
"of",
"all",
"the",
"subviews",
".",
"If",
"the",
"filter",
"function",
"is",
"omitted",
"it",
"will",
"return",
"all",
"subviews",
".",
"If",
"a",
"String",
"is",
"passed",
"i... | ba2a8ae3dc4c2519765cad3761cb59c7bb179312 | https://github.com/tbranyen/backbone.layoutmanager/blob/ba2a8ae3dc4c2519765cad3761cb59c7bb179312/backbone.layoutmanager.js#L348-L378 | |
17,087 | tbranyen/backbone.layoutmanager | backbone.layoutmanager.js | function(fn) {
var views;
// Allow an optional selector or function to find the right model and
// remove nested Views based off the results of the selector or filter.
views = this.getViews(fn).each(function(nestedView) {
nestedView.remove();
});
// call value incase the chain is evaluat... | javascript | function(fn) {
var views;
// Allow an optional selector or function to find the right model and
// remove nested Views based off the results of the selector or filter.
views = this.getViews(fn).each(function(nestedView) {
nestedView.remove();
});
// call value incase the chain is evaluat... | [
"function",
"(",
"fn",
")",
"{",
"var",
"views",
";",
"// Allow an optional selector or function to find the right model and",
"// remove nested Views based off the results of the selector or filter.",
"views",
"=",
"this",
".",
"getViews",
"(",
"fn",
")",
".",
"each",
"(",
... | Use this to remove Views, internally uses `getViews` so you can pass the same argument here as you would to that method. | [
"Use",
"this",
"to",
"remove",
"Views",
"internally",
"uses",
"getViews",
"so",
"you",
"can",
"pass",
"the",
"same",
"argument",
"here",
"as",
"you",
"would",
"to",
"that",
"method",
"."
] | ba2a8ae3dc4c2519765cad3761cb59c7bb179312 | https://github.com/tbranyen/backbone.layoutmanager/blob/ba2a8ae3dc4c2519765cad3761cb59c7bb179312/backbone.layoutmanager.js#L382-L396 | |
17,088 | tbranyen/backbone.layoutmanager | backbone.layoutmanager.js | function(views) {
// Iterate over all the views and use the View's view method to assign.
_.each(views, function(view, name) {
// If the view is an array put all views into insert mode.
if (_.isArray(view)) {
return _.each(view, function(view) {
this.insertView(name, view);
... | javascript | function(views) {
// Iterate over all the views and use the View's view method to assign.
_.each(views, function(view, name) {
// If the view is an array put all views into insert mode.
if (_.isArray(view)) {
return _.each(view, function(view) {
this.insertView(name, view);
... | [
"function",
"(",
"views",
")",
"{",
"// Iterate over all the views and use the View's view method to assign.",
"_",
".",
"each",
"(",
"views",
",",
"function",
"(",
"view",
",",
"name",
")",
"{",
"// If the view is an array put all views into insert mode.",
"if",
"(",
"_"... | Allows the setting of multiple views instead of a single view. | [
"Allows",
"the",
"setting",
"of",
"multiple",
"views",
"instead",
"of",
"a",
"single",
"view",
"."
] | ba2a8ae3dc4c2519765cad3761cb59c7bb179312 | https://github.com/tbranyen/backbone.layoutmanager/blob/ba2a8ae3dc4c2519765cad3761cb59c7bb179312/backbone.layoutmanager.js#L458-L474 | |
17,089 | tbranyen/backbone.layoutmanager | backbone.layoutmanager.js | resolve | function resolve() {
// Insert all subViews into the parent at once.
_.each(root.views, function(views, selector) {
// Fragments aren't used on arrays of subviews.
if (_.isArray(views)) {
root.htmlBatch(root, views, selector);
}
});
// If there is a parent and... | javascript | function resolve() {
// Insert all subViews into the parent at once.
_.each(root.views, function(views, selector) {
// Fragments aren't used on arrays of subviews.
if (_.isArray(views)) {
root.htmlBatch(root, views, selector);
}
});
// If there is a parent and... | [
"function",
"resolve",
"(",
")",
"{",
"// Insert all subViews into the parent at once.",
"_",
".",
"each",
"(",
"root",
".",
"views",
",",
"function",
"(",
"views",
",",
"selector",
")",
"{",
"// Fragments aren't used on arrays of subviews.",
"if",
"(",
"_",
".",
... | Triggered once the render has succeeded. | [
"Triggered",
"once",
"the",
"render",
"has",
"succeeded",
"."
] | ba2a8ae3dc4c2519765cad3761cb59c7bb179312 | https://github.com/tbranyen/backbone.layoutmanager/blob/ba2a8ae3dc4c2519765cad3761cb59c7bb179312/backbone.layoutmanager.js#L490-L573 |
17,090 | tbranyen/backbone.layoutmanager | backbone.layoutmanager.js | completeRender | function completeRender() {
var console = window.console;
var afterRender = root.afterRender;
if (afterRender) {
afterRender.call(root, root);
}
// Always emit an afterRender event.
root.trigger("afterRender", root);
// If there are multiple top level... | javascript | function completeRender() {
var console = window.console;
var afterRender = root.afterRender;
if (afterRender) {
afterRender.call(root, root);
}
// Always emit an afterRender event.
root.trigger("afterRender", root);
// If there are multiple top level... | [
"function",
"completeRender",
"(",
")",
"{",
"var",
"console",
"=",
"window",
".",
"console",
";",
"var",
"afterRender",
"=",
"root",
".",
"afterRender",
";",
"if",
"(",
"afterRender",
")",
"{",
"afterRender",
".",
"call",
"(",
"root",
",",
"root",
")",
... | Reusable function for triggering the afterRender callback and event. | [
"Reusable",
"function",
"for",
"triggering",
"the",
"afterRender",
"callback",
"and",
"event",
"."
] | ba2a8ae3dc4c2519765cad3761cb59c7bb179312 | https://github.com/tbranyen/backbone.layoutmanager/blob/ba2a8ae3dc4c2519765cad3761cb59c7bb179312/backbone.layoutmanager.js#L532-L558 |
17,091 | tbranyen/backbone.layoutmanager | backbone.layoutmanager.js | function(callback, deferred) {
var root = this;
var manager = root.__manager__;
var rentManager = manager.parent && manager.parent.__manager__;
// Allow RAF processing to be shut off using `useRAF`:false.
if (this.useRAF === false) {
if (manager.queue) {
aPush.call(manager.queue, call... | javascript | function(callback, deferred) {
var root = this;
var manager = root.__manager__;
var rentManager = manager.parent && manager.parent.__manager__;
// Allow RAF processing to be shut off using `useRAF`:false.
if (this.useRAF === false) {
if (manager.queue) {
aPush.call(manager.queue, call... | [
"function",
"(",
"callback",
",",
"deferred",
")",
"{",
"var",
"root",
"=",
"this",
";",
"var",
"manager",
"=",
"root",
".",
"__manager__",
";",
"var",
"rentManager",
"=",
"manager",
".",
"parent",
"&&",
"manager",
".",
"parent",
".",
"__manager__",
";",... | Register a view render with RAF. | [
"Register",
"a",
"view",
"render",
"with",
"RAF",
"."
] | ba2a8ae3dc4c2519765cad3761cb59c7bb179312 | https://github.com/tbranyen/backbone.layoutmanager/blob/ba2a8ae3dc4c2519765cad3761cb59c7bb179312/backbone.layoutmanager.js#L646-L703 | |
17,092 | tbranyen/backbone.layoutmanager | backbone.layoutmanager.js | resolveDeferreds | function resolveDeferreds() {
for (var i = 0; i < manager.deferreds.length; i++){
manager.deferreds[i].resolveWith(root, [root]);
}
manager.deferreds = [];
} | javascript | function resolveDeferreds() {
for (var i = 0; i < manager.deferreds.length; i++){
manager.deferreds[i].resolveWith(root, [root]);
}
manager.deferreds = [];
} | [
"function",
"resolveDeferreds",
"(",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"manager",
".",
"deferreds",
".",
"length",
";",
"i",
"++",
")",
"{",
"manager",
".",
"deferreds",
"[",
"i",
"]",
".",
"resolveWith",
"(",
"root",
",",
... | Resolve all deferreds that were cancelled previously, if any. This allows the user to bind callbacks to any render callback, even if it was cancelled above. | [
"Resolve",
"all",
"deferreds",
"that",
"were",
"cancelled",
"previously",
"if",
"any",
".",
"This",
"allows",
"the",
"user",
"to",
"bind",
"callbacks",
"to",
"any",
"render",
"callback",
"even",
"if",
"it",
"was",
"cancelled",
"above",
"."
] | ba2a8ae3dc4c2519765cad3761cb59c7bb179312 | https://github.com/tbranyen/backbone.layoutmanager/blob/ba2a8ae3dc4c2519765cad3761cb59c7bb179312/backbone.layoutmanager.js#L697-L702 |
17,093 | tbranyen/backbone.layoutmanager | backbone.layoutmanager.js | function() {
var root = this;
var manager = root.__manager__;
if (manager.rafID != null) {
root.cancelAnimationFrame(manager.rafID);
}
} | javascript | function() {
var root = this;
var manager = root.__manager__;
if (manager.rafID != null) {
root.cancelAnimationFrame(manager.rafID);
}
} | [
"function",
"(",
")",
"{",
"var",
"root",
"=",
"this",
";",
"var",
"manager",
"=",
"root",
".",
"__manager__",
";",
"if",
"(",
"manager",
".",
"rafID",
"!=",
"null",
")",
"{",
"root",
".",
"cancelAnimationFrame",
"(",
"manager",
".",
"rafID",
")",
";... | Cancel any queued render requests. | [
"Cancel",
"any",
"queued",
"render",
"requests",
"."
] | ba2a8ae3dc4c2519765cad3761cb59c7bb179312 | https://github.com/tbranyen/backbone.layoutmanager/blob/ba2a8ae3dc4c2519765cad3761cb59c7bb179312/backbone.layoutmanager.js#L706-L712 | |
17,094 | tbranyen/backbone.layoutmanager | backbone.layoutmanager.js | function(root, force) {
// Shift arguments around.
if (typeof root === "boolean") {
force = root;
root = this;
}
// Allow removeView to be called on instances.
root = root || this;
// Iterate over all of the nested View's and remove.
root.getViews().each(function(view) {
... | javascript | function(root, force) {
// Shift arguments around.
if (typeof root === "boolean") {
force = root;
root = this;
}
// Allow removeView to be called on instances.
root = root || this;
// Iterate over all of the nested View's and remove.
root.getViews().each(function(view) {
... | [
"function",
"(",
"root",
",",
"force",
")",
"{",
"// Shift arguments around.",
"if",
"(",
"typeof",
"root",
"===",
"\"boolean\"",
")",
"{",
"force",
"=",
"root",
";",
"root",
"=",
"this",
";",
"}",
"// Allow removeView to be called on instances.",
"root",
"=",
... | Remove all nested Views. | [
"Remove",
"all",
"nested",
"Views",
"."
] | ba2a8ae3dc4c2519765cad3761cb59c7bb179312 | https://github.com/tbranyen/backbone.layoutmanager/blob/ba2a8ae3dc4c2519765cad3761cb59c7bb179312/backbone.layoutmanager.js#L721-L740 | |
17,095 | tbranyen/backbone.layoutmanager | backbone.layoutmanager.js | function(view, force) {
var parentViews;
// Shorthand the managers for easier access.
var manager = view.__manager__;
var rentManager = manager.parent && manager.parent.__manager__;
// Test for keep.
var keep = typeof view.keep === "boolean" ? view.keep : view.options.keep;
// In insert mod... | javascript | function(view, force) {
var parentViews;
// Shorthand the managers for easier access.
var manager = view.__manager__;
var rentManager = manager.parent && manager.parent.__manager__;
// Test for keep.
var keep = typeof view.keep === "boolean" ? view.keep : view.options.keep;
// In insert mod... | [
"function",
"(",
"view",
",",
"force",
")",
"{",
"var",
"parentViews",
";",
"// Shorthand the managers for easier access.",
"var",
"manager",
"=",
"view",
".",
"__manager__",
";",
"var",
"rentManager",
"=",
"manager",
".",
"parent",
"&&",
"manager",
".",
"parent... | Remove a single nested View. | [
"Remove",
"a",
"single",
"nested",
"View",
"."
] | ba2a8ae3dc4c2519765cad3761cb59c7bb179312 | https://github.com/tbranyen/backbone.layoutmanager/blob/ba2a8ae3dc4c2519765cad3761cb59c7bb179312/backbone.layoutmanager.js#L743-L792 | |
17,096 | tbranyen/backbone.layoutmanager | backbone.layoutmanager.js | function(path, contents) {
// If template path is found in the cache, return the contents.
if (path in this._cache && contents == null) {
return this._cache[path];
// Ensure path and contents aren't undefined.
} else if (path != null && contents != null) {
return this._cache[path] = contents... | javascript | function(path, contents) {
// If template path is found in the cache, return the contents.
if (path in this._cache && contents == null) {
return this._cache[path];
// Ensure path and contents aren't undefined.
} else if (path != null && contents != null) {
return this._cache[path] = contents... | [
"function",
"(",
"path",
",",
"contents",
")",
"{",
"// If template path is found in the cache, return the contents.",
"if",
"(",
"path",
"in",
"this",
".",
"_cache",
"&&",
"contents",
"==",
"null",
")",
"{",
"return",
"this",
".",
"_cache",
"[",
"path",
"]",
... | Cache templates into LayoutManager._cache. | [
"Cache",
"templates",
"into",
"LayoutManager",
".",
"_cache",
"."
] | ba2a8ae3dc4c2519765cad3761cb59c7bb179312 | https://github.com/tbranyen/backbone.layoutmanager/blob/ba2a8ae3dc4c2519765cad3761cb59c7bb179312/backbone.layoutmanager.js#L795-L805 | |
17,097 | tbranyen/backbone.layoutmanager | backbone.layoutmanager.js | function(views) {
// Clear out all existing views.
_.each(aConcat.call([], views), function(view) {
// fire cleanup event to the attached handlers
view.trigger("cleanup", view);
// Remove all custom events attached to this View.
view.unbind();
// Automatically unbind `model`.
... | javascript | function(views) {
// Clear out all existing views.
_.each(aConcat.call([], views), function(view) {
// fire cleanup event to the attached handlers
view.trigger("cleanup", view);
// Remove all custom events attached to this View.
view.unbind();
// Automatically unbind `model`.
... | [
"function",
"(",
"views",
")",
"{",
"// Clear out all existing views.",
"_",
".",
"each",
"(",
"aConcat",
".",
"call",
"(",
"[",
"]",
",",
"views",
")",
",",
"function",
"(",
"view",
")",
"{",
"// fire cleanup event to the attached handlers",
"view",
".",
"tri... | Accept either a single view or an array of views to clean of all DOM events internal model and collection references and all Backbone.Events. | [
"Accept",
"either",
"a",
"single",
"view",
"or",
"an",
"array",
"of",
"views",
"to",
"clean",
"of",
"all",
"DOM",
"events",
"internal",
"model",
"and",
"collection",
"references",
"and",
"all",
"Backbone",
".",
"Events",
"."
] | ba2a8ae3dc4c2519765cad3761cb59c7bb179312 | https://github.com/tbranyen/backbone.layoutmanager/blob/ba2a8ae3dc4c2519765cad3761cb59c7bb179312/backbone.layoutmanager.js#L809-L837 | |
17,098 | tbranyen/backbone.layoutmanager | backbone.layoutmanager.js | function(options) {
_.extend(LayoutManager.prototype, options);
// Allow LayoutManager to manage Backbone.View.prototype.
if (options.manage) {
Backbone.View.prototype.manage = true;
}
// Disable the element globally.
if (options.el === false) {
Backbone.View.prototype.el = false;
... | javascript | function(options) {
_.extend(LayoutManager.prototype, options);
// Allow LayoutManager to manage Backbone.View.prototype.
if (options.manage) {
Backbone.View.prototype.manage = true;
}
// Disable the element globally.
if (options.el === false) {
Backbone.View.prototype.el = false;
... | [
"function",
"(",
"options",
")",
"{",
"_",
".",
"extend",
"(",
"LayoutManager",
".",
"prototype",
",",
"options",
")",
";",
"// Allow LayoutManager to manage Backbone.View.prototype.",
"if",
"(",
"options",
".",
"manage",
")",
"{",
"Backbone",
".",
"View",
".",
... | This static method allows for global configuration of LayoutManager. | [
"This",
"static",
"method",
"allows",
"for",
"global",
"configuration",
"of",
"LayoutManager",
"."
] | ba2a8ae3dc4c2519765cad3761cb59c7bb179312 | https://github.com/tbranyen/backbone.layoutmanager/blob/ba2a8ae3dc4c2519765cad3761cb59c7bb179312/backbone.layoutmanager.js#L840-L867 | |
17,099 | tbranyen/backbone.layoutmanager | backbone.layoutmanager.js | function(views, options) {
// Ensure that options is always an object, and clone it so that
// changes to the original object don't screw up this view.
options = _.extend({}, options);
// Set up all Views passed.
_.each(aConcat.call([], views), function(view) {
// If the View has already been... | javascript | function(views, options) {
// Ensure that options is always an object, and clone it so that
// changes to the original object don't screw up this view.
options = _.extend({}, options);
// Set up all Views passed.
_.each(aConcat.call([], views), function(view) {
// If the View has already been... | [
"function",
"(",
"views",
",",
"options",
")",
"{",
"// Ensure that options is always an object, and clone it so that",
"// changes to the original object don't screw up this view.",
"options",
"=",
"_",
".",
"extend",
"(",
"{",
"}",
",",
"options",
")",
";",
"// Set up all... | Configure a View to work with the LayoutManager plugin. | [
"Configure",
"a",
"View",
"to",
"work",
"with",
"the",
"LayoutManager",
"plugin",
"."
] | ba2a8ae3dc4c2519765cad3761cb59c7bb179312 | https://github.com/tbranyen/backbone.layoutmanager/blob/ba2a8ae3dc4c2519765cad3761cb59c7bb179312/backbone.layoutmanager.js#L870-L949 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.