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
13,800
splunk/splunk-sdk-javascript
client/splunk.js
function(fieldName, sortAttribute, sortDirection, limit, statsFunction) { if (!this.dataModelObject.hasField(fieldName)) { throw new Error("Cannot add limit filter on a nonexistent field."); } var f = this.dataModelObject.fieldByName(fieldName); if (!uti...
javascript
function(fieldName, sortAttribute, sortDirection, limit, statsFunction) { if (!this.dataModelObject.hasField(fieldName)) { throw new Error("Cannot add limit filter on a nonexistent field."); } var f = this.dataModelObject.fieldByName(fieldName); if (!uti...
[ "function", "(", "fieldName", ",", "sortAttribute", ",", "sortDirection", ",", "limit", ",", "statsFunction", ")", "{", "if", "(", "!", "this", ".", "dataModelObject", ".", "hasField", "(", "fieldName", ")", ")", "{", "throw", "new", "Error", "(", "\"Canno...
Add a limit on the events shown in a pivot by sorting them according to some field, then taking the specified number from the beginning or end of the list. @param {String} fieldName The name of field to filter on. @param {String} sortAttribute The name of the field to use for sorting. @param {String} sortDirection The...
[ "Add", "a", "limit", "on", "the", "events", "shown", "in", "a", "pivot", "by", "sorting", "them", "according", "to", "some", "field", "then", "taking", "the", "specified", "number", "from", "the", "beginning", "or", "end", "of", "the", "list", "." ]
9aec5443860926654c2ab8ee3bf198a407c53b07
https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/client/splunk.js#L6739-L6779
13,801
splunk/splunk-sdk-javascript
client/splunk.js
function(fieldName, label) { if (!this.dataModelObject.hasField(fieldName)) { throw new Error("Did not find field " + fieldName); } var f = this.dataModelObject.fieldByName(fieldName); if (!utils.contains(["number", "string"], f.type)) { th...
javascript
function(fieldName, label) { if (!this.dataModelObject.hasField(fieldName)) { throw new Error("Did not find field " + fieldName); } var f = this.dataModelObject.fieldByName(fieldName); if (!utils.contains(["number", "string"], f.type)) { th...
[ "function", "(", "fieldName", ",", "label", ")", "{", "if", "(", "!", "this", ".", "dataModelObject", ".", "hasField", "(", "fieldName", ")", ")", "{", "throw", "new", "Error", "(", "\"Did not find field \"", "+", "fieldName", ")", ";", "}", "var", "f", ...
Add a row split on a numeric or string valued field, splitting on each distinct value of the field. @param {String} fieldName The name of field to split on. @param {String} label A human readable name for this set of rows. @return {splunkjs.Service.PivotSpecification} The updated pivot specification. @method splunkjs...
[ "Add", "a", "row", "split", "on", "a", "numeric", "or", "string", "valued", "field", "splitting", "on", "each", "distinct", "value", "of", "the", "field", "." ]
9aec5443860926654c2ab8ee3bf198a407c53b07
https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/client/splunk.js#L6790-L6813
13,802
splunk/splunk-sdk-javascript
client/splunk.js
function(field, label, ranges) { if (!this.dataModelObject.hasField(field)) { throw new Error("Did not find field " + field); } var f = this.dataModelObject.fieldByName(field); if ("number" !== f.type) { throw new Error("Field was of type "...
javascript
function(field, label, ranges) { if (!this.dataModelObject.hasField(field)) { throw new Error("Did not find field " + field); } var f = this.dataModelObject.fieldByName(field); if ("number" !== f.type) { throw new Error("Field was of type "...
[ "function", "(", "field", ",", "label", ",", "ranges", ")", "{", "if", "(", "!", "this", ".", "dataModelObject", ".", "hasField", "(", "field", ")", ")", "{", "throw", "new", "Error", "(", "\"Did not find field \"", "+", "field", ")", ";", "}", "var", ...
Add a row split on a numeric field, splitting into numeric ranges. This split generates bins with edges equivalent to the classic loop 'for i in <start> to <end> by <step>' but with a maximum number of bins <limit>. This dispatches to the stats and xyseries search commands. See their documentation for more details. @...
[ "Add", "a", "row", "split", "on", "a", "numeric", "field", "splitting", "into", "numeric", "ranges", "." ]
9aec5443860926654c2ab8ee3bf198a407c53b07
https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/client/splunk.js#L6834-L6866
13,803
splunk/splunk-sdk-javascript
client/splunk.js
function(field, label, trueDisplayValue, falseDisplayValue) { if (!this.dataModelObject.fieldByName(field)) { throw new Error("Did not find field " + field); } var f = this.dataModelObject.fieldByName(field); if ("boolean" !== f.type) { thr...
javascript
function(field, label, trueDisplayValue, falseDisplayValue) { if (!this.dataModelObject.fieldByName(field)) { throw new Error("Did not find field " + field); } var f = this.dataModelObject.fieldByName(field); if ("boolean" !== f.type) { thr...
[ "function", "(", "field", ",", "label", ",", "trueDisplayValue", ",", "falseDisplayValue", ")", "{", "if", "(", "!", "this", ".", "dataModelObject", ".", "fieldByName", "(", "field", ")", ")", "{", "throw", "new", "Error", "(", "\"Did not find field \"", "+"...
Add a row split on a boolean valued field. @param {String} fieldName The name of field to split on. @param {String} label A human readable name for this set of rows. @param {String} trueDisplayValue A string to display in the true valued row label. @param {String} falseDisplayValue A string to display in the false val...
[ "Add", "a", "row", "split", "on", "a", "boolean", "valued", "field", "." ]
9aec5443860926654c2ab8ee3bf198a407c53b07
https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/client/splunk.js#L6879-L6898
13,804
splunk/splunk-sdk-javascript
client/splunk.js
function(fieldName) { if (!this.dataModelObject.hasField(fieldName)) { throw new Error("Did not find field " + fieldName); } var f = this.dataModelObject.fieldByName(fieldName); if (!utils.contains(["number", "string"], f.type)) { throw new...
javascript
function(fieldName) { if (!this.dataModelObject.hasField(fieldName)) { throw new Error("Did not find field " + fieldName); } var f = this.dataModelObject.fieldByName(fieldName); if (!utils.contains(["number", "string"], f.type)) { throw new...
[ "function", "(", "fieldName", ")", "{", "if", "(", "!", "this", ".", "dataModelObject", ".", "hasField", "(", "fieldName", ")", ")", "{", "throw", "new", "Error", "(", "\"Did not find field \"", "+", "fieldName", ")", ";", "}", "var", "f", "=", "this", ...
Add a column split on a string or number valued field, producing a column for each distinct value of the field. @param {String} fieldName The name of field to split on. @return {splunkjs.Service.PivotSpecification} The updated pivot specification. @method splunkjs.Service.PivotSpecification
[ "Add", "a", "column", "split", "on", "a", "string", "or", "number", "valued", "field", "producing", "a", "column", "for", "each", "distinct", "value", "of", "the", "field", "." ]
9aec5443860926654c2ab8ee3bf198a407c53b07
https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/client/splunk.js#L6942-L6964
13,805
splunk/splunk-sdk-javascript
client/splunk.js
function(fieldName, ranges) { if (!this.dataModelObject.hasField(fieldName)) { throw new Error("Did not find field " + fieldName); } var f = this.dataModelObject.fieldByName(fieldName); if ("number" !== f.type) { throw new Error("Field was ...
javascript
function(fieldName, ranges) { if (!this.dataModelObject.hasField(fieldName)) { throw new Error("Did not find field " + fieldName); } var f = this.dataModelObject.fieldByName(fieldName); if ("number" !== f.type) { throw new Error("Field was ...
[ "function", "(", "fieldName", ",", "ranges", ")", "{", "if", "(", "!", "this", ".", "dataModelObject", ".", "hasField", "(", "fieldName", ")", ")", "{", "throw", "new", "Error", "(", "\"Did not find field \"", "+", "fieldName", ")", ";", "}", "var", "f",...
Add a column split on a numeric field, splitting the values into ranges. @param {String} fieldName The field to split on. @param {Object} options An optional dictionary of collection filtering and pagination options: - `start` (_integer_): The value of the start of the first range, or null to take the lowest value in ...
[ "Add", "a", "column", "split", "on", "a", "numeric", "field", "splitting", "the", "values", "into", "ranges", "." ]
9aec5443860926654c2ab8ee3bf198a407c53b07
https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/client/splunk.js#L6979-L7013
13,806
splunk/splunk-sdk-javascript
client/splunk.js
function(fieldName, trueDisplayValue, falseDisplayValue) { if (!this.dataModelObject.fieldByName(fieldName)) { throw new Error("Did not find field " + fieldName); } var f = this.dataModelObject.fieldByName(fieldName); if ("boolean" !== f.type) { ...
javascript
function(fieldName, trueDisplayValue, falseDisplayValue) { if (!this.dataModelObject.fieldByName(fieldName)) { throw new Error("Did not find field " + fieldName); } var f = this.dataModelObject.fieldByName(fieldName); if ("boolean" !== f.type) { ...
[ "function", "(", "fieldName", ",", "trueDisplayValue", ",", "falseDisplayValue", ")", "{", "if", "(", "!", "this", ".", "dataModelObject", ".", "fieldByName", "(", "fieldName", ")", ")", "{", "throw", "new", "Error", "(", "\"Did not find field \"", "+", "field...
Add a column split on a boolean valued field. @param {String} fieldName The name of field to split on. @param {String} trueDisplayValue A string to display in the true valued column label. @param {String} falseDisplayValue A string to display in the false valued column label. @return {splunkjs.Service.PivotSpecificati...
[ "Add", "a", "column", "split", "on", "a", "boolean", "valued", "field", "." ]
9aec5443860926654c2ab8ee3bf198a407c53b07
https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/client/splunk.js#L7025-L7043
13,807
splunk/splunk-sdk-javascript
client/splunk.js
function(field, binning) { if (!this.dataModelObject.hasField(field)) { throw new Error("Did not find field " + field); } var f = this.dataModelObject.fieldByName(field); if ("timestamp" !== f.type) { throw new Error("Field was of type " + ...
javascript
function(field, binning) { if (!this.dataModelObject.hasField(field)) { throw new Error("Did not find field " + field); } var f = this.dataModelObject.fieldByName(field); if ("timestamp" !== f.type) { throw new Error("Field was of type " + ...
[ "function", "(", "field", ",", "binning", ")", "{", "if", "(", "!", "this", ".", "dataModelObject", ".", "hasField", "(", "field", ")", ")", "{", "throw", "new", "Error", "(", "\"Did not find field \"", "+", "field", ")", ";", "}", "var", "f", "=", "...
Add a column split on a timestamp valued field, binned by the specified bucket size. @param {String} fieldName The name of field to split on. @param {String} binning The size of bins to use, see class docs for valid types. @return {splunkjs.Service.PivotSpecification} The updated pivot specification. @method splunkjs...
[ "Add", "a", "column", "split", "on", "a", "timestamp", "valued", "field", "binned", "by", "the", "specified", "bucket", "size", "." ]
9aec5443860926654c2ab8ee3bf198a407c53b07
https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/client/splunk.js#L7054-L7074
13,808
splunk/splunk-sdk-javascript
client/splunk.js
function(fieldName, label, statsFunction) { if (!this.dataModelObject.hasField(fieldName)) { throw new Error("Did not find field " + fieldName); } var f = this.dataModelObject.fieldByName(fieldName); if (utils.contains(["string", "ipv4"], f.type) && ...
javascript
function(fieldName, label, statsFunction) { if (!this.dataModelObject.hasField(fieldName)) { throw new Error("Did not find field " + fieldName); } var f = this.dataModelObject.fieldByName(fieldName); if (utils.contains(["string", "ipv4"], f.type) && ...
[ "function", "(", "fieldName", ",", "label", ",", "statsFunction", ")", "{", "if", "(", "!", "this", ".", "dataModelObject", ".", "hasField", "(", "fieldName", ")", ")", "{", "throw", "new", "Error", "(", "\"Did not find field \"", "+", "fieldName", ")", ";...
Add an aggregate to each cell of the pivot. @param {String} fieldName The name of field to aggregate. @param {String} label a human readable name for this aggregate. @param {String} statsFunction The function to use for aggregation, see class docs for valid stats functions. @return {splunkjs.Service.PivotSpecification...
[ "Add", "an", "aggregate", "to", "each", "cell", "of", "the", "pivot", "." ]
9aec5443860926654c2ab8ee3bf198a407c53b07
https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/client/splunk.js#L7086-L7156
13,809
splunk/splunk-sdk-javascript
client/splunk.js
function() { return { dataModel: this.dataModelObject.dataModel.name, baseClass: this.dataModelObject.name, rows: this.rows, columns: this.columns, cells: this.cells, filters: this.filters }; ...
javascript
function() { return { dataModel: this.dataModelObject.dataModel.name, baseClass: this.dataModelObject.name, rows: this.rows, columns: this.columns, cells: this.cells, filters: this.filters }; ...
[ "function", "(", ")", "{", "return", "{", "dataModel", ":", "this", ".", "dataModelObject", ".", "dataModel", ".", "name", ",", "baseClass", ":", "this", ".", "dataModelObject", ".", "name", ",", "rows", ":", "this", ".", "rows", ",", "columns", ":", "...
Returns a JSON ready object representation of this pivot specification. @return {Object} The JSON ready object representation of this pivot specification. @method splunkjs.Service.PivotSpecification
[ "Returns", "a", "JSON", "ready", "object", "representation", "of", "this", "pivot", "specification", "." ]
9aec5443860926654c2ab8ee3bf198a407c53b07
https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/client/splunk.js#L7165-L7174
13,810
splunk/splunk-sdk-javascript
client/splunk.js
function(callback) { var svc = this.dataModelObject.dataModel.service; var args = { pivot_json: JSON.stringify(this.toJsonObject()) }; if (!utils.isUndefined(this.accelerationNamespace)) { args.namespace = this.accelerationNamespace; ...
javascript
function(callback) { var svc = this.dataModelObject.dataModel.service; var args = { pivot_json: JSON.stringify(this.toJsonObject()) }; if (!utils.isUndefined(this.accelerationNamespace)) { args.namespace = this.accelerationNamespace; ...
[ "function", "(", "callback", ")", "{", "var", "svc", "=", "this", ".", "dataModelObject", ".", "dataModel", ".", "service", ";", "var", "args", "=", "{", "pivot_json", ":", "JSON", ".", "stringify", "(", "this", ".", "toJsonObject", "(", ")", ")", "}",...
Query Splunk for SPL queries corresponding to a pivot report for this data model, defined by this `PivotSpecification`. @example service.dataModels().fetch(function(err, dataModels) { var searches = dataModels.item("internal_audit_logs").objectByName("searches"); var pivotSpec = searches.createPivotSpecification(); /...
[ "Query", "Splunk", "for", "SPL", "queries", "corresponding", "to", "a", "pivot", "report", "for", "this", "data", "model", "defined", "by", "this", "PivotSpecification", "." ]
9aec5443860926654c2ab8ee3bf198a407c53b07
https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/client/splunk.js#L7198-L7222
13,811
splunk/splunk-sdk-javascript
client/splunk.js
function(props, parentDataModel) { props = props || {}; props.owner = props.owner || ""; this.dataModel = parentDataModel; this.name = props.objectName; this.displayName = props.displayName; this.parentNam...
javascript
function(props, parentDataModel) { props = props || {}; props.owner = props.owner || ""; this.dataModel = parentDataModel; this.name = props.objectName; this.displayName = props.displayName; this.parentNam...
[ "function", "(", "props", ",", "parentDataModel", ")", "{", "props", "=", "props", "||", "{", "}", ";", "props", ".", "owner", "=", "props", ".", "owner", "||", "\"\"", ";", "this", ".", "dataModel", "=", "parentDataModel", ";", "this", ".", "name", ...
Constructor for a data model object. SDK users are not expected to invoke this constructor directly. @constructor @param {Object} props A dictionary of properties to set: - `objectName` (_string_): The name for this data model object. - `displayName` (_string_): A human readable name for this data model object. - `par...
[ "Constructor", "for", "a", "data", "model", "object", ".", "SDK", "users", "are", "not", "expected", "to", "invoke", "this", "constructor", "directly", "." ]
9aec5443860926654c2ab8ee3bf198a407c53b07
https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/client/splunk.js#L7321-L7367
13,812
splunk/splunk-sdk-javascript
client/splunk.js
function() { // merge fields and calculatedFields() var combinedFields = []; for (var f in this.fields) { if (this.fields.hasOwnProperty(f)) { combinedFields[f] = this.fields[f]; } } var calculatedFields = ...
javascript
function() { // merge fields and calculatedFields() var combinedFields = []; for (var f in this.fields) { if (this.fields.hasOwnProperty(f)) { combinedFields[f] = this.fields[f]; } } var calculatedFields = ...
[ "function", "(", ")", "{", "// merge fields and calculatedFields()", "var", "combinedFields", "=", "[", "]", ";", "for", "(", "var", "f", "in", "this", ".", "fields", ")", "{", "if", "(", "this", ".", "fields", ".", "hasOwnProperty", "(", "f", ")", ")", ...
Returns an array of data model fields from this data model object's calculations, and this data model object's fields. @return {Array} An array of `splunk.Service.DataModelField` objects which includes this data model object's fields, and the fields from this data model object's calculations. @method splunkjs.Service...
[ "Returns", "an", "array", "of", "data", "model", "fields", "from", "this", "data", "model", "object", "s", "calculations", "and", "this", "data", "model", "object", "s", "fields", "." ]
9aec5443860926654c2ab8ee3bf198a407c53b07
https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/client/splunk.js#L7427-L7445
13,813
splunk/splunk-sdk-javascript
client/splunk.js
function(){ var fields = {}; // Iterate over the calculations, get their fields var keys = this.calculationIDs(); var calculations = this.calculations; for (var i = 0; i < keys.length; i++) { var calculation = calculations[keys[i]]; ...
javascript
function(){ var fields = {}; // Iterate over the calculations, get their fields var keys = this.calculationIDs(); var calculations = this.calculations; for (var i = 0; i < keys.length; i++) { var calculation = calculations[keys[i]]; ...
[ "function", "(", ")", "{", "var", "fields", "=", "{", "}", ";", "// Iterate over the calculations, get their fields", "var", "keys", "=", "this", ".", "calculationIDs", "(", ")", ";", "var", "calculations", "=", "this", ".", "calculations", ";", "for", "(", ...
Returns an array of data model fields from this data model object's calculations. @return {Array} An array of `splunk.Service.DataModelField` objects of the fields from this data model object's calculations. @method splunkjs.Service.DataModelObject
[ "Returns", "an", "array", "of", "data", "model", "fields", "from", "this", "data", "model", "object", "s", "calculations", "." ]
9aec5443860926654c2ab8ee3bf198a407c53b07
https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/client/splunk.js#L7470-L7482
13,814
splunk/splunk-sdk-javascript
client/splunk.js
function(earliestTime, callback) { // If earliestTime parameter is not specified, then set callback to its value if (!callback && utils.isFunction(earliestTime)) { callback = earliestTime; earliestTime = undefined; } var query = "| datamod...
javascript
function(earliestTime, callback) { // If earliestTime parameter is not specified, then set callback to its value if (!callback && utils.isFunction(earliestTime)) { callback = earliestTime; earliestTime = undefined; } var query = "| datamod...
[ "function", "(", "earliestTime", ",", "callback", ")", "{", "// If earliestTime parameter is not specified, then set callback to its value", "if", "(", "!", "callback", "&&", "utils", ".", "isFunction", "(", "earliestTime", ")", ")", "{", "callback", "=", "earliestTime"...
Local acceleration is tsidx acceleration of a data model object that is handled manually by a user. You create a job which generates an index, and then use that index in your pivots on the data model object. The namespace created by the job is 'sid={sid}' where {sid} is the job's sid. You would use it in another job b...
[ "Local", "acceleration", "is", "tsidx", "acceleration", "of", "a", "data", "model", "object", "that", "is", "handled", "manually", "by", "a", "user", ".", "You", "create", "a", "job", "which", "generates", "an", "index", "and", "then", "use", "that", "inde...
9aec5443860926654c2ab8ee3bf198a407c53b07
https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/client/splunk.js#L7549-L7560
13,815
splunk/splunk-sdk-javascript
client/splunk.js
function(params, querySuffix, callback) { var query = "| datamodel " + this.dataModel.name + " " + this.name + " search"; // Prepend a space to the querySuffix, or set it to an empty string if null or undefined querySuffix = (querySuffix) ? (" " + querySuffix) : (""); thi...
javascript
function(params, querySuffix, callback) { var query = "| datamodel " + this.dataModel.name + " " + this.name + " search"; // Prepend a space to the querySuffix, or set it to an empty string if null or undefined querySuffix = (querySuffix) ? (" " + querySuffix) : (""); thi...
[ "function", "(", "params", ",", "querySuffix", ",", "callback", ")", "{", "var", "query", "=", "\"| datamodel \"", "+", "this", ".", "dataModel", ".", "name", "+", "\" \"", "+", "this", ".", "name", "+", "\" search\"", ";", "// Prepend a space to the querySuff...
Start a search job that applies querySuffix to all the events in this data model object. @example service.dataModels().fetch(function(err, dataModels) { var object = dataModels.item("internal_audit_logs").objectByName("searches"); object.startSearch({}, "| head 5", function(err, job) { console.log("The job has name:"...
[ "Start", "a", "search", "job", "that", "applies", "querySuffix", "to", "all", "the", "events", "in", "this", "data", "model", "object", "." ]
9aec5443860926654c2ab8ee3bf198a407c53b07
https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/client/splunk.js#L7581-L7586
13,816
splunk/splunk-sdk-javascript
client/splunk.js
function(name) { for (var i = 0; i < this.objects.length; i++) { if (this.objects[i].name === name) { return this.objects[i]; } } return null; }
javascript
function(name) { for (var i = 0; i < this.objects.length; i++) { if (this.objects[i].name === name) { return this.objects[i]; } } return null; }
[ "function", "(", "name", ")", "{", "for", "(", "var", "i", "=", "0", ";", "i", "<", "this", ".", "objects", ".", "length", ";", "i", "++", ")", "{", "if", "(", "this", ".", "objects", "[", "i", "]", ".", "name", "===", "name", ")", "{", "re...
Returns a data model object from this data model with the specified name if it exists, null otherwise. @return {Object|null} a data model object. @method splunkjs.Service.DataModel
[ "Returns", "a", "data", "model", "object", "from", "this", "data", "model", "with", "the", "specified", "name", "if", "it", "exists", "null", "otherwise", "." ]
9aec5443860926654c2ab8ee3bf198a407c53b07
https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/client/splunk.js#L7709-L7716
13,817
splunk/splunk-sdk-javascript
client/splunk.js
function(props, callback) { if (utils.isUndefined(callback)) { callback = props; props = {}; } callback = callback || function() {}; if (!props) { callback(new Error("Must specify a props argument to update a data model."))...
javascript
function(props, callback) { if (utils.isUndefined(callback)) { callback = props; props = {}; } callback = callback || function() {}; if (!props) { callback(new Error("Must specify a props argument to update a data model."))...
[ "function", "(", "props", ",", "callback", ")", "{", "if", "(", "utils", ".", "isUndefined", "(", "callback", ")", ")", "{", "callback", "=", "props", ";", "props", "=", "{", "}", ";", "}", "callback", "=", "callback", "||", "function", "(", ")", "...
Updates the data model on the server, used to update acceleration settings. @param {Object} props A dictionary of properties to update the object with: - `acceleration` (_object_): The acceleration settings for the data model. Valid keys are: `enabled`, `earliestTime`, `cronSchedule`. Any keys not set will be pulled f...
[ "Updates", "the", "data", "model", "on", "the", "server", "used", "to", "update", "acceleration", "settings", "." ]
9aec5443860926654c2ab8ee3bf198a407c53b07
https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/client/splunk.js#L7741-L7775
13,818
splunk/splunk-sdk-javascript
client/splunk.js
function(service, namespace) { namespace = namespace || {}; this._super(service, this.path(), namespace); this.create = utils.bind(this, this.create); }
javascript
function(service, namespace) { namespace = namespace || {}; this._super(service, this.path(), namespace); this.create = utils.bind(this, this.create); }
[ "function", "(", "service", ",", "namespace", ")", "{", "namespace", "=", "namespace", "||", "{", "}", ";", "this", ".", "_super", "(", "service", ",", "this", ".", "path", "(", ")", ",", "namespace", ")", ";", "this", ".", "create", "=", "utils", ...
Constructor for `splunkjs.Service.DataModels`. @constructor @param {splunkjs.Service} service A `Service` instance. @param {Object} namespace (Optional) namespace information: - `owner` (_string_): The Splunk username, such as "admin". A value of "nobody" means no specific user. The "-" wildcard means all users. - `ap...
[ "Constructor", "for", "splunkjs", ".", "Service", ".", "DataModels", "." ]
9aec5443860926654c2ab8ee3bf198a407c53b07
https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/client/splunk.js#L7809-L7813
13,819
splunk/splunk-sdk-javascript
client/splunk.js
function(name, params, callback) { // If we get (name, callback) instead of (name, params, callback) // do the necessary variable swap if (utils.isFunction(params) && !callback) { callback = params; params = {}; } params = para...
javascript
function(name, params, callback) { // If we get (name, callback) instead of (name, params, callback) // do the necessary variable swap if (utils.isFunction(params) && !callback) { callback = params; params = {}; } params = para...
[ "function", "(", "name", ",", "params", ",", "callback", ")", "{", "// If we get (name, callback) instead of (name, params, callback)", "// do the necessary variable swap", "if", "(", "utils", ".", "isFunction", "(", "params", ")", "&&", "!", "callback", ")", "{", "ca...
Creates a new `DataModel` object with the given name and parameters. It is preferred that you create data models through the Splunk Enterprise with a browser. @param {String} name The name of the data model to create. If it contains spaces they will be replaced with underscores. @param {Object} params A dictionary of ...
[ "Creates", "a", "new", "DataModel", "object", "with", "the", "given", "name", "and", "parameters", ".", "It", "is", "preferred", "that", "you", "create", "data", "models", "through", "the", "Splunk", "Enterprise", "with", "a", "browser", "." ]
9aec5443860926654c2ab8ee3bf198a407c53b07
https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/client/splunk.js#L7827-L7849
13,820
splunk/splunk-sdk-javascript
client/splunk.js
function(callback) { callback = callback || function() {}; var that = this; var params = { count: this._pagesize, offset: this._offset }; return this._endpoint(params, function(err, results) { if (er...
javascript
function(callback) { callback = callback || function() {}; var that = this; var params = { count: this._pagesize, offset: this._offset }; return this._endpoint(params, function(err, results) { if (er...
[ "function", "(", "callback", ")", "{", "callback", "=", "callback", "||", "function", "(", ")", "{", "}", ";", "var", "that", "=", "this", ";", "var", "params", "=", "{", "count", ":", "this", ".", "_pagesize", ",", "offset", ":", "this", ".", "_of...
Fetches the next page from the endpoint.
[ "Fetches", "the", "next", "page", "from", "the", "endpoint", "." ]
9aec5443860926654c2ab8ee3bf198a407c53b07
https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/client/splunk.js#L7879-L7898
13,821
splunk/splunk-sdk-javascript
client/splunk.js
EventWriter
function EventWriter(output, error) { this._out = utils.isUndefined(output) ? process.stdout : output; this._err = utils.isUndefined(error) ? process.stderr : error; // Has the opening <stream> tag been written yet? this._headerWritten = false; }
javascript
function EventWriter(output, error) { this._out = utils.isUndefined(output) ? process.stdout : output; this._err = utils.isUndefined(error) ? process.stderr : error; // Has the opening <stream> tag been written yet? this._headerWritten = false; }
[ "function", "EventWriter", "(", "output", ",", "error", ")", "{", "this", ".", "_out", "=", "utils", ".", "isUndefined", "(", "output", ")", "?", "process", ".", "stdout", ":", "output", ";", "this", ".", "_err", "=", "utils", ".", "isUndefined", "(", ...
`EventWriter` writes events and error messages to Splunk from a modular input. Its two important methods are `writeEvent`, which takes an `Event` object, and `log`, which takes a severity and an error message. @param {Object} output A stream to output data, defaults to `process.stdout` @param {Object} error A stream ...
[ "EventWriter", "writes", "events", "and", "error", "messages", "to", "Splunk", "from", "a", "modular", "input", "." ]
9aec5443860926654c2ab8ee3bf198a407c53b07
https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/client/splunk.js#L12034-L12040
13,822
splunk/splunk-sdk-javascript
client/splunk.js
Scheme
function Scheme(title) { this.title = utils.isUndefined(title) ? "" : title; // Set the defaults. this.description = null; this.useExternalValidation = true; this.useSingleInstance = false; this.streamingMode = Scheme.streamingModeXML; // List of Argument object...
javascript
function Scheme(title) { this.title = utils.isUndefined(title) ? "" : title; // Set the defaults. this.description = null; this.useExternalValidation = true; this.useSingleInstance = false; this.streamingMode = Scheme.streamingModeXML; // List of Argument object...
[ "function", "Scheme", "(", "title", ")", "{", "this", ".", "title", "=", "utils", ".", "isUndefined", "(", "title", ")", "?", "\"\"", ":", "title", ";", "// Set the defaults.", "this", ".", "description", "=", "null", ";", "this", ".", "useExternalValidati...
Class representing the metadata for a modular input kind. A `Scheme` specifies a title, description, several options of how Splunk should run modular inputs of this kind, and a set of arguments that define a particular modular input's properties. The primary use of `Scheme` is to abstract away the construction of XML ...
[ "Class", "representing", "the", "metadata", "for", "a", "modular", "input", "kind", "." ]
9aec5443860926654c2ab8ee3bf198a407c53b07
https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/client/splunk.js#L12388-L12399
13,823
splunk/splunk-sdk-javascript
client/splunk.js
stringifyArray
function stringifyArray(arr, prefix) { var ret = []; if (!prefix) throw new TypeError('stringify expects an object'); for (var i = 0; i < arr.length; i++) { ret.push(stringify(arr[i], prefix + '[]')); } return ret.join('&'); }
javascript
function stringifyArray(arr, prefix) { var ret = []; if (!prefix) throw new TypeError('stringify expects an object'); for (var i = 0; i < arr.length; i++) { ret.push(stringify(arr[i], prefix + '[]')); } return ret.join('&'); }
[ "function", "stringifyArray", "(", "arr", ",", "prefix", ")", "{", "var", "ret", "=", "[", "]", ";", "if", "(", "!", "prefix", ")", "throw", "new", "TypeError", "(", "'stringify expects an object'", ")", ";", "for", "(", "var", "i", "=", "0", ";", "i...
Stringify the given `arr`. @param {Array} arr @param {String} prefix @return {String} @api private
[ "Stringify", "the", "given", "arr", "." ]
9aec5443860926654c2ab8ee3bf198a407c53b07
https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/client/splunk.js#L13533-L13540
13,824
splunk/splunk-sdk-javascript
client/splunk.js
lastBraceInKey
function lastBraceInKey(str) { var len = str.length , brace , c; for (var i = 0; i < len; ++i) { c = str[i]; if (']' == c) brace = false; if ('[' == c) brace = true; if ('=' == c && !brace) return i; } }
javascript
function lastBraceInKey(str) { var len = str.length , brace , c; for (var i = 0; i < len; ++i) { c = str[i]; if (']' == c) brace = false; if ('[' == c) brace = true; if ('=' == c && !brace) return i; } }
[ "function", "lastBraceInKey", "(", "str", ")", "{", "var", "len", "=", "str", ".", "length", ",", "brace", ",", "c", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "len", ";", "++", "i", ")", "{", "c", "=", "str", "[", "i", "]", ";",...
Locate last brace in `str` within the key. @param {String} str @return {Number} @api private
[ "Locate", "last", "brace", "in", "str", "within", "the", "key", "." ]
9aec5443860926654c2ab8ee3bf198a407c53b07
https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/client/splunk.js#L13594-L13604
13,825
splunk/splunk-sdk-javascript
examples/browser/minisplunk/jquery.fn.gmap.js
function(a, b) { c = this; if (!b) { return c.options[a]; } else { c._u(a, b); } }
javascript
function(a, b) { c = this; if (!b) { return c.options[a]; } else { c._u(a, b); } }
[ "function", "(", "a", ",", "b", ")", "{", "c", "=", "this", ";", "if", "(", "!", "b", ")", "{", "return", "c", ".", "options", "[", "a", "]", ";", "}", "else", "{", "c", ".", "_u", "(", "a", ",", "b", ")", ";", "}", "}" ]
Get or set options @param key:string @param options:object
[ "Get", "or", "set", "options" ]
9aec5443860926654c2ab8ee3bf198a407c53b07
https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/examples/browser/minisplunk/jquery.fn.gmap.js#L52-L59
13,826
splunk/splunk-sdk-javascript
examples/browser/minisplunk/jquery.fn.gmap.js
function( a, b ) { this.id = b.attr('id'); this.instances = []; this.element = b; this.options = jQuery.extend(this.options, a); this._create(); if ( this._init ) { this._init(); } }
javascript
function( a, b ) { this.id = b.attr('id'); this.instances = []; this.element = b; this.options = jQuery.extend(this.options, a); this._create(); if ( this._init ) { this._init(); } }
[ "function", "(", "a", ",", "b", ")", "{", "this", ".", "id", "=", "b", ".", "attr", "(", "'id'", ")", ";", "this", ".", "instances", "=", "[", "]", ";", "this", ".", "element", "=", "b", ";", "this", ".", "options", "=", "jQuery", ".", "exten...
Setup plugin basics, Set the jQuery UI Widget this.element, so extensions will work on both plugins
[ "Setup", "plugin", "basics", "Set", "the", "jQuery", "UI", "Widget", "this", ".", "element", "so", "extensions", "will", "work", "on", "both", "plugins" ]
9aec5443860926654c2ab8ee3bf198a407c53b07
https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/examples/browser/minisplunk/jquery.fn.gmap.js#L65-L74
13,827
splunk/splunk-sdk-javascript
examples/browser/minisplunk/jquery.fn.gmap.js
function(a, b) { var map = this.get('map'); jQuery.extend(this.options, { 'center': map.getCenter(), 'mapTypeId': map.getMapTypeId(), 'zoom': map.getZoom() } ); if (a && b) { this.options[a] = b; } map.setOptions(this.options); // ...
javascript
function(a, b) { var map = this.get('map'); jQuery.extend(this.options, { 'center': map.getCenter(), 'mapTypeId': map.getMapTypeId(), 'zoom': map.getZoom() } ); if (a && b) { this.options[a] = b; } map.setOptions(this.options); // ...
[ "function", "(", "a", ",", "b", ")", "{", "var", "map", "=", "this", ".", "get", "(", "'map'", ")", ";", "jQuery", ".", "extend", "(", "this", ".", "options", ",", "{", "'center'", ":", "map", ".", "getCenter", "(", ")", ",", "'mapTypeId'", ":", ...
Set map options @param key:string (optional) @param value:object (optional)
[ "Set", "map", "options" ]
9aec5443860926654c2ab8ee3bf198a407c53b07
https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/examples/browser/minisplunk/jquery.fn.gmap.js#L97-L111
13,828
splunk/splunk-sdk-javascript
examples/browser/minisplunk/jquery.fn.gmap.js
function(a) { this.get('bounds', new google.maps.LatLngBounds()).extend(this._latLng(a)); this.get('map').fitBounds(this.get('bounds')); }
javascript
function(a) { this.get('bounds', new google.maps.LatLngBounds()).extend(this._latLng(a)); this.get('map').fitBounds(this.get('bounds')); }
[ "function", "(", "a", ")", "{", "this", ".", "get", "(", "'bounds'", ",", "new", "google", ".", "maps", ".", "LatLngBounds", "(", ")", ")", ".", "extend", "(", "this", ".", "_latLng", "(", "a", ")", ")", ";", "this", ".", "get", "(", "'map'", "...
Adds a latitude longitude pair to the bounds. @param position:google.maps.LatLng/string
[ "Adds", "a", "latitude", "longitude", "pair", "to", "the", "bounds", "." ]
9aec5443860926654c2ab8ee3bf198a407c53b07
https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/examples/browser/minisplunk/jquery.fn.gmap.js#L117-L120
13,829
splunk/splunk-sdk-javascript
examples/browser/minisplunk/jquery.fn.gmap.js
function(a, b, c) { var d = this.get('map'); var c = c || google.maps.Marker; a.position = (a.position) ? this._latLng(a.position) : null; var e = new c( jQuery.extend({'map': d, 'bounds': false}, a) ); var f = this.get('markers', []); if ( e.id ) ...
javascript
function(a, b, c) { var d = this.get('map'); var c = c || google.maps.Marker; a.position = (a.position) ? this._latLng(a.position) : null; var e = new c( jQuery.extend({'map': d, 'bounds': false}, a) ); var f = this.get('markers', []); if ( e.id ) ...
[ "function", "(", "a", ",", "b", ",", "c", ")", "{", "var", "d", "=", "this", ".", "get", "(", "'map'", ")", ";", "var", "c", "=", "c", "||", "google", ".", "maps", ".", "Marker", ";", "a", ".", "position", "=", "(", "a", ".", "position", ")...
Adds a Marker to the map @param markerOptions:google.maps.MarkerOptions (optional) @param callback:function(map:google.maps.Map, marker:google.maps.Marker) (optional) @param marker:function (optional) @return $(google.maps.Marker) @see http://code.google.com/intl/sv-SE/apis/maps/documentation/javascript/reference.html#...
[ "Adds", "a", "Marker", "to", "the", "map" ]
9aec5443860926654c2ab8ee3bf198a407c53b07
https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/examples/browser/minisplunk/jquery.fn.gmap.js#L140-L156
13,830
splunk/splunk-sdk-javascript
examples/browser/minisplunk/jquery.fn.gmap.js
function(a, b) { var c = new google.maps.InfoWindow(a); this._call(b, c); return $(c); }
javascript
function(a, b) { var c = new google.maps.InfoWindow(a); this._call(b, c); return $(c); }
[ "function", "(", "a", ",", "b", ")", "{", "var", "c", "=", "new", "google", ".", "maps", ".", "InfoWindow", "(", "a", ")", ";", "this", ".", "_call", "(", "b", ",", "c", ")", ";", "return", "$", "(", "c", ")", ";", "}" ]
Adds an InfoWindow to the map @param infoWindowOptions:google.maps.InfoWindowOptions (optional) @param callback:function(InfoWindow:google.maps.InfoWindowOptions) (optional) @return $(google.maps.InfoWindowOptions) @see http://code.google.com/intl/sv-SE/apis/maps/documentation/javascript/reference.html#InfoWindowOption...
[ "Adds", "an", "InfoWindow", "to", "the", "map" ]
9aec5443860926654c2ab8ee3bf198a407c53b07
https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/examples/browser/minisplunk/jquery.fn.gmap.js#L165-L169
13,831
splunk/splunk-sdk-javascript
examples/browser/minisplunk/jquery.fn.gmap.js
function(a, b) { var c = this.instances[this.id]; if (!c[a]) { if ( a.indexOf('>') > -1 ) { var e = a.replace(/ /g, '').split('>'); for ( var i = 0; i < e.length; i++ ) { if ( !c[e[i]] ) { ...
javascript
function(a, b) { var c = this.instances[this.id]; if (!c[a]) { if ( a.indexOf('>') > -1 ) { var e = a.replace(/ /g, '').split('>'); for ( var i = 0; i < e.length; i++ ) { if ( !c[e[i]] ) { ...
[ "function", "(", "a", ",", "b", ")", "{", "var", "c", "=", "this", ".", "instances", "[", "this", ".", "id", "]", ";", "if", "(", "!", "c", "[", "a", "]", ")", "{", "if", "(", "a", ".", "indexOf", "(", "'>'", ")", ">", "-", "1", ")", "{...
Returns an instance property by key. Has the ability to set an object if the property does not exist @param key:string @param value:object(optional)
[ "Returns", "an", "instance", "property", "by", "key", ".", "Has", "the", "ability", "to", "set", "an", "object", "if", "the", "property", "does", "not", "exist" ]
9aec5443860926654c2ab8ee3bf198a407c53b07
https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/examples/browser/minisplunk/jquery.fn.gmap.js#L212-L233
13,832
splunk/splunk-sdk-javascript
examples/browser/minisplunk/jquery.fn.gmap.js
function(a, b) { this.get('iw', new google.maps.InfoWindow).setOptions(a); this.get('iw').open(this.get('map'), this._unwrap(b)); }
javascript
function(a, b) { this.get('iw', new google.maps.InfoWindow).setOptions(a); this.get('iw').open(this.get('map'), this._unwrap(b)); }
[ "function", "(", "a", ",", "b", ")", "{", "this", ".", "get", "(", "'iw'", ",", "new", "google", ".", "maps", ".", "InfoWindow", ")", ".", "setOptions", "(", "a", ")", ";", "this", ".", "get", "(", "'iw'", ")", ".", "open", "(", "this", ".", ...
Triggers an InfoWindow to open @param infoWindowOptions:google.maps.InfoWindowOptions @param marker:google.maps.Marker (optional) @see http://code.google.com/intl/sv-SE/apis/maps/documentation/javascript/reference.html#InfoWindowOptions
[ "Triggers", "an", "InfoWindow", "to", "open" ]
9aec5443860926654c2ab8ee3bf198a407c53b07
https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/examples/browser/minisplunk/jquery.fn.gmap.js#L241-L244
13,833
splunk/splunk-sdk-javascript
examples/browser/minisplunk/jquery.fn.gmap.js
function() { this.clear('markers'); this.clear('services'); this.clear('overlays'); var a = this.instances[this.id]; for ( b in a ) { a[b] = null; } }
javascript
function() { this.clear('markers'); this.clear('services'); this.clear('overlays'); var a = this.instances[this.id]; for ( b in a ) { a[b] = null; } }
[ "function", "(", ")", "{", "this", ".", "clear", "(", "'markers'", ")", ";", "this", ".", "clear", "(", "'services'", ")", ";", "this", ".", "clear", "(", "'overlays'", ")", ";", "var", "a", "=", "this", ".", "instances", "[", "this", ".", "id", ...
Destroys the plugin.
[ "Destroys", "the", "plugin", "." ]
9aec5443860926654c2ab8ee3bf198a407c53b07
https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/examples/browser/minisplunk/jquery.fn.gmap.js#L266-L274
13,834
splunk/splunk-sdk-javascript
examples/browser/minisplunk/jquery.fn.gmap.js
function(a) { if ( $.isFunction(a) ) { a.apply(this, Array.prototype.slice.call(arguments, 1)); } }
javascript
function(a) { if ( $.isFunction(a) ) { a.apply(this, Array.prototype.slice.call(arguments, 1)); } }
[ "function", "(", "a", ")", "{", "if", "(", "$", ".", "isFunction", "(", "a", ")", ")", "{", "a", ".", "apply", "(", "this", ",", "Array", ".", "prototype", ".", "slice", ".", "call", "(", "arguments", ",", "1", ")", ")", ";", "}", "}" ]
Helper method for calling a function @param callback
[ "Helper", "method", "for", "calling", "a", "function" ]
9aec5443860926654c2ab8ee3bf198a407c53b07
https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/examples/browser/minisplunk/jquery.fn.gmap.js#L280-L284
13,835
splunk/splunk-sdk-javascript
examples/browser/minisplunk/jquery.fn.gmap.js
function(a) { if ( a instanceof google.maps.LatLng ) { return a; } else { var b = a.replace(/ /g,'').split(','); return new google.maps.LatLng(b[0], b[1]); } }
javascript
function(a) { if ( a instanceof google.maps.LatLng ) { return a; } else { var b = a.replace(/ /g,'').split(','); return new google.maps.LatLng(b[0], b[1]); } }
[ "function", "(", "a", ")", "{", "if", "(", "a", "instanceof", "google", ".", "maps", ".", "LatLng", ")", "{", "return", "a", ";", "}", "else", "{", "var", "b", "=", "a", ".", "replace", "(", "/", " ", "/", "g", ",", "''", ")", ".", "split", ...
Helper method for google.maps.Latlng @param callback
[ "Helper", "method", "for", "google", ".", "maps", ".", "Latlng" ]
9aec5443860926654c2ab8ee3bf198a407c53b07
https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/examples/browser/minisplunk/jquery.fn.gmap.js#L290-L297
13,836
splunk/splunk-sdk-javascript
bin/cli.js
function(sourceDir, newDirLocation, opts) { if (!opts || !opts.preserve) { try { if(fs.statSync(newDirLocation).isDirectory()) { exports.rmdirSyncRecursive(newDirLocation); } } catch(e) { } } /* Create the...
javascript
function(sourceDir, newDirLocation, opts) { if (!opts || !opts.preserve) { try { if(fs.statSync(newDirLocation).isDirectory()) { exports.rmdirSyncRecursive(newDirLocation); } } catch(e) { } } /* Create the...
[ "function", "(", "sourceDir", ",", "newDirLocation", ",", "opts", ")", "{", "if", "(", "!", "opts", "||", "!", "opts", ".", "preserve", ")", "{", "try", "{", "if", "(", "fs", ".", "statSync", "(", "newDirLocation", ")", ".", "isDirectory", "(", ")", ...
Taken from wrench.js
[ "Taken", "from", "wrench", ".", "js" ]
9aec5443860926654c2ab8ee3bf198a407c53b07
https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/bin/cli.js#L208-L250
13,837
splunk/splunk-sdk-javascript
examples/node/search.js
function(job, done) { Async.whilst( function() { return !job.properties().isDone; }, function(iterationDone) { job.fetch(function(err, job) { if (err) { cal...
javascript
function(job, done) { Async.whilst( function() { return !job.properties().isDone; }, function(iterationDone) { job.fetch(function(err, job) { if (err) { cal...
[ "function", "(", "job", ",", "done", ")", "{", "Async", ".", "whilst", "(", "function", "(", ")", "{", "return", "!", "job", ".", "properties", "(", ")", ".", "isDone", ";", "}", ",", "function", "(", "iterationDone", ")", "{", "job", ".", "fetch",...
Poll until the search is complete
[ "Poll", "until", "the", "search", "is", "complete" ]
9aec5443860926654c2ab8ee3bf198a407c53b07
https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/examples/node/search.js#L62-L98
13,838
splunk/splunk-sdk-javascript
examples/node/results.js
function(results) { for(var i = 0; i < results.rows.length; i++) { console.log("Result " + (i + 1) + ": "); var row = results.rows[i]; for(var j = 0; j < results.fields.length; j++) { var field = results.fields[j]; var value = row[j]; ...
javascript
function(results) { for(var i = 0; i < results.rows.length; i++) { console.log("Result " + (i + 1) + ": "); var row = results.rows[i]; for(var j = 0; j < results.fields.length; j++) { var field = results.fields[j]; var value = row[j]; ...
[ "function", "(", "results", ")", "{", "for", "(", "var", "i", "=", "0", ";", "i", "<", "results", ".", "rows", ".", "length", ";", "i", "++", ")", "{", "console", ".", "log", "(", "\"Result \"", "+", "(", "i", "+", "1", ")", "+", "\": \"", ")...
Print the result rows
[ "Print", "the", "result", "rows" ]
9aec5443860926654c2ab8ee3bf198a407c53b07
https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/examples/node/results.js#L24-L35
13,839
splunk/splunk-sdk-javascript
examples/node/results.js
function(results) { var rows = []; var cols = results.columns; var mapFirst = function(col) { return col.shift(); }; while(cols.length > 0 && cols[0].length > 0) { rows.push(cols.map(mapFirst)); } results.rows = rows; retu...
javascript
function(results) { var rows = []; var cols = results.columns; var mapFirst = function(col) { return col.shift(); }; while(cols.length > 0 && cols[0].length > 0) { rows.push(cols.map(mapFirst)); } results.rows = rows; retu...
[ "function", "(", "results", ")", "{", "var", "rows", "=", "[", "]", ";", "var", "cols", "=", "results", ".", "columns", ";", "var", "mapFirst", "=", "function", "(", "col", ")", "{", "return", "col", ".", "shift", "(", ")", ";", "}", ";", "while"...
Instead of trying to print the column-major format, we just transpose it
[ "Instead", "of", "trying", "to", "print", "the", "column", "-", "major", "format", "we", "just", "transpose", "it" ]
9aec5443860926654c2ab8ee3bf198a407c53b07
https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/examples/node/results.js#L39-L51
13,840
splunk/splunk-sdk-javascript
examples/node/results.js
function(results) { if (results) { var isRows = !!results.rows; var numResults = (results.rows ? results.rows.length : (results.columns[0] || []).length); console.log("====== " + numResults + " RESULTS (preview: " + !!results.preview + ") ======"); ...
javascript
function(results) { if (results) { var isRows = !!results.rows; var numResults = (results.rows ? results.rows.length : (results.columns[0] || []).length); console.log("====== " + numResults + " RESULTS (preview: " + !!results.preview + ") ======"); ...
[ "function", "(", "results", ")", "{", "if", "(", "results", ")", "{", "var", "isRows", "=", "!", "!", "results", ".", "rows", ";", "var", "numResults", "=", "(", "results", ".", "rows", "?", "results", ".", "rows", ".", "length", ":", "(", "results...
Print the results
[ "Print", "the", "results" ]
9aec5443860926654c2ab8ee3bf198a407c53b07
https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/examples/node/results.js#L54-L68
13,841
lampaa/com.lampa.startapp
www/startApp.manually.js
function(params, extra) { var output = [params]; if(extra != undefined) { output.push(extra); } else { output.push(null); } return { start: function(completeCallback, errorCallback, messageCallback) { completeCallback = completeCallback || function() {}; errorCallback = errorCallback...
javascript
function(params, extra) { var output = [params]; if(extra != undefined) { output.push(extra); } else { output.push(null); } return { start: function(completeCallback, errorCallback, messageCallback) { completeCallback = completeCallback || function() {}; errorCallback = errorCallback...
[ "function", "(", "params", ",", "extra", ")", "{", "var", "output", "=", "[", "params", "]", ";", "if", "(", "extra", "!=", "undefined", ")", "{", "output", ".", "push", "(", "extra", ")", ";", "}", "else", "{", "output", ".", "push", "(", "null"...
Set application params @param {Mixed} params params, view documentation https://github.com/lampaa/com.lampa.startapp @param {Mixed} extra Extra fields @param {Function} errorCallback The callback that is called when an error occurred when the program starts.
[ "Set", "application", "params" ]
2fa54b40316e45411e457d4227b4c409f15227b0
https://github.com/lampaa/com.lampa.startapp/blob/2fa54b40316e45411e457d4227b4c409f15227b0/www/startApp.manually.js#L22-L77
13,842
raml2html/raml2html
index.js
render
function render(source, config, options) { config = config || {}; config.raml2HtmlVersion = pjson.version; // Check if option is old boolean `validation` to keep backward compatibility if (typeof options === 'boolean') { options = { validate: options, }; } if (options === undefined) { op...
javascript
function render(source, config, options) { config = config || {}; config.raml2HtmlVersion = pjson.version; // Check if option is old boolean `validation` to keep backward compatibility if (typeof options === 'boolean') { options = { validate: options, }; } if (options === undefined) { op...
[ "function", "render", "(", "source", ",", "config", ",", "options", ")", "{", "config", "=", "config", "||", "{", "}", ";", "config", ".", "raml2HtmlVersion", "=", "pjson", ".", "version", ";", "// Check if option is old boolean `validation` to keep backward compati...
Render the source RAML object using the config's processOutput function The config object should contain at least the following property: processRamlObj: function that takes the raw RAML object and returns a promise with the rendered HTML @param {(String|Object)} source - The source RAML file. Can be a filename, url,...
[ "Render", "the", "source", "RAML", "object", "using", "the", "config", "s", "processOutput", "function" ]
3f0c479bb2ec7280a72ca953fca7eb965dbf28c9
https://github.com/raml2html/raml2html/blob/3f0c479bb2ec7280a72ca953fca7eb965dbf28c9/index.js#L25-L59
13,843
stovmascript/react-native-version
index.js
getPlistFilenames
function getPlistFilenames(xcode) { return unique( flattenDeep( xcode.document.projects.map(project => { return project.targets.filter(Boolean).map(target => { return target.buildConfigurationsList.buildConfigurations.map( config => { return config.ast.value.get("buildSettings").get("INFOPLI...
javascript
function getPlistFilenames(xcode) { return unique( flattenDeep( xcode.document.projects.map(project => { return project.targets.filter(Boolean).map(target => { return target.buildConfigurationsList.buildConfigurations.map( config => { return config.ast.value.get("buildSettings").get("INFOPLI...
[ "function", "getPlistFilenames", "(", "xcode", ")", "{", "return", "unique", "(", "flattenDeep", "(", "xcode", ".", "document", ".", "projects", ".", "map", "(", "project", "=>", "{", "return", "project", ".", "targets", ".", "filter", "(", "Boolean", ")",...
Returns Info.plist filenames @private @param {Xcode} xcode Opened Xcode project file @return {Array} Plist filenames
[ "Returns", "Info", ".", "plist", "filenames" ]
0ff1d9a95d0a6c98ea24a0a46a3b3319b7945e21
https://github.com/stovmascript/react-native-version/blob/0ff1d9a95d0a6c98ea24a0a46a3b3319b7945e21/index.js#L47-L62
13,844
stovmascript/react-native-version
index.js
isExpoProject
function isExpoProject(projPath) { try { let module = resolveFrom(projPath, "expo"); let appInfo = require(`${projPath}/app.json`); return !!(module && appInfo.expo); } catch (err) { return false; } }
javascript
function isExpoProject(projPath) { try { let module = resolveFrom(projPath, "expo"); let appInfo = require(`${projPath}/app.json`); return !!(module && appInfo.expo); } catch (err) { return false; } }
[ "function", "isExpoProject", "(", "projPath", ")", "{", "try", "{", "let", "module", "=", "resolveFrom", "(", "projPath", ",", "\"expo\"", ")", ";", "let", "appInfo", "=", "require", "(", "`", "${", "projPath", "}", "`", ")", ";", "return", "!", "!", ...
Determines whether the project is an Expo app or a plain React Native app @private @return {Boolean} true if the project is an Expo app
[ "Determines", "whether", "the", "project", "is", "an", "Expo", "app", "or", "a", "plain", "React", "Native", "app" ]
0ff1d9a95d0a6c98ea24a0a46a3b3319b7945e21
https://github.com/stovmascript/react-native-version/blob/0ff1d9a95d0a6c98ea24a0a46a3b3319b7945e21/index.js#L69-L78
13,845
stovmascript/react-native-version
util.js
log
function log(msg, silent) { if (!silent) { console.log("[RNV]", chalk[msg.style || "reset"](msg.text)); } }
javascript
function log(msg, silent) { if (!silent) { console.log("[RNV]", chalk[msg.style || "reset"](msg.text)); } }
[ "function", "log", "(", "msg", ",", "silent", ")", "{", "if", "(", "!", "silent", ")", "{", "console", ".", "log", "(", "\"[RNV]\"", ",", "chalk", "[", "msg", ".", "style", "||", "\"reset\"", "]", "(", "msg", ".", "text", ")", ")", ";", "}", "}...
Logs a message into the console with style @param {Object} msg Object containing the message text and chalk style @param {boolean} silent Whether log should be quiet
[ "Logs", "a", "message", "into", "the", "console", "with", "style" ]
0ff1d9a95d0a6c98ea24a0a46a3b3319b7945e21
https://github.com/stovmascript/react-native-version/blob/0ff1d9a95d0a6c98ea24a0a46a3b3319b7945e21/util.js#L17-L21
13,846
videojs/videojs-vr
src/orbit-orientation-controls.js
Quat2Angle
function Quat2Angle(x, y, z, w) { const test = x * y + z * w; // singularity at north pole if (test > 0.499) { const yaw = 2 * Math.atan2(x, w); const pitch = Math.PI / 2; const roll = 0; return new THREE.Vector3(pitch, roll, yaw); } // singularity at south pole if (test < -0.499) { c...
javascript
function Quat2Angle(x, y, z, w) { const test = x * y + z * w; // singularity at north pole if (test > 0.499) { const yaw = 2 * Math.atan2(x, w); const pitch = Math.PI / 2; const roll = 0; return new THREE.Vector3(pitch, roll, yaw); } // singularity at south pole if (test < -0.499) { c...
[ "function", "Quat2Angle", "(", "x", ",", "y", ",", "z", ",", "w", ")", "{", "const", "test", "=", "x", "*", "y", "+", "z", "*", "w", ";", "// singularity at north pole", "if", "(", "test", ">", "0.499", ")", "{", "const", "yaw", "=", "2", "*", ...
Convert a quaternion to an angle Taken from https://stackoverflow.com/a/35448946 Thanks P. Ellul
[ "Convert", "a", "quaternion", "to", "an", "angle" ]
b2ee7945e30fb8f913cc555d03120fd4b467f5b5
https://github.com/videojs/videojs-vr/blob/b2ee7945e30fb8f913cc555d03120fd4b467f5b5/src/orbit-orientation-controls.js#L11-L40
13,847
tommoor/react-emoji-render
src/unicodeToCodepoint.js
toCodePoint
function toCodePoint(input, separator = "-") { const codePoints = []; for (let codePoint of input) { codePoints.push(codePoint.codePointAt(0).toString(16)); } return codePoints.join(separator); }
javascript
function toCodePoint(input, separator = "-") { const codePoints = []; for (let codePoint of input) { codePoints.push(codePoint.codePointAt(0).toString(16)); } return codePoints.join(separator); }
[ "function", "toCodePoint", "(", "input", ",", "separator", "=", "\"-\"", ")", "{", "const", "codePoints", "=", "[", "]", ";", "for", "(", "let", "codePoint", "of", "input", ")", "{", "codePoints", ".", "push", "(", "codePoint", ".", "codePointAt", "(", ...
convert utf16 into code points
[ "convert", "utf16", "into", "code", "points" ]
7122d0fbe91766cd4836c123c8dd3944c1af1ffd
https://github.com/tommoor/react-emoji-render/blob/7122d0fbe91766cd4836c123c8dd3944c1af1ffd/src/unicodeToCodepoint.js#L11-L17
13,848
ngVue/ngVue
src/plugins/filters.js
registerFilters
function registerFilters (filters) { if (isArray(filters)) { lazyStringFilters = lazyStringFilters.concat(filters) } else if (isObject(filters)) { Object.keys(filters).forEach(name => { addFilter(name, filters[name]) }) } }
javascript
function registerFilters (filters) { if (isArray(filters)) { lazyStringFilters = lazyStringFilters.concat(filters) } else if (isObject(filters)) { Object.keys(filters).forEach(name => { addFilter(name, filters[name]) }) } }
[ "function", "registerFilters", "(", "filters", ")", "{", "if", "(", "isArray", "(", "filters", ")", ")", "{", "lazyStringFilters", "=", "lazyStringFilters", ".", "concat", "(", "filters", ")", "}", "else", "if", "(", "isObject", "(", "filters", ")", ")", ...
register a list of ng filters to ngVue
[ "register", "a", "list", "of", "ng", "filters", "to", "ngVue" ]
0ceb8a7b025aea1de86ab4e7175e7e6057dfb8fa
https://github.com/ngVue/ngVue/blob/0ceb8a7b025aea1de86ab4e7175e7e6057dfb8fa/src/plugins/filters.js#L27-L35
13,849
lynndylanhurley/redux-auth
dummy/src/server.js
getMarkup
function getMarkup(webserver, provider) { var markup = renderToString(provider), styles = ""; if (process.env.NODE_ENV === "production") { styles = `<link href="${webserver}/dist/main.css" rel="stylesheet"></link>`; } return `<!doctype html> <html> <head> ...
javascript
function getMarkup(webserver, provider) { var markup = renderToString(provider), styles = ""; if (process.env.NODE_ENV === "production") { styles = `<link href="${webserver}/dist/main.css" rel="stylesheet"></link>`; } return `<!doctype html> <html> <head> ...
[ "function", "getMarkup", "(", "webserver", ",", "provider", ")", "{", "var", "markup", "=", "renderToString", "(", "provider", ")", ",", "styles", "=", "\"\"", ";", "if", "(", "process", ".", "env", ".", "NODE_ENV", "===", "\"production\"", ")", "{", "st...
base html template
[ "base", "html", "template" ]
dc27f381cb7d16fcd4c812c7c1a2f9f921d73164
https://github.com/lynndylanhurley/redux-auth/blob/dc27f381cb7d16fcd4c812c7c1a2f9f921d73164/dummy/src/server.js#L16-L38
13,850
MABelanger/jslib-html5-camera-photo
src/demo/AppSimpleVanillaJs.js
takePhoto
function takePhoto () { let sizeFactor = 1; let imageType = IMAGE_TYPES.JPG; let imageCompression = 1; let config = { sizeFactor, imageType, imageCompression }; let dataUri = cameraPhoto.getDataUri(config); imgElement.src = dataUri; }
javascript
function takePhoto () { let sizeFactor = 1; let imageType = IMAGE_TYPES.JPG; let imageCompression = 1; let config = { sizeFactor, imageType, imageCompression }; let dataUri = cameraPhoto.getDataUri(config); imgElement.src = dataUri; }
[ "function", "takePhoto", "(", ")", "{", "let", "sizeFactor", "=", "1", ";", "let", "imageType", "=", "IMAGE_TYPES", ".", "JPG", ";", "let", "imageCompression", "=", "1", ";", "let", "config", "=", "{", "sizeFactor", ",", "imageType", ",", "imageCompression...
function called by the buttons.
[ "function", "called", "by", "the", "buttons", "." ]
dafa2f415caf4d0728743aae69285707c4c21ab9
https://github.com/MABelanger/jslib-html5-camera-photo/blob/dafa2f415caf4d0728743aae69285707c4c21ab9/src/demo/AppSimpleVanillaJs.js#L56-L69
13,851
BenjaminBrandmeier/angular2-image-gallery
browserstack/browserstack_local.conf.js
function () { require('ts-node').register({ project: 'e2e/tsconfig.e2e.json' }); console.log("Connecting local"); return new Promise(function (resolve, reject) { exports.bs_local = new browserstack.Local(); exports.bs_local.start({'key': exports.config.capabilities['browserstack.key']}...
javascript
function () { require('ts-node').register({ project: 'e2e/tsconfig.e2e.json' }); console.log("Connecting local"); return new Promise(function (resolve, reject) { exports.bs_local = new browserstack.Local(); exports.bs_local.start({'key': exports.config.capabilities['browserstack.key']}...
[ "function", "(", ")", "{", "require", "(", "'ts-node'", ")", ".", "register", "(", "{", "project", ":", "'e2e/tsconfig.e2e.json'", "}", ")", ";", "console", ".", "log", "(", "\"Connecting local\"", ")", ";", "return", "new", "Promise", "(", "function", "("...
Code to start browserstack local before start of test
[ "Code", "to", "start", "browserstack", "local", "before", "start", "of", "test" ]
504629c02516ae058c73433d1b5184f98ca47733
https://github.com/BenjaminBrandmeier/angular2-image-gallery/blob/504629c02516ae058c73433d1b5184f98ca47733/browserstack/browserstack_local.conf.js#L21-L35
13,852
mongodb-js/mongodb-core
lib/utils.js
relayEvents
function relayEvents(listener, emitter, events) { events.forEach(eventName => listener.on(eventName, event => emitter.emit(eventName, event))); }
javascript
function relayEvents(listener, emitter, events) { events.forEach(eventName => listener.on(eventName, event => emitter.emit(eventName, event))); }
[ "function", "relayEvents", "(", "listener", ",", "emitter", ",", "events", ")", "{", "events", ".", "forEach", "(", "eventName", "=>", "listener", ".", "on", "(", "eventName", ",", "event", "=>", "emitter", ".", "emit", "(", "eventName", ",", "event", ")...
Relays events for a given listener and emitter @param {EventEmitter} listener the EventEmitter to listen to the events from @param {EventEmitter} emitter the EventEmitter to relay the events to
[ "Relays", "events", "for", "a", "given", "listener", "and", "emitter" ]
bcb87caa89f5841272955fb4b320f75d632856f7
https://github.com/mongodb-js/mongodb-core/blob/bcb87caa89f5841272955fb4b320f75d632856f7/lib/utils.js#L33-L35
13,853
mongodb-js/mongodb-core
lib/utils.js
retrieveEJSON
function retrieveEJSON() { let EJSON = null; try { EJSON = requireOptional('mongodb-extjson'); } catch (error) {} // eslint-disable-line if (!EJSON) { EJSON = { parse: noEJSONError, deserialize: noEJSONError, serialize: noEJSONError, stringify: noEJSONError, setBSONModule: ...
javascript
function retrieveEJSON() { let EJSON = null; try { EJSON = requireOptional('mongodb-extjson'); } catch (error) {} // eslint-disable-line if (!EJSON) { EJSON = { parse: noEJSONError, deserialize: noEJSONError, serialize: noEJSONError, stringify: noEJSONError, setBSONModule: ...
[ "function", "retrieveEJSON", "(", ")", "{", "let", "EJSON", "=", "null", ";", "try", "{", "EJSON", "=", "requireOptional", "(", "'mongodb-extjson'", ")", ";", "}", "catch", "(", "error", ")", "{", "}", "// eslint-disable-line", "if", "(", "!", "EJSON", "...
Facilitate loading EJSON optionally
[ "Facilitate", "loading", "EJSON", "optionally" ]
bcb87caa89f5841272955fb4b320f75d632856f7
https://github.com/mongodb-js/mongodb-core/blob/bcb87caa89f5841272955fb4b320f75d632856f7/lib/utils.js#L59-L76
13,854
mongodb-js/mongodb-core
lib/utils.js
maxWireVersion
function maxWireVersion(topologyOrServer) { if (topologyOrServer.ismaster) { return topologyOrServer.ismaster.maxWireVersion; } if (topologyOrServer.description) { return topologyOrServer.description.maxWireVersion; } return null; }
javascript
function maxWireVersion(topologyOrServer) { if (topologyOrServer.ismaster) { return topologyOrServer.ismaster.maxWireVersion; } if (topologyOrServer.description) { return topologyOrServer.description.maxWireVersion; } return null; }
[ "function", "maxWireVersion", "(", "topologyOrServer", ")", "{", "if", "(", "topologyOrServer", ".", "ismaster", ")", "{", "return", "topologyOrServer", ".", "ismaster", ".", "maxWireVersion", ";", "}", "if", "(", "topologyOrServer", ".", "description", ")", "{"...
A helper function for determining `maxWireVersion` between legacy and new topology instances @private @param {(Topology|Server)} topologyOrServer
[ "A", "helper", "function", "for", "determining", "maxWireVersion", "between", "legacy", "and", "new", "topology", "instances" ]
bcb87caa89f5841272955fb4b320f75d632856f7
https://github.com/mongodb-js/mongodb-core/blob/bcb87caa89f5841272955fb4b320f75d632856f7/lib/utils.js#L85-L95
13,855
mongodb-js/mongodb-core
lib/sdam/server_selectors.js
writableServerSelector
function writableServerSelector() { return function(topologyDescription, servers) { return latencyWindowReducer(topologyDescription, servers.filter(s => s.isWritable)); }; }
javascript
function writableServerSelector() { return function(topologyDescription, servers) { return latencyWindowReducer(topologyDescription, servers.filter(s => s.isWritable)); }; }
[ "function", "writableServerSelector", "(", ")", "{", "return", "function", "(", "topologyDescription", ",", "servers", ")", "{", "return", "latencyWindowReducer", "(", "topologyDescription", ",", "servers", ".", "filter", "(", "s", "=>", "s", ".", "isWritable", ...
Returns a server selector that selects for writable servers
[ "Returns", "a", "server", "selector", "that", "selects", "for", "writable", "servers" ]
bcb87caa89f5841272955fb4b320f75d632856f7
https://github.com/mongodb-js/mongodb-core/blob/bcb87caa89f5841272955fb4b320f75d632856f7/lib/sdam/server_selectors.js#L14-L18
13,856
mongodb-js/mongodb-core
lib/sdam/server_selectors.js
tagSetMatch
function tagSetMatch(tagSet, serverTags) { const keys = Object.keys(tagSet); const serverTagKeys = Object.keys(serverTags); for (let i = 0; i < keys.length; ++i) { const key = keys[i]; if (serverTagKeys.indexOf(key) === -1 || serverTags[key] !== tagSet[key]) { return false; } } return true;...
javascript
function tagSetMatch(tagSet, serverTags) { const keys = Object.keys(tagSet); const serverTagKeys = Object.keys(serverTags); for (let i = 0; i < keys.length; ++i) { const key = keys[i]; if (serverTagKeys.indexOf(key) === -1 || serverTags[key] !== tagSet[key]) { return false; } } return true;...
[ "function", "tagSetMatch", "(", "tagSet", ",", "serverTags", ")", "{", "const", "keys", "=", "Object", ".", "keys", "(", "tagSet", ")", ";", "const", "serverTagKeys", "=", "Object", ".", "keys", "(", "serverTags", ")", ";", "for", "(", "let", "i", "=",...
Determines whether a server's tags match a given set of tags @param {String[]} tagSet The requested tag set to match @param {String[]} serverTags The server's tags
[ "Determines", "whether", "a", "server", "s", "tags", "match", "a", "given", "set", "of", "tags" ]
bcb87caa89f5841272955fb4b320f75d632856f7
https://github.com/mongodb-js/mongodb-core/blob/bcb87caa89f5841272955fb4b320f75d632856f7/lib/sdam/server_selectors.js#L81-L92
13,857
mongodb-js/mongodb-core
lib/sdam/server_selectors.js
tagSetReducer
function tagSetReducer(readPreference, servers) { if ( readPreference.tags == null || (Array.isArray(readPreference.tags) && readPreference.tags.length === 0) ) { return servers; } for (let i = 0; i < readPreference.tags.length; ++i) { const tagSet = readPreference.tags[i]; const serversMat...
javascript
function tagSetReducer(readPreference, servers) { if ( readPreference.tags == null || (Array.isArray(readPreference.tags) && readPreference.tags.length === 0) ) { return servers; } for (let i = 0; i < readPreference.tags.length; ++i) { const tagSet = readPreference.tags[i]; const serversMat...
[ "function", "tagSetReducer", "(", "readPreference", ",", "servers", ")", "{", "if", "(", "readPreference", ".", "tags", "==", "null", "||", "(", "Array", ".", "isArray", "(", "readPreference", ".", "tags", ")", "&&", "readPreference", ".", "tags", ".", "le...
Reduces a set of server descriptions based on tags requested by the read preference @param {ReadPreference} readPreference The read preference providing the requested tags @param {ServerDescription[]} servers The list of server descriptions to reduce @return {ServerDescription[]} The list of servers matching the reque...
[ "Reduces", "a", "set", "of", "server", "descriptions", "based", "on", "tags", "requested", "by", "the", "read", "preference" ]
bcb87caa89f5841272955fb4b320f75d632856f7
https://github.com/mongodb-js/mongodb-core/blob/bcb87caa89f5841272955fb4b320f75d632856f7/lib/sdam/server_selectors.js#L101-L122
13,858
mongodb-js/mongodb-core
lib/auth/defaultAuthProviders.js
defaultAuthProviders
function defaultAuthProviders(bson) { return { mongocr: new MongoCR(bson), x509: new X509(bson), plain: new Plain(bson), gssapi: new GSSAPI(bson), sspi: new SSPI(bson), 'scram-sha-1': new ScramSHA1(bson), 'scram-sha-256': new ScramSHA256(bson) }; }
javascript
function defaultAuthProviders(bson) { return { mongocr: new MongoCR(bson), x509: new X509(bson), plain: new Plain(bson), gssapi: new GSSAPI(bson), sspi: new SSPI(bson), 'scram-sha-1': new ScramSHA1(bson), 'scram-sha-256': new ScramSHA256(bson) }; }
[ "function", "defaultAuthProviders", "(", "bson", ")", "{", "return", "{", "mongocr", ":", "new", "MongoCR", "(", "bson", ")", ",", "x509", ":", "new", "X509", "(", "bson", ")", ",", "plain", ":", "new", "Plain", "(", "bson", ")", ",", "gssapi", ":", ...
Returns the default authentication providers. @param {BSON} bson Bson definition @returns {Object} a mapping of auth names to auth types
[ "Returns", "the", "default", "authentication", "providers", "." ]
bcb87caa89f5841272955fb4b320f75d632856f7
https://github.com/mongodb-js/mongodb-core/blob/bcb87caa89f5841272955fb4b320f75d632856f7/lib/auth/defaultAuthProviders.js#L17-L27
13,859
mongodb-js/mongodb-core
lib/connection/pool.js
canCompress
function canCompress(command) { const commandDoc = command instanceof Msg ? command.command : command.query; const commandName = Object.keys(commandDoc)[0]; return uncompressibleCommands.indexOf(commandName) === -1; }
javascript
function canCompress(command) { const commandDoc = command instanceof Msg ? command.command : command.query; const commandName = Object.keys(commandDoc)[0]; return uncompressibleCommands.indexOf(commandName) === -1; }
[ "function", "canCompress", "(", "command", ")", "{", "const", "commandDoc", "=", "command", "instanceof", "Msg", "?", "command", ".", "command", ":", "command", ".", "query", ";", "const", "commandName", "=", "Object", ".", "keys", "(", "commandDoc", ")", ...
Return whether a command contains an uncompressible command term Will return true if command contains no uncompressible command terms
[ "Return", "whether", "a", "command", "contains", "an", "uncompressible", "command", "term", "Will", "return", "true", "if", "command", "contains", "no", "uncompressible", "command", "terms" ]
bcb87caa89f5841272955fb4b320f75d632856f7
https://github.com/mongodb-js/mongodb-core/blob/bcb87caa89f5841272955fb4b320f75d632856f7/lib/connection/pool.js#L953-L957
13,860
mongodb-js/mongodb-core
lib/connection/pool.js
remove
function remove(connection, connections) { for (var i = 0; i < connections.length; i++) { if (connections[i] === connection) { connections.splice(i, 1); return true; } } }
javascript
function remove(connection, connections) { for (var i = 0; i < connections.length; i++) { if (connections[i] === connection) { connections.splice(i, 1); return true; } } }
[ "function", "remove", "(", "connection", ",", "connections", ")", "{", "for", "(", "var", "i", "=", "0", ";", "i", "<", "connections", ".", "length", ";", "i", "++", ")", "{", "if", "(", "connections", "[", "i", "]", "===", "connection", ")", "{", ...
Remove connection method
[ "Remove", "connection", "method" ]
bcb87caa89f5841272955fb4b320f75d632856f7
https://github.com/mongodb-js/mongodb-core/blob/bcb87caa89f5841272955fb4b320f75d632856f7/lib/connection/pool.js#L960-L967
13,861
mongodb-js/mongodb-core
lib/connection/utils.js
retrieveSnappy
function retrieveSnappy() { var snappy = null; try { snappy = require_optional('snappy'); } catch (error) {} // eslint-disable-line if (!snappy) { snappy = { compress: noSnappyWarning, uncompress: noSnappyWarning, compressSync: noSnappyWarning, uncompressSync: noSnappyWarning ...
javascript
function retrieveSnappy() { var snappy = null; try { snappy = require_optional('snappy'); } catch (error) {} // eslint-disable-line if (!snappy) { snappy = { compress: noSnappyWarning, uncompress: noSnappyWarning, compressSync: noSnappyWarning, uncompressSync: noSnappyWarning ...
[ "function", "retrieveSnappy", "(", ")", "{", "var", "snappy", "=", "null", ";", "try", "{", "snappy", "=", "require_optional", "(", "'snappy'", ")", ";", "}", "catch", "(", "error", ")", "{", "}", "// eslint-disable-line", "if", "(", "!", "snappy", ")", ...
Facilitate loading Snappy optionally
[ "Facilitate", "loading", "Snappy", "optionally" ]
bcb87caa89f5841272955fb4b320f75d632856f7
https://github.com/mongodb-js/mongodb-core/blob/bcb87caa89f5841272955fb4b320f75d632856f7/lib/connection/utils.js#L37-L51
13,862
mongodb-js/mongodb-core
lib/uri_parser.js
matchesParentDomain
function matchesParentDomain(srvAddress, parentDomain) { const regex = /^.*?\./; const srv = `.${srvAddress.replace(regex, '')}`; const parent = `.${parentDomain.replace(regex, '')}`; return srv.endsWith(parent); }
javascript
function matchesParentDomain(srvAddress, parentDomain) { const regex = /^.*?\./; const srv = `.${srvAddress.replace(regex, '')}`; const parent = `.${parentDomain.replace(regex, '')}`; return srv.endsWith(parent); }
[ "function", "matchesParentDomain", "(", "srvAddress", ",", "parentDomain", ")", "{", "const", "regex", "=", "/", "^.*?\\.", "/", ";", "const", "srv", "=", "`", "${", "srvAddress", ".", "replace", "(", "regex", ",", "''", ")", "}", "`", ";", "const", "p...
Determines whether a provided address matches the provided parent domain in order to avoid certain attack vectors. @param {String} srvAddress The address to check against a domain @param {String} parentDomain The domain to check the provided address against @return {Boolean} Whether the provided address matches the pa...
[ "Determines", "whether", "a", "provided", "address", "matches", "the", "provided", "parent", "domain", "in", "order", "to", "avoid", "certain", "attack", "vectors", "." ]
bcb87caa89f5841272955fb4b320f75d632856f7
https://github.com/mongodb-js/mongodb-core/blob/bcb87caa89f5841272955fb4b320f75d632856f7/lib/uri_parser.js#L22-L27
13,863
mongodb-js/mongodb-core
lib/uri_parser.js
parseSrvConnectionString
function parseSrvConnectionString(uri, options, callback) { const result = URL.parse(uri, true); if (result.hostname.split('.').length < 3) { return callback(new MongoParseError('URI does not have hostname, domain name and tld')); } result.domainLength = result.hostname.split('.').length; if (result.pat...
javascript
function parseSrvConnectionString(uri, options, callback) { const result = URL.parse(uri, true); if (result.hostname.split('.').length < 3) { return callback(new MongoParseError('URI does not have hostname, domain name and tld')); } result.domainLength = result.hostname.split('.').length; if (result.pat...
[ "function", "parseSrvConnectionString", "(", "uri", ",", "options", ",", "callback", ")", "{", "const", "result", "=", "URL", ".", "parse", "(", "uri", ",", "true", ")", ";", "if", "(", "result", ".", "hostname", ".", "split", "(", "'.'", ")", ".", "...
Lookup a `mongodb+srv` connection string, combine the parts and reparse it as a normal connection string. @param {string} uri The connection string to parse @param {object} options Optional user provided connection string options @param {function} callback
[ "Lookup", "a", "mongodb", "+", "srv", "connection", "string", "combine", "the", "parts", "and", "reparse", "it", "as", "a", "normal", "connection", "string", "." ]
bcb87caa89f5841272955fb4b320f75d632856f7
https://github.com/mongodb-js/mongodb-core/blob/bcb87caa89f5841272955fb4b320f75d632856f7/lib/uri_parser.js#L37-L113
13,864
mongodb-js/mongodb-core
lib/uri_parser.js
parseQueryStringItemValue
function parseQueryStringItemValue(key, value) { if (Array.isArray(value)) { // deduplicate and simplify arrays value = value.filter((v, idx) => value.indexOf(v) === idx); if (value.length === 1) value = value[0]; } else if (value.indexOf(':') > 0) { value = value.split(',').reduce((result, pair) =>...
javascript
function parseQueryStringItemValue(key, value) { if (Array.isArray(value)) { // deduplicate and simplify arrays value = value.filter((v, idx) => value.indexOf(v) === idx); if (value.length === 1) value = value[0]; } else if (value.indexOf(':') > 0) { value = value.split(',').reduce((result, pair) =>...
[ "function", "parseQueryStringItemValue", "(", "key", ",", "value", ")", "{", "if", "(", "Array", ".", "isArray", "(", "value", ")", ")", "{", "// deduplicate and simplify arrays", "value", "=", "value", ".", "filter", "(", "(", "v", ",", "idx", ")", "=>", ...
Parses a query string item according to the connection string spec @param {string} key The key for the parsed value @param {Array|String} value The value to parse @return {Array|Object|String} The parsed value
[ "Parses", "a", "query", "string", "item", "according", "to", "the", "connection", "string", "spec" ]
bcb87caa89f5841272955fb4b320f75d632856f7
https://github.com/mongodb-js/mongodb-core/blob/bcb87caa89f5841272955fb4b320f75d632856f7/lib/uri_parser.js#L122-L147
13,865
mongodb-js/mongodb-core
lib/uri_parser.js
applyConnectionStringOption
function applyConnectionStringOption(obj, key, value, options) { // simple key translation if (key === 'journal') { key = 'j'; } else if (key === 'wtimeoutms') { key = 'wtimeout'; } // more complicated translation if (BOOLEAN_OPTIONS.has(key)) { value = value === 'true' || value === true; } e...
javascript
function applyConnectionStringOption(obj, key, value, options) { // simple key translation if (key === 'journal') { key = 'j'; } else if (key === 'wtimeoutms') { key = 'wtimeout'; } // more complicated translation if (BOOLEAN_OPTIONS.has(key)) { value = value === 'true' || value === true; } e...
[ "function", "applyConnectionStringOption", "(", "obj", ",", "key", ",", "value", ",", "options", ")", "{", "// simple key translation", "if", "(", "key", "===", "'journal'", ")", "{", "key", "=", "'j'", ";", "}", "else", "if", "(", "key", "===", "'wtimeout...
Sets the value for `key`, allowing for any required translation @param {object} obj The object to set the key on @param {string} key The key to set the value for @param {*} value The value to set @param {object} options The options used for option parsing
[ "Sets", "the", "value", "for", "key", "allowing", "for", "any", "required", "translation" ]
bcb87caa89f5841272955fb4b320f75d632856f7
https://github.com/mongodb-js/mongodb-core/blob/bcb87caa89f5841272955fb4b320f75d632856f7/lib/uri_parser.js#L221-L292
13,866
mongodb-js/mongodb-core
lib/uri_parser.js
applyAuthExpectations
function applyAuthExpectations(parsed) { if (parsed.options == null) { return; } const options = parsed.options; const authSource = options.authsource || options.authSource; if (authSource != null) { parsed.auth = Object.assign({}, parsed.auth, { db: authSource }); } const authMechanism = option...
javascript
function applyAuthExpectations(parsed) { if (parsed.options == null) { return; } const options = parsed.options; const authSource = options.authsource || options.authSource; if (authSource != null) { parsed.auth = Object.assign({}, parsed.auth, { db: authSource }); } const authMechanism = option...
[ "function", "applyAuthExpectations", "(", "parsed", ")", "{", "if", "(", "parsed", ".", "options", "==", "null", ")", "{", "return", ";", "}", "const", "options", "=", "parsed", ".", "options", ";", "const", "authSource", "=", "options", ".", "authsource",...
Modifies the parsed connection string object taking into account expectations we have for authentication-related options. @param {object} parsed The parsed connection string result @return The parsed connection string result possibly modified for auth expectations
[ "Modifies", "the", "parsed", "connection", "string", "object", "taking", "into", "account", "expectations", "we", "have", "for", "authentication", "-", "related", "options", "." ]
bcb87caa89f5841272955fb4b320f75d632856f7
https://github.com/mongodb-js/mongodb-core/blob/bcb87caa89f5841272955fb4b320f75d632856f7/lib/uri_parser.js#L323-L380
13,867
mongodb-js/mongodb-core
lib/uri_parser.js
checkTLSOptions
function checkTLSOptions(queryString) { const queryStringKeys = Object.keys(queryString); if ( queryStringKeys.indexOf('tlsInsecure') !== -1 && (queryStringKeys.indexOf('tlsAllowInvalidCertificates') !== -1 || queryStringKeys.indexOf('tlsAllowInvalidHostnames') !== -1) ) { throw new MongoParseEr...
javascript
function checkTLSOptions(queryString) { const queryStringKeys = Object.keys(queryString); if ( queryStringKeys.indexOf('tlsInsecure') !== -1 && (queryStringKeys.indexOf('tlsAllowInvalidCertificates') !== -1 || queryStringKeys.indexOf('tlsAllowInvalidHostnames') !== -1) ) { throw new MongoParseEr...
[ "function", "checkTLSOptions", "(", "queryString", ")", "{", "const", "queryStringKeys", "=", "Object", ".", "keys", "(", "queryString", ")", ";", "if", "(", "queryStringKeys", ".", "indexOf", "(", "'tlsInsecure'", ")", "!==", "-", "1", "&&", "(", "queryStri...
Checks a query string for invalid tls options according to the URI options spec. @param {string} queryString The query string to check @throws {MongoParseError}
[ "Checks", "a", "query", "string", "for", "invalid", "tls", "options", "according", "to", "the", "URI", "options", "spec", "." ]
bcb87caa89f5841272955fb4b320f75d632856f7
https://github.com/mongodb-js/mongodb-core/blob/bcb87caa89f5841272955fb4b320f75d632856f7/lib/uri_parser.js#L421-L441
13,868
mongodb-js/mongodb-core
lib/topologies/replset.js
function(self, server, cb) { // Measure running time var start = new Date().getTime(); // Emit the server heartbeat start emitSDAMEvent(self, 'serverHeartbeatStarted', { connectionId: server.name }); // Execute ismaster // Set the socketTimeout for a monitoring message to a low number // Ensuring ismast...
javascript
function(self, server, cb) { // Measure running time var start = new Date().getTime(); // Emit the server heartbeat start emitSDAMEvent(self, 'serverHeartbeatStarted', { connectionId: server.name }); // Execute ismaster // Set the socketTimeout for a monitoring message to a low number // Ensuring ismast...
[ "function", "(", "self", ",", "server", ",", "cb", ")", "{", "// Measure running time", "var", "start", "=", "new", "Date", "(", ")", ".", "getTime", "(", ")", ";", "// Emit the server heartbeat start", "emitSDAMEvent", "(", "self", ",", "'serverHeartbeatStarted...
Ping the server
[ "Ping", "the", "server" ]
bcb87caa89f5841272955fb4b320f75d632856f7
https://github.com/mongodb-js/mongodb-core/blob/bcb87caa89f5841272955fb4b320f75d632856f7/lib/topologies/replset.js#L390-L478
13,869
mongodb-js/mongodb-core
lib/topologies/replset.js
function(host, self, options) { // If this is not the initial scan // Is this server already being monitoried, then skip monitoring if (!options.haInterval) { for (var i = 0; i < self.intervalIds.length; i++) { if (self.intervalIds[i].__host === host) { return; } } } // Get the ha...
javascript
function(host, self, options) { // If this is not the initial scan // Is this server already being monitoried, then skip monitoring if (!options.haInterval) { for (var i = 0; i < self.intervalIds.length; i++) { if (self.intervalIds[i].__host === host) { return; } } } // Get the ha...
[ "function", "(", "host", ",", "self", ",", "options", ")", "{", "// If this is not the initial scan", "// Is this server already being monitoried, then skip monitoring", "if", "(", "!", "options", ".", "haInterval", ")", "{", "for", "(", "var", "i", "=", "0", ";", ...
Each server is monitored in parallel in their own timeout loop
[ "Each", "server", "is", "monitored", "in", "parallel", "in", "their", "own", "timeout", "loop" ]
bcb87caa89f5841272955fb4b320f75d632856f7
https://github.com/mongodb-js/mongodb-core/blob/bcb87caa89f5841272955fb4b320f75d632856f7/lib/topologies/replset.js#L481-L587
13,870
mongodb-js/mongodb-core
lib/topologies/replset.js
executeReconnect
function executeReconnect(self) { return function() { if (self.state === DESTROYED || self.state === UNREFERENCED) { return; } connectNewServers(self, self.s.replicaSetState.unknownServers, function() { var monitoringFrequencey = self.s.replicaSetState.hasPrimary() ? _ha...
javascript
function executeReconnect(self) { return function() { if (self.state === DESTROYED || self.state === UNREFERENCED) { return; } connectNewServers(self, self.s.replicaSetState.unknownServers, function() { var monitoringFrequencey = self.s.replicaSetState.hasPrimary() ? _ha...
[ "function", "executeReconnect", "(", "self", ")", "{", "return", "function", "(", ")", "{", "if", "(", "self", ".", "state", "===", "DESTROYED", "||", "self", ".", "state", "===", "UNREFERENCED", ")", "{", "return", ";", "}", "connectNewServers", "(", "s...
Run the reconnect process
[ "Run", "the", "reconnect", "process" ]
bcb87caa89f5841272955fb4b320f75d632856f7
https://github.com/mongodb-js/mongodb-core/blob/bcb87caa89f5841272955fb4b320f75d632856f7/lib/topologies/replset.js#L643-L658
13,871
mongodb-js/mongodb-core
lib/topologies/replset.js
emitSDAMEvent
function emitSDAMEvent(self, event, description) { if (self.listeners(event).length > 0) { self.emit(event, description); } }
javascript
function emitSDAMEvent(self, event, description) { if (self.listeners(event).length > 0) { self.emit(event, description); } }
[ "function", "emitSDAMEvent", "(", "self", ",", "event", ",", "description", ")", "{", "if", "(", "self", ".", "listeners", "(", "event", ")", ".", "length", ">", "0", ")", "{", "self", ".", "emit", "(", "event", ",", "description", ")", ";", "}", "...
Emit event if it exists @method
[ "Emit", "event", "if", "it", "exists" ]
bcb87caa89f5841272955fb4b320f75d632856f7
https://github.com/mongodb-js/mongodb-core/blob/bcb87caa89f5841272955fb4b320f75d632856f7/lib/topologies/replset.js#L884-L888
13,872
mongodb-js/mongodb-core
lib/topologies/replset.js
executeWriteOperation
function executeWriteOperation(args, options, callback) { if (typeof options === 'function') (callback = options), (options = {}); options = options || {}; // TODO: once we drop Node 4, use destructuring either here or in arguments. const self = args.self; const op = args.op; const ns = args.ns; const op...
javascript
function executeWriteOperation(args, options, callback) { if (typeof options === 'function') (callback = options), (options = {}); options = options || {}; // TODO: once we drop Node 4, use destructuring either here or in arguments. const self = args.self; const op = args.op; const ns = args.ns; const op...
[ "function", "executeWriteOperation", "(", "args", ",", "options", ",", "callback", ")", "{", "if", "(", "typeof", "options", "===", "'function'", ")", "(", "callback", "=", "options", ")", ",", "(", "options", "=", "{", "}", ")", ";", "options", "=", "...
Execute write operation
[ "Execute", "write", "operation" ]
bcb87caa89f5841272955fb4b320f75d632856f7
https://github.com/mongodb-js/mongodb-core/blob/bcb87caa89f5841272955fb4b320f75d632856f7/lib/topologies/replset.js#L1123-L1184
13,873
mongodb-js/mongodb-core
lib/auth/scram.js
xor
function xor(a, b) { if (!Buffer.isBuffer(a)) a = Buffer.from(a); if (!Buffer.isBuffer(b)) b = Buffer.from(b); const length = Math.max(a.length, b.length); const res = []; for (let i = 0; i < length; i += 1) { res.push(a[i] ^ b[i]); } return Buffer.from(res).toString('base64'); }
javascript
function xor(a, b) { if (!Buffer.isBuffer(a)) a = Buffer.from(a); if (!Buffer.isBuffer(b)) b = Buffer.from(b); const length = Math.max(a.length, b.length); const res = []; for (let i = 0; i < length; i += 1) { res.push(a[i] ^ b[i]); } return Buffer.from(res).toString('base64'); }
[ "function", "xor", "(", "a", ",", "b", ")", "{", "if", "(", "!", "Buffer", ".", "isBuffer", "(", "a", ")", ")", "a", "=", "Buffer", ".", "from", "(", "a", ")", ";", "if", "(", "!", "Buffer", ".", "isBuffer", "(", "b", ")", ")", "b", "=", ...
XOR two buffers
[ "XOR", "two", "buffers" ]
bcb87caa89f5841272955fb4b320f75d632856f7
https://github.com/mongodb-js/mongodb-core/blob/bcb87caa89f5841272955fb4b320f75d632856f7/lib/auth/scram.js#L43-L54
13,874
mongodb-js/mongodb-core
lib/error.js
isRetryableError
function isRetryableError(error) { return ( RETRYABLE_ERROR_CODES.has(error.code) || error instanceof MongoNetworkError || error.message.match(/not master/) || error.message.match(/node is recovering/) ); }
javascript
function isRetryableError(error) { return ( RETRYABLE_ERROR_CODES.has(error.code) || error instanceof MongoNetworkError || error.message.match(/not master/) || error.message.match(/node is recovering/) ); }
[ "function", "isRetryableError", "(", "error", ")", "{", "return", "(", "RETRYABLE_ERROR_CODES", ".", "has", "(", "error", ".", "code", ")", "||", "error", "instanceof", "MongoNetworkError", "||", "error", ".", "message", ".", "match", "(", "/", "not master", ...
Determines whether an error is something the driver should attempt to retry @param {MongoError|Error} error
[ "Determines", "whether", "an", "error", "is", "something", "the", "driver", "should", "attempt", "to", "retry" ]
bcb87caa89f5841272955fb4b320f75d632856f7
https://github.com/mongodb-js/mongodb-core/blob/bcb87caa89f5841272955fb4b320f75d632856f7/lib/error.js#L146-L153
13,875
mongodb-js/mongodb-core
lib/sdam/server_description.js
parseServerType
function parseServerType(ismaster) { if (!ismaster || !ismaster.ok) { return ServerType.Unknown; } if (ismaster.isreplicaset) { return ServerType.RSGhost; } if (ismaster.msg && ismaster.msg === 'isdbgrid') { return ServerType.Mongos; } if (ismaster.setName) { if (ismaster.hidden) { ...
javascript
function parseServerType(ismaster) { if (!ismaster || !ismaster.ok) { return ServerType.Unknown; } if (ismaster.isreplicaset) { return ServerType.RSGhost; } if (ismaster.msg && ismaster.msg === 'isdbgrid') { return ServerType.Mongos; } if (ismaster.setName) { if (ismaster.hidden) { ...
[ "function", "parseServerType", "(", "ismaster", ")", "{", "if", "(", "!", "ismaster", "||", "!", "ismaster", ".", "ok", ")", "{", "return", "ServerType", ".", "Unknown", ";", "}", "if", "(", "ismaster", ".", "isreplicaset", ")", "{", "return", "ServerTyp...
Parses an `ismaster` message and determines the server type @param {Object} ismaster The `ismaster` message to parse @return {ServerType}
[ "Parses", "an", "ismaster", "message", "and", "determines", "the", "server", "type" ]
bcb87caa89f5841272955fb4b320f75d632856f7
https://github.com/mongodb-js/mongodb-core/blob/bcb87caa89f5841272955fb4b320f75d632856f7/lib/sdam/server_description.js#L116-L144
13,876
mongodb-js/mongodb-core
lib/sdam/topology.js
destroyServer
function destroyServer(server, topology, callback) { LOCAL_SERVER_EVENTS.forEach(event => server.removeAllListeners(event)); server.destroy(() => { topology.emit( 'serverClosed', new monitoring.ServerClosedEvent(topology.s.id, server.description.address) ); if (typeof callback === 'functio...
javascript
function destroyServer(server, topology, callback) { LOCAL_SERVER_EVENTS.forEach(event => server.removeAllListeners(event)); server.destroy(() => { topology.emit( 'serverClosed', new monitoring.ServerClosedEvent(topology.s.id, server.description.address) ); if (typeof callback === 'functio...
[ "function", "destroyServer", "(", "server", ",", "topology", ",", "callback", ")", "{", "LOCAL_SERVER_EVENTS", ".", "forEach", "(", "event", "=>", "server", ".", "removeAllListeners", "(", "event", ")", ")", ";", "server", ".", "destroy", "(", "(", ")", "=...
Destroys a server, and removes all event listeners from the instance @param {Server} server
[ "Destroys", "a", "server", "and", "removes", "all", "event", "listeners", "from", "the", "instance" ]
bcb87caa89f5841272955fb4b320f75d632856f7
https://github.com/mongodb-js/mongodb-core/blob/bcb87caa89f5841272955fb4b320f75d632856f7/lib/sdam/topology.js#L652-L663
13,877
mongodb-js/mongodb-core
lib/sdam/topology.js
parseStringSeedlist
function parseStringSeedlist(seedlist) { return seedlist.split(',').map(seed => ({ host: seed.split(':')[0], port: seed.split(':')[1] || 27017 })); }
javascript
function parseStringSeedlist(seedlist) { return seedlist.split(',').map(seed => ({ host: seed.split(':')[0], port: seed.split(':')[1] || 27017 })); }
[ "function", "parseStringSeedlist", "(", "seedlist", ")", "{", "return", "seedlist", ".", "split", "(", "','", ")", ".", "map", "(", "seed", "=>", "(", "{", "host", ":", "seed", ".", "split", "(", "':'", ")", "[", "0", "]", ",", "port", ":", "seed",...
Parses a basic seedlist in string form @param {string} seedlist The seedlist to parse
[ "Parses", "a", "basic", "seedlist", "in", "string", "form" ]
bcb87caa89f5841272955fb4b320f75d632856f7
https://github.com/mongodb-js/mongodb-core/blob/bcb87caa89f5841272955fb4b320f75d632856f7/lib/sdam/topology.js#L670-L675
13,878
mongodb-js/mongodb-core
lib/sdam/topology.js
resetServerState
function resetServerState(server, error, options) { options = Object.assign({}, { clearPool: false }, options); function resetState() { server.emit( 'descriptionReceived', new ServerDescription(server.description.address, null, { error }) ); } if (options.clearPool && server.pool) { se...
javascript
function resetServerState(server, error, options) { options = Object.assign({}, { clearPool: false }, options); function resetState() { server.emit( 'descriptionReceived', new ServerDescription(server.description.address, null, { error }) ); } if (options.clearPool && server.pool) { se...
[ "function", "resetServerState", "(", "server", ",", "error", ",", "options", ")", "{", "options", "=", "Object", ".", "assign", "(", "{", "}", ",", "{", "clearPool", ":", "false", "}", ",", "options", ")", ";", "function", "resetState", "(", ")", "{", ...
Resets the internal state of this server to `Unknown` by simulating an empty ismaster @private @param {Server} server @param {MongoError} error The error that caused the state reset @param {object} [options] Optional settings @param {boolean} [options.clearPool=false] Pool should be cleared out on state reset
[ "Resets", "the", "internal", "state", "of", "this", "server", "to", "Unknown", "by", "simulating", "an", "empty", "ismaster" ]
bcb87caa89f5841272955fb4b320f75d632856f7
https://github.com/mongodb-js/mongodb-core/blob/bcb87caa89f5841272955fb4b320f75d632856f7/lib/sdam/topology.js#L930-L946
13,879
mongodb-js/mongodb-core
lib/topologies/mongos.js
function(seedlist, options) { options = options || {}; // Get replSet Id this.id = id++; // Internal state this.s = { options: Object.assign({}, options), // BSON instance bson: options.bson || new BSON([ BSON.Binary, BSON.Code, BSON.DBRef, BSON.Decima...
javascript
function(seedlist, options) { options = options || {}; // Get replSet Id this.id = id++; // Internal state this.s = { options: Object.assign({}, options), // BSON instance bson: options.bson || new BSON([ BSON.Binary, BSON.Code, BSON.DBRef, BSON.Decima...
[ "function", "(", "seedlist", ",", "options", ")", "{", "options", "=", "options", "||", "{", "}", ";", "// Get replSet Id", "this", ".", "id", "=", "id", "++", ";", "// Internal state", "this", ".", "s", "=", "{", "options", ":", "Object", ".", "assign...
Creates a new Mongos instance @class @param {array} seedlist A list of seeds for the replicaset @param {number} [options.haInterval=5000] The High availability period for replicaset inquiry @param {Cursor} [options.cursorFactory=Cursor] The cursor factory class used for all query cursors @param {number} [options.size=5...
[ "Creates", "a", "new", "Mongos", "instance" ]
bcb87caa89f5841272955fb4b320f75d632856f7
https://github.com/mongodb-js/mongodb-core/blob/bcb87caa89f5841272955fb4b320f75d632856f7/lib/topologies/mongos.js#L123-L219
13,880
mongodb-js/mongodb-core
lib/topologies/mongos.js
pingServer
function pingServer(_self, _server, cb) { // Measure running time var start = new Date().getTime(); // Emit the server heartbeat start emitSDAMEvent(self, 'serverHeartbeatStarted', { connectionId: _server.name }); // Execute ismaster _server.command( 'admin.$cmd', {...
javascript
function pingServer(_self, _server, cb) { // Measure running time var start = new Date().getTime(); // Emit the server heartbeat start emitSDAMEvent(self, 'serverHeartbeatStarted', { connectionId: _server.name }); // Execute ismaster _server.command( 'admin.$cmd', {...
[ "function", "pingServer", "(", "_self", ",", "_server", ",", "cb", ")", "{", "// Measure running time", "var", "start", "=", "new", "Date", "(", ")", ".", "getTime", "(", ")", ";", "// Emit the server heartbeat start", "emitSDAMEvent", "(", "self", ",", "'serv...
If the count is zero schedule a new fast
[ "If", "the", "count", "is", "zero", "schedule", "a", "new", "fast" ]
bcb87caa89f5841272955fb4b320f75d632856f7
https://github.com/mongodb-js/mongodb-core/blob/bcb87caa89f5841272955fb4b320f75d632856f7/lib/topologies/mongos.js#L676-L730
13,881
mongodb-js/mongodb-core
lib/topologies/shared.js
resolveClusterTime
function resolveClusterTime(topology, $clusterTime) { if (topology.clusterTime == null) { topology.clusterTime = $clusterTime; } else { if ($clusterTime.clusterTime.greaterThan(topology.clusterTime.clusterTime)) { topology.clusterTime = $clusterTime; } } }
javascript
function resolveClusterTime(topology, $clusterTime) { if (topology.clusterTime == null) { topology.clusterTime = $clusterTime; } else { if ($clusterTime.clusterTime.greaterThan(topology.clusterTime.clusterTime)) { topology.clusterTime = $clusterTime; } } }
[ "function", "resolveClusterTime", "(", "topology", ",", "$clusterTime", ")", "{", "if", "(", "topology", ".", "clusterTime", "==", "null", ")", "{", "topology", ".", "clusterTime", "=", "$clusterTime", ";", "}", "else", "{", "if", "(", "$clusterTime", ".", ...
Shared function to determine clusterTime for a given topology @param {*} topology @param {*} clusterTime
[ "Shared", "function", "to", "determine", "clusterTime", "for", "a", "given", "topology" ]
bcb87caa89f5841272955fb4b320f75d632856f7
https://github.com/mongodb-js/mongodb-core/blob/bcb87caa89f5841272955fb4b320f75d632856f7/lib/topologies/shared.js#L366-L374
13,882
mongodb-js/mongodb-core
lib/topologies/shared.js
function(topology) { const maxWireVersion = topology.lastIsMaster().maxWireVersion; if (maxWireVersion < RETRYABLE_WIRE_VERSION) { return false; } if (!topology.logicalSessionTimeoutMinutes) { return false; } if (topologyType(topology) === TopologyType.Single) { return false; } return tru...
javascript
function(topology) { const maxWireVersion = topology.lastIsMaster().maxWireVersion; if (maxWireVersion < RETRYABLE_WIRE_VERSION) { return false; } if (!topology.logicalSessionTimeoutMinutes) { return false; } if (topologyType(topology) === TopologyType.Single) { return false; } return tru...
[ "function", "(", "topology", ")", "{", "const", "maxWireVersion", "=", "topology", ".", "lastIsMaster", "(", ")", ".", "maxWireVersion", ";", "if", "(", "maxWireVersion", "<", "RETRYABLE_WIRE_VERSION", ")", "{", "return", "false", ";", "}", "if", "(", "!", ...
Determines whether the provided topology supports retryable writes @param {Mongos|Replset} topology
[ "Determines", "whether", "the", "provided", "topology", "supports", "retryable", "writes" ]
bcb87caa89f5841272955fb4b320f75d632856f7
https://github.com/mongodb-js/mongodb-core/blob/bcb87caa89f5841272955fb4b320f75d632856f7/lib/topologies/shared.js#L423-L438
13,883
mongodb-js/mongodb-core
lib/topologies/replset_state.js
function(readPreference, servers) { if (readPreference.tags == null) return servers; var filteredServers = []; var tagsArray = Array.isArray(readPreference.tags) ? readPreference.tags : [readPreference.tags]; // Iterate over the tags for (var j = 0; j < tagsArray.length; j++) { var tags = tagsArray[j]; ...
javascript
function(readPreference, servers) { if (readPreference.tags == null) return servers; var filteredServers = []; var tagsArray = Array.isArray(readPreference.tags) ? readPreference.tags : [readPreference.tags]; // Iterate over the tags for (var j = 0; j < tagsArray.length; j++) { var tags = tagsArray[j]; ...
[ "function", "(", "readPreference", ",", "servers", ")", "{", "if", "(", "readPreference", ".", "tags", "==", "null", ")", "return", "servers", ";", "var", "filteredServers", "=", "[", "]", ";", "var", "tagsArray", "=", "Array", ".", "isArray", "(", "read...
Filter serves by tags
[ "Filter", "serves", "by", "tags" ]
bcb87caa89f5841272955fb4b320f75d632856f7
https://github.com/mongodb-js/mongodb-core/blob/bcb87caa89f5841272955fb4b320f75d632856f7/lib/topologies/replset_state.js#L837-L868
13,884
mongodb-js/mongodb-core
lib/topologies/server.js
function(options) { options = options || {}; // Add event listener EventEmitter.call(this); // Server instance id this.id = id++; // Internal state this.s = { // Options options: options, // Logger logger: Logger('Server', options), // Factory overrides Cursor: options.cursorFac...
javascript
function(options) { options = options || {}; // Add event listener EventEmitter.call(this); // Server instance id this.id = id++; // Internal state this.s = { // Options options: options, // Logger logger: Logger('Server', options), // Factory overrides Cursor: options.cursorFac...
[ "function", "(", "options", ")", "{", "options", "=", "options", "||", "{", "}", ";", "// Add event listener", "EventEmitter", ".", "call", "(", "this", ")", ";", "// Server instance id", "this", ".", "id", "=", "id", "++", ";", "// Internal state", "this", ...
Creates a new Server instance @class @param {boolean} [options.reconnect=true] Server will attempt to reconnect on loss of connection @param {number} [options.reconnectTries=30] Server attempt to reconnect #times @param {number} [options.reconnectInterval=1000] Server will wait # milliseconds between retries @param {nu...
[ "Creates", "a", "new", "Server", "instance" ]
bcb87caa89f5841272955fb4b320f75d632856f7
https://github.com/mongodb-js/mongodb-core/blob/bcb87caa89f5841272955fb4b320f75d632856f7/lib/topologies/server.js#L107-L186
13,885
mongodb-js/mongodb-core
lib/wireprotocol/shared.js
function(message) { return { length: message.readInt32LE(0), requestId: message.readInt32LE(4), responseTo: message.readInt32LE(8), opCode: message.readInt32LE(12) }; }
javascript
function(message) { return { length: message.readInt32LE(0), requestId: message.readInt32LE(4), responseTo: message.readInt32LE(8), opCode: message.readInt32LE(12) }; }
[ "function", "(", "message", ")", "{", "return", "{", "length", ":", "message", ".", "readInt32LE", "(", "0", ")", ",", "requestId", ":", "message", ".", "readInt32LE", "(", "4", ")", ",", "responseTo", ":", "message", ".", "readInt32LE", "(", "8", ")",...
Parses the header of a wire protocol message
[ "Parses", "the", "header", "of", "a", "wire", "protocol", "message" ]
bcb87caa89f5841272955fb4b320f75d632856f7
https://github.com/mongodb-js/mongodb-core/blob/bcb87caa89f5841272955fb4b320f75d632856f7/lib/wireprotocol/shared.js#L45-L52
13,886
DoctorMcKay/node-steam-user
components/connection_protocols/tcp.js
TCPConnection
function TCPConnection(user) { this.user = user; // Pick a CM randomly if (!user._cmList || !user._cmList.tcp_servers) { throw new Error("Nothing to connect to: " + (user._cmList ? "no TCP server list" : "no CM list")); } let tcpCm = user._cmList.tcp_servers[Math.floor(Math.random() * user._cmList.tcp_servers....
javascript
function TCPConnection(user) { this.user = user; // Pick a CM randomly if (!user._cmList || !user._cmList.tcp_servers) { throw new Error("Nothing to connect to: " + (user._cmList ? "no TCP server list" : "no CM list")); } let tcpCm = user._cmList.tcp_servers[Math.floor(Math.random() * user._cmList.tcp_servers....
[ "function", "TCPConnection", "(", "user", ")", "{", "this", ".", "user", "=", "user", ";", "// Pick a CM randomly", "if", "(", "!", "user", ".", "_cmList", "||", "!", "user", ".", "_cmList", ".", "tcp_servers", ")", "{", "throw", "new", "Error", "(", "...
Create a new TCP connection, and connect @param {SteamUser} user @constructor
[ "Create", "a", "new", "TCP", "connection", "and", "connect" ]
a58d91287cde03873a26cd12fee64fbd6ff3edd7
https://github.com/DoctorMcKay/node-steam-user/blob/a58d91287cde03873a26cd12fee64fbd6ff3edd7/components/connection_protocols/tcp.js#L19-L90
13,887
DoctorMcKay/node-steam-user
components/chat.js
toChatID
function toChatID(steamID) { steamID = Helpers.steamID(steamID); if (steamID.type == SteamID.Type.CLAN) { steamID.type = SteamID.Type.CHAT; steamID.instance |= SteamID.ChatInstanceFlags.Clan; } return steamID; }
javascript
function toChatID(steamID) { steamID = Helpers.steamID(steamID); if (steamID.type == SteamID.Type.CLAN) { steamID.type = SteamID.Type.CHAT; steamID.instance |= SteamID.ChatInstanceFlags.Clan; } return steamID; }
[ "function", "toChatID", "(", "steamID", ")", "{", "steamID", "=", "Helpers", ".", "steamID", "(", "steamID", ")", ";", "if", "(", "steamID", ".", "type", "==", "SteamID", ".", "Type", ".", "CLAN", ")", "{", "steamID", ".", "type", "=", "SteamID", "."...
Private functions If steamID is a clan ID, converts to the appropriate chat ID. Otherwise, returns it untouched. @param {SteamID} steamID @returns SteamID
[ "Private", "functions", "If", "steamID", "is", "a", "clan", "ID", "converts", "to", "the", "appropriate", "chat", "ID", ".", "Otherwise", "returns", "it", "untouched", "." ]
a58d91287cde03873a26cd12fee64fbd6ff3edd7
https://github.com/DoctorMcKay/node-steam-user/blob/a58d91287cde03873a26cd12fee64fbd6ff3edd7/components/chat.js#L512-L521
13,888
DoctorMcKay/node-steam-user
components/chat.js
fromChatID
function fromChatID(steamID) { steamID = Helpers.steamID(steamID); if (steamID.isGroupChat()) { steamID.type = SteamID.Type.CLAN; steamID.instance &= ~SteamID.ChatInstanceFlags.Clan; } return steamID; }
javascript
function fromChatID(steamID) { steamID = Helpers.steamID(steamID); if (steamID.isGroupChat()) { steamID.type = SteamID.Type.CLAN; steamID.instance &= ~SteamID.ChatInstanceFlags.Clan; } return steamID; }
[ "function", "fromChatID", "(", "steamID", ")", "{", "steamID", "=", "Helpers", ".", "steamID", "(", "steamID", ")", ";", "if", "(", "steamID", ".", "isGroupChat", "(", ")", ")", "{", "steamID", ".", "type", "=", "SteamID", ".", "Type", ".", "CLAN", "...
If steamID is a clan chat ID, converts to the appropriate clan ID. Otherwise, returns it untouched. @param {SteamID} steamID @returns SteamID
[ "If", "steamID", "is", "a", "clan", "chat", "ID", "converts", "to", "the", "appropriate", "clan", "ID", ".", "Otherwise", "returns", "it", "untouched", "." ]
a58d91287cde03873a26cd12fee64fbd6ff3edd7
https://github.com/DoctorMcKay/node-steam-user/blob/a58d91287cde03873a26cd12fee64fbd6ff3edd7/components/chat.js#L528-L537
13,889
DoctorMcKay/node-steam-user
components/chat.js
decomposeChatFlags
function decomposeChatFlags(chat, chatFlags) { chat.private = !!(chatFlags & SteamUser.EChatFlags.Locked); chat.invisibleToFriends = !!(chatFlags & SteamUser.EChatFlags.InvisibleToFriends); chat.officersOnlyChat = !!(chatFlags & SteamUser.EChatFlags.Moderated); chat.unjoinable = !!(chatFlags & SteamUser.EChatFlags....
javascript
function decomposeChatFlags(chat, chatFlags) { chat.private = !!(chatFlags & SteamUser.EChatFlags.Locked); chat.invisibleToFriends = !!(chatFlags & SteamUser.EChatFlags.InvisibleToFriends); chat.officersOnlyChat = !!(chatFlags & SteamUser.EChatFlags.Moderated); chat.unjoinable = !!(chatFlags & SteamUser.EChatFlags....
[ "function", "decomposeChatFlags", "(", "chat", ",", "chatFlags", ")", "{", "chat", ".", "private", "=", "!", "!", "(", "chatFlags", "&", "SteamUser", ".", "EChatFlags", ".", "Locked", ")", ";", "chat", ".", "invisibleToFriends", "=", "!", "!", "(", "chat...
Converts chat flags into properties on a chat room object @param {Object} chat @param {number} chatFlags
[ "Converts", "chat", "flags", "into", "properties", "on", "a", "chat", "room", "object" ]
a58d91287cde03873a26cd12fee64fbd6ff3edd7
https://github.com/DoctorMcKay/node-steam-user/blob/a58d91287cde03873a26cd12fee64fbd6ff3edd7/components/chat.js#L544-L549
13,890
DoctorMcKay/node-steam-user
components/chatroom.js
processChatRoomSummaryPair
function processChatRoomSummaryPair(summaryPair, preProcessed) { if (!preProcessed) { summaryPair = preProcessObject(summaryPair); } summaryPair.group_state = processUserChatGroupState(summaryPair.user_chat_group_state, true); summaryPair.group_summary = processChatGroupSummary(summaryPair.group_summary, true); ...
javascript
function processChatRoomSummaryPair(summaryPair, preProcessed) { if (!preProcessed) { summaryPair = preProcessObject(summaryPair); } summaryPair.group_state = processUserChatGroupState(summaryPair.user_chat_group_state, true); summaryPair.group_summary = processChatGroupSummary(summaryPair.group_summary, true); ...
[ "function", "processChatRoomSummaryPair", "(", "summaryPair", ",", "preProcessed", ")", "{", "if", "(", "!", "preProcessed", ")", "{", "summaryPair", "=", "preProcessObject", "(", "summaryPair", ")", ";", "}", "summaryPair", ".", "group_state", "=", "processUserCh...
Process a chat room summary pair. @param {object} summaryPair @param {boolean} [preProcessed=false] @returns {object}
[ "Process", "a", "chat", "room", "summary", "pair", "." ]
a58d91287cde03873a26cd12fee64fbd6ff3edd7
https://github.com/DoctorMcKay/node-steam-user/blob/a58d91287cde03873a26cd12fee64fbd6ff3edd7/components/chatroom.js#L678-L687
13,891
DoctorMcKay/node-steam-user
components/chatroom.js
processChatGroupSummary
function processChatGroupSummary(groupSummary, preProcessed) { if (!preProcessed) { groupSummary = preProcessObject(groupSummary); } if (groupSummary.top_members) { groupSummary.top_members = groupSummary.top_members.map(accountid => SteamID.fromIndividualAccountID(accountid)); } return groupSummary; }
javascript
function processChatGroupSummary(groupSummary, preProcessed) { if (!preProcessed) { groupSummary = preProcessObject(groupSummary); } if (groupSummary.top_members) { groupSummary.top_members = groupSummary.top_members.map(accountid => SteamID.fromIndividualAccountID(accountid)); } return groupSummary; }
[ "function", "processChatGroupSummary", "(", "groupSummary", ",", "preProcessed", ")", "{", "if", "(", "!", "preProcessed", ")", "{", "groupSummary", "=", "preProcessObject", "(", "groupSummary", ")", ";", "}", "if", "(", "groupSummary", ".", "top_members", ")", ...
Process a chat group summary. @param {object} groupSummary @param {boolean} [preProcessed=false] @returns {object}
[ "Process", "a", "chat", "group", "summary", "." ]
a58d91287cde03873a26cd12fee64fbd6ff3edd7
https://github.com/DoctorMcKay/node-steam-user/blob/a58d91287cde03873a26cd12fee64fbd6ff3edd7/components/chatroom.js#L695-L705
13,892
DoctorMcKay/node-steam-user
components/chatroom.js
preProcessObject
function preProcessObject(obj) { for (let key in obj) { if (!obj.hasOwnProperty(key)) { continue; } let val = obj[key]; if (key.match(/^steamid_/) && typeof val === 'string' && val != '0') { obj[key] = new SteamID(val.toString()); } else if (key == 'timestamp' || key.match(/^time_/) || key.match(/_tim...
javascript
function preProcessObject(obj) { for (let key in obj) { if (!obj.hasOwnProperty(key)) { continue; } let val = obj[key]; if (key.match(/^steamid_/) && typeof val === 'string' && val != '0') { obj[key] = new SteamID(val.toString()); } else if (key == 'timestamp' || key.match(/^time_/) || key.match(/_tim...
[ "function", "preProcessObject", "(", "obj", ")", "{", "for", "(", "let", "key", "in", "obj", ")", "{", "if", "(", "!", "obj", ".", "hasOwnProperty", "(", "key", ")", ")", "{", "continue", ";", "}", "let", "val", "=", "obj", "[", "key", "]", ";", ...
Pre-process a generic chat object. @param {object} obj @returns {object}
[ "Pre", "-", "process", "a", "generic", "chat", "object", "." ]
a58d91287cde03873a26cd12fee64fbd6ff3edd7
https://github.com/DoctorMcKay/node-steam-user/blob/a58d91287cde03873a26cd12fee64fbd6ff3edd7/components/chatroom.js#L763-L810
13,893
choojs/bankai
lib/graph-document.js
extractFonts
function extractFonts (state) { var list = String(state.list.buffer).split(',') var res = list.filter(function (font) { var extname = path.extname(font) return extname === '.woff' || extname === '.woff2' || extname === '.eot' || extname === '.ttf' }) return res }
javascript
function extractFonts (state) { var list = String(state.list.buffer).split(',') var res = list.filter(function (font) { var extname = path.extname(font) return extname === '.woff' || extname === '.woff2' || extname === '.eot' || extname === '.ttf' }) return res }
[ "function", "extractFonts", "(", "state", ")", "{", "var", "list", "=", "String", "(", "state", ".", "list", ".", "buffer", ")", ".", "split", "(", "','", ")", "var", "res", "=", "list", ".", "filter", "(", "function", "(", "font", ")", "{", "var",...
Specific to the document node's layout
[ "Specific", "to", "the", "document", "node", "s", "layout" ]
29cb370f3901316f66e9ee582d3a62305051b5be
https://github.com/choojs/bankai/blob/29cb370f3901316f66e9ee582d3a62305051b5be/lib/graph-document.js#L261-L274
13,894
choojs/bankai
lib/track-dir.js
init
function init (dirname, done) { dirname = path.join(basedir, dirname) fs.access(dirname, function (err) { if (err) return done() readdir(dirname, function (err, _list) { if (err) return done(err) list = list.concat(_list) done() }) }) }
javascript
function init (dirname, done) { dirname = path.join(basedir, dirname) fs.access(dirname, function (err) { if (err) return done() readdir(dirname, function (err, _list) { if (err) return done(err) list = list.concat(_list) done() }) }) }
[ "function", "init", "(", "dirname", ",", "done", ")", "{", "dirname", "=", "path", ".", "join", "(", "basedir", ",", "dirname", ")", "fs", ".", "access", "(", "dirname", ",", "function", "(", "err", ")", "{", "if", "(", "err", ")", "return", "done"...
Run only once at the start of the pass.
[ "Run", "only", "once", "at", "the", "start", "of", "the", "pass", "." ]
29cb370f3901316f66e9ee582d3a62305051b5be
https://github.com/choojs/bankai/blob/29cb370f3901316f66e9ee582d3a62305051b5be/lib/track-dir.js#L74-L84
13,895
kentcdodds/match-sorter
src/index.js
matchSorter
function matchSorter(items, value, options = {}) { // not performing any search/sort if value(search term) is empty if (!value) return items const {keys, threshold = rankings.MATCHES} = options const matchedItems = items.reduce(reduceItemsToRanked, []) return matchedItems.sort(sortRankedItems).map(({item}) =...
javascript
function matchSorter(items, value, options = {}) { // not performing any search/sort if value(search term) is empty if (!value) return items const {keys, threshold = rankings.MATCHES} = options const matchedItems = items.reduce(reduceItemsToRanked, []) return matchedItems.sort(sortRankedItems).map(({item}) =...
[ "function", "matchSorter", "(", "items", ",", "value", ",", "options", "=", "{", "}", ")", "{", "// not performing any search/sort if value(search term) is empty", "if", "(", "!", "value", ")", "return", "items", "const", "{", "keys", ",", "threshold", "=", "ran...
Takes an array of items and a value and returns a new array with the items that match the given value @param {Array} items - the items to sort @param {String} value - the value to use for ranking @param {Object} options - Some options to configure the sorter @return {Array} - the new sorted array
[ "Takes", "an", "array", "of", "items", "and", "a", "value", "and", "returns", "a", "new", "array", "with", "the", "items", "that", "match", "the", "given", "value" ]
fa454c568c6b5f117a85855806e4754daf5961a0
https://github.com/kentcdodds/match-sorter/blob/fa454c568c6b5f117a85855806e4754daf5961a0/src/index.js#L40-L60
13,896
kentcdodds/match-sorter
src/index.js
getHighestRanking
function getHighestRanking(item, keys, value, options) { if (!keys) { return { rank: getMatchRanking(item, value, options), keyIndex: -1, keyThreshold: options.threshold, } } const valuesToRank = getAllValuesToRank(item, keys) return valuesToRank.reduce( ({rank, keyIndex, keyThresh...
javascript
function getHighestRanking(item, keys, value, options) { if (!keys) { return { rank: getMatchRanking(item, value, options), keyIndex: -1, keyThreshold: options.threshold, } } const valuesToRank = getAllValuesToRank(item, keys) return valuesToRank.reduce( ({rank, keyIndex, keyThresh...
[ "function", "getHighestRanking", "(", "item", ",", "keys", ",", "value", ",", "options", ")", "{", "if", "(", "!", "keys", ")", "{", "return", "{", "rank", ":", "getMatchRanking", "(", "item", ",", "value", ",", "options", ")", ",", "keyIndex", ":", ...
Gets the highest ranking for value for the given item based on its values for the given keys @param {*} item - the item to rank @param {Array} keys - the keys to get values from the item for the ranking @param {String} value - the value to rank against @param {Object} options - options to control the ranking @return {{...
[ "Gets", "the", "highest", "ranking", "for", "value", "for", "the", "given", "item", "based", "on", "its", "values", "for", "the", "given", "keys" ]
fa454c568c6b5f117a85855806e4754daf5961a0
https://github.com/kentcdodds/match-sorter/blob/fa454c568c6b5f117a85855806e4754daf5961a0/src/index.js#L70-L97
13,897
kentcdodds/match-sorter
src/index.js
getMatchRanking
function getMatchRanking(testString, stringToRank, options) { /* eslint complexity:[2, 12] */ testString = prepareValueForComparison(testString, options) stringToRank = prepareValueForComparison(stringToRank, options) // too long if (stringToRank.length > testString.length) { return rankings.NO_MATCH }...
javascript
function getMatchRanking(testString, stringToRank, options) { /* eslint complexity:[2, 12] */ testString = prepareValueForComparison(testString, options) stringToRank = prepareValueForComparison(stringToRank, options) // too long if (stringToRank.length > testString.length) { return rankings.NO_MATCH }...
[ "function", "getMatchRanking", "(", "testString", ",", "stringToRank", ",", "options", ")", "{", "/* eslint complexity:[2, 12] */", "testString", "=", "prepareValueForComparison", "(", "testString", ",", "options", ")", "stringToRank", "=", "prepareValueForComparison", "(...
Gives a rankings score based on how well the two strings match. @param {String} testString - the string to test against @param {String} stringToRank - the string to rank @param {Object} options - options for the match (like keepDiacritics for comparison) @returns {Number} the ranking for how well stringToRank matches t...
[ "Gives", "a", "rankings", "score", "based", "on", "how", "well", "the", "two", "strings", "match", "." ]
fa454c568c6b5f117a85855806e4754daf5961a0
https://github.com/kentcdodds/match-sorter/blob/fa454c568c6b5f117a85855806e4754daf5961a0/src/index.js#L106-L172
13,898
kentcdodds/match-sorter
src/index.js
getCaseRanking
function getCaseRanking(testString) { const containsUpperCase = testString.toLowerCase() !== testString const containsDash = testString.indexOf('-') >= 0 const containsUnderscore = testString.indexOf('_') >= 0 if (!containsUpperCase && !containsUnderscore && containsDash) { return caseRankings.KEBAB } ...
javascript
function getCaseRanking(testString) { const containsUpperCase = testString.toLowerCase() !== testString const containsDash = testString.indexOf('-') >= 0 const containsUnderscore = testString.indexOf('_') >= 0 if (!containsUpperCase && !containsUnderscore && containsDash) { return caseRankings.KEBAB } ...
[ "function", "getCaseRanking", "(", "testString", ")", "{", "const", "containsUpperCase", "=", "testString", ".", "toLowerCase", "(", ")", "!==", "testString", "const", "containsDash", "=", "testString", ".", "indexOf", "(", "'-'", ")", ">=", "0", "const", "con...
Returns a score base on the case of the testString @param {String} testString - the string to test against @returns {Number} the number of the ranking, based on the case between 0 and 1 for how the testString matches the case
[ "Returns", "a", "score", "base", "on", "the", "case", "of", "the", "testString" ]
fa454c568c6b5f117a85855806e4754daf5961a0
https://github.com/kentcdodds/match-sorter/blob/fa454c568c6b5f117a85855806e4754daf5961a0/src/index.js#L198-L221
13,899
kentcdodds/match-sorter
src/index.js
isCaseAcronym
function isCaseAcronym(testString, stringToRank, caseRank) { let splitValue = null switch (caseRank) { case caseRankings.SNAKE: splitValue = '_' break case caseRankings.KEBAB: splitValue = '-' break case caseRankings.PASCAL: case caseRankings.CAMEL: splitValue = /(?=[A-...
javascript
function isCaseAcronym(testString, stringToRank, caseRank) { let splitValue = null switch (caseRank) { case caseRankings.SNAKE: splitValue = '_' break case caseRankings.KEBAB: splitValue = '-' break case caseRankings.PASCAL: case caseRankings.CAMEL: splitValue = /(?=[A-...
[ "function", "isCaseAcronym", "(", "testString", ",", "stringToRank", ",", "caseRank", ")", "{", "let", "splitValue", "=", "null", "switch", "(", "caseRank", ")", "{", "case", "caseRankings", ".", "SNAKE", ":", "splitValue", "=", "'_'", "break", "case", "case...
Check if stringToRank is an acronym for a partial case @example // returns true isCaseAcronym('super_duper_file', 'sdf', caseRankings.SNAKE) @param {String} testString - the string to test against @param {String} stringToRank - the acronym to test @param {Number} caseRank - the ranking of the case @returns {Boolean} wh...
[ "Check", "if", "stringToRank", "is", "an", "acronym", "for", "a", "partial", "case" ]
fa454c568c6b5f117a85855806e4754daf5961a0
https://github.com/kentcdodds/match-sorter/blob/fa454c568c6b5f117a85855806e4754daf5961a0/src/index.js#L265-L290