repo stringlengths 5 67 | path stringlengths 4 116 | func_name stringlengths 0 58 | original_string stringlengths 52 373k | language stringclasses 1
value | code stringlengths 52 373k | code_tokens list | docstring stringlengths 4 11.8k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 86 226 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
KingSora/OverlayScrollbars | js/OverlayScrollbars.js | isHTMLElement | function isHTMLElement(o) {
var strOwnerDocument = 'ownerDocument';
var strHTMLElement = 'HTMLElement';
var wnd = o && o[strOwnerDocument] ? (o[strOwnerDocument].parentWindow || window) : window;
return (
typeof wnd[... | javascript | function isHTMLElement(o) {
var strOwnerDocument = 'ownerDocument';
var strHTMLElement = 'HTMLElement';
var wnd = o && o[strOwnerDocument] ? (o[strOwnerDocument].parentWindow || window) : window;
return (
typeof wnd[... | [
"function",
"isHTMLElement",
"(",
"o",
")",
"{",
"var",
"strOwnerDocument",
"=",
"'ownerDocument'",
";",
"var",
"strHTMLElement",
"=",
"'HTMLElement'",
";",
"var",
"wnd",
"=",
"o",
"&&",
"o",
"[",
"strOwnerDocument",
"]",
"?",
"(",
"o",
"[",
"strOwnerDocumen... | Checks whether the given object is a HTMLElement.
@param o The object which shall be checked.
@returns {boolean} True the given object is a HTMLElement, false otherwise. | [
"Checks",
"whether",
"the",
"given",
"object",
"is",
"a",
"HTMLElement",
"."
] | 8e658d46e2d034a2525269d7c873bbe844762307 | https://github.com/KingSora/OverlayScrollbars/blob/8e658d46e2d034a2525269d7c873bbe844762307/js/OverlayScrollbars.js#L5080-L5088 | train |
KingSora/OverlayScrollbars | js/OverlayScrollbars.js | getArrayDifferences | function getArrayDifferences(a1, a2) {
var a = [ ];
var diff = [ ];
var i;
var k;
for (i = 0; i < a1.length; i++)
a[a1[i]] = true;
for (i = 0; i < a2.length; i++) {
... | javascript | function getArrayDifferences(a1, a2) {
var a = [ ];
var diff = [ ];
var i;
var k;
for (i = 0; i < a1.length; i++)
a[a1[i]] = true;
for (i = 0; i < a2.length; i++) {
... | [
"function",
"getArrayDifferences",
"(",
"a1",
",",
"a2",
")",
"{",
"var",
"a",
"=",
"[",
"]",
";",
"var",
"diff",
"=",
"[",
"]",
";",
"var",
"i",
";",
"var",
"k",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"a1",
".",
"length",
";",
"i",... | Compares 2 arrays and returns the differences between them as a array.
@param a1 The first array which shall be compared.
@param a2 The second array which shall be compared.
@returns {Array} The differences between the two arrays. | [
"Compares",
"2",
"arrays",
"and",
"returns",
"the",
"differences",
"between",
"them",
"as",
"a",
"array",
"."
] | 8e658d46e2d034a2525269d7c873bbe844762307 | https://github.com/KingSora/OverlayScrollbars/blob/8e658d46e2d034a2525269d7c873bbe844762307/js/OverlayScrollbars.js#L5096-L5112 | train |
KingSora/OverlayScrollbars | js/OverlayScrollbars.js | parseToZeroOrNumber | function parseToZeroOrNumber(value, toFloat) {
var num = toFloat ? parseFloat(value) : parseInt(value, 10);
return isNaN(num) ? 0 : num;
} | javascript | function parseToZeroOrNumber(value, toFloat) {
var num = toFloat ? parseFloat(value) : parseInt(value, 10);
return isNaN(num) ? 0 : num;
} | [
"function",
"parseToZeroOrNumber",
"(",
"value",
",",
"toFloat",
")",
"{",
"var",
"num",
"=",
"toFloat",
"?",
"parseFloat",
"(",
"value",
")",
":",
"parseInt",
"(",
"value",
",",
"10",
")",
";",
"return",
"isNaN",
"(",
"num",
")",
"?",
"0",
":",
"num... | Returns Zero or the number to which the value can be parsed.
@param value The value which shall be parsed.
@param toFloat Indicates whether the number shall be parsed to a float. | [
"Returns",
"Zero",
"or",
"the",
"number",
"to",
"which",
"the",
"value",
"can",
"be",
"parsed",
"."
] | 8e658d46e2d034a2525269d7c873bbe844762307 | https://github.com/KingSora/OverlayScrollbars/blob/8e658d46e2d034a2525269d7c873bbe844762307/js/OverlayScrollbars.js#L5119-L5122 | train |
KingSora/OverlayScrollbars | js/OverlayScrollbars.js | getTextareaInfo | function getTextareaInfo() {
//read needed values
var textareaCursorPosition = _targetElementNative.selectionStart;
if (textareaCursorPosition === undefined)
return;
var strLength = 'length';
var... | javascript | function getTextareaInfo() {
//read needed values
var textareaCursorPosition = _targetElementNative.selectionStart;
if (textareaCursorPosition === undefined)
return;
var strLength = 'length';
var... | [
"function",
"getTextareaInfo",
"(",
")",
"{",
"//read needed values",
"var",
"textareaCursorPosition",
"=",
"_targetElementNative",
".",
"selectionStart",
";",
"if",
"(",
"textareaCursorPosition",
"===",
"undefined",
")",
"return",
";",
"var",
"strLength",
"=",
"'leng... | Gets several information of the textarea and returns them as a object or undefined if the browser doesn't support it.
@returns {{cursorRow: Number, cursorCol, rows: Number, cols: number, wRow: number, pos: number, max : number}} or undefined if not supported. | [
"Gets",
"several",
"information",
"of",
"the",
"textarea",
"and",
"returns",
"them",
"as",
"a",
"object",
"or",
"undefined",
"if",
"the",
"browser",
"doesn",
"t",
"support",
"it",
"."
] | 8e658d46e2d034a2525269d7c873bbe844762307 | https://github.com/KingSora/OverlayScrollbars/blob/8e658d46e2d034a2525269d7c873bbe844762307/js/OverlayScrollbars.js#L5128-L5165 | train |
KingSora/OverlayScrollbars | js/OverlayScrollbars.js | generateDiv | function generateDiv(classesOrAttrs, content) {
return '<div ' + (classesOrAttrs ? type(classesOrAttrs) == TYPES.s ?
'class="' + classesOrAttrs + '"' :
(function() {
var key;
var attrs... | javascript | function generateDiv(classesOrAttrs, content) {
return '<div ' + (classesOrAttrs ? type(classesOrAttrs) == TYPES.s ?
'class="' + classesOrAttrs + '"' :
(function() {
var key;
var attrs... | [
"function",
"generateDiv",
"(",
"classesOrAttrs",
",",
"content",
")",
"{",
"return",
"'<div '",
"+",
"(",
"classesOrAttrs",
"?",
"type",
"(",
"classesOrAttrs",
")",
"==",
"TYPES",
".",
"s",
"?",
"'class=\"'",
"+",
"classesOrAttrs",
"+",
"'\"'",
":",
"(",
... | Generates a string which represents a HTML div with the given classes or attributes.
@param classesOrAttrs The class of the div as string or a object which represents the attributes of the div. (The class attribute can also be written as "className".)
@param content The content of the div as string.
@returns {string} T... | [
"Generates",
"a",
"string",
"which",
"represents",
"a",
"HTML",
"div",
"with",
"the",
"given",
"classes",
"or",
"attributes",
"."
] | 8e658d46e2d034a2525269d7c873bbe844762307 | https://github.com/KingSora/OverlayScrollbars/blob/8e658d46e2d034a2525269d7c873bbe844762307/js/OverlayScrollbars.js#L5189-L5205 | train |
KingSora/OverlayScrollbars | js/OverlayScrollbars.js | getObjectPropVal | function getObjectPropVal(obj, path) {
var splits = path.split(_strDot);
var i = 0;
var val;
for(; i < splits.length; i++) {
if(!obj.hasOwnProperty(splits[i]))
return;
... | javascript | function getObjectPropVal(obj, path) {
var splits = path.split(_strDot);
var i = 0;
var val;
for(; i < splits.length; i++) {
if(!obj.hasOwnProperty(splits[i]))
return;
... | [
"function",
"getObjectPropVal",
"(",
"obj",
",",
"path",
")",
"{",
"var",
"splits",
"=",
"path",
".",
"split",
"(",
"_strDot",
")",
";",
"var",
"i",
"=",
"0",
";",
"var",
"val",
";",
"for",
"(",
";",
"i",
"<",
"splits",
".",
"length",
";",
"i",
... | Gets the value of the given property from the given object.
@param obj The object from which the property value shall be got.
@param path The property of which the value shall be got.
@returns {*} Returns the value of the searched property or undefined of the property wasn't found. | [
"Gets",
"the",
"value",
"of",
"the",
"given",
"property",
"from",
"the",
"given",
"object",
"."
] | 8e658d46e2d034a2525269d7c873bbe844762307 | https://github.com/KingSora/OverlayScrollbars/blob/8e658d46e2d034a2525269d7c873bbe844762307/js/OverlayScrollbars.js#L5213-L5225 | train |
KingSora/OverlayScrollbars | js/OverlayScrollbars.js | setObjectPropVal | function setObjectPropVal(obj, path, val) {
var splits = path.split(_strDot);
var splitsLength = splits.length;
var i = 0;
var extendObj = { };
var extendObjRoot = extendObj;
for(; i < splitsLength; i... | javascript | function setObjectPropVal(obj, path, val) {
var splits = path.split(_strDot);
var splitsLength = splits.length;
var i = 0;
var extendObj = { };
var extendObjRoot = extendObj;
for(; i < splitsLength; i... | [
"function",
"setObjectPropVal",
"(",
"obj",
",",
"path",
",",
"val",
")",
"{",
"var",
"splits",
"=",
"path",
".",
"split",
"(",
"_strDot",
")",
";",
"var",
"splitsLength",
"=",
"splits",
".",
"length",
";",
"var",
"i",
"=",
"0",
";",
"var",
"extendOb... | Sets the value of the given property from the given object.
@param obj The object from which the property value shall be set.
@param path The property of which the value shall be set.
@param val The value of the property which shall be set. | [
"Sets",
"the",
"value",
"of",
"the",
"given",
"property",
"from",
"the",
"given",
"object",
"."
] | 8e658d46e2d034a2525269d7c873bbe844762307 | https://github.com/KingSora/OverlayScrollbars/blob/8e658d46e2d034a2525269d7c873bbe844762307/js/OverlayScrollbars.js#L5233-L5242 | train |
KingSora/OverlayScrollbars | js/OverlayScrollbars.js | checkCacheDouble | function checkCacheDouble(current, cache, prop1, prop2, force) {
if (force === true)
return force;
if (prop2 === undefined && force === undefined) {
if (prop1 === true)
return prop1;
... | javascript | function checkCacheDouble(current, cache, prop1, prop2, force) {
if (force === true)
return force;
if (prop2 === undefined && force === undefined) {
if (prop1 === true)
return prop1;
... | [
"function",
"checkCacheDouble",
"(",
"current",
",",
"cache",
",",
"prop1",
",",
"prop2",
",",
"force",
")",
"{",
"if",
"(",
"force",
"===",
"true",
")",
"return",
"force",
";",
"if",
"(",
"prop2",
"===",
"undefined",
"&&",
"force",
"===",
"undefined",
... | Compares two objects with two properties and returns the result of the comparison as a boolean.
@param current The first object which shall be compared.
@param cache The second object which shall be compared.
@param prop1 The name of the first property of the objects which shall be compared.
@param prop2 The name of th... | [
"Compares",
"two",
"objects",
"with",
"two",
"properties",
"and",
"returns",
"the",
"result",
"of",
"the",
"comparison",
"as",
"a",
"boolean",
"."
] | 8e658d46e2d034a2525269d7c873bbe844762307 | https://github.com/KingSora/OverlayScrollbars/blob/8e658d46e2d034a2525269d7c873bbe844762307/js/OverlayScrollbars.js#L5273-L5289 | train |
KingSora/OverlayScrollbars | js/OverlayScrollbars.js | checkCacheTRBL | function checkCacheTRBL(current, cache) {
if (cache === undefined)
return true;
else if (current.t !== cache.t ||
current.r !== cache.r ||
current.b !== cache.b ||
current.l !== cache.... | javascript | function checkCacheTRBL(current, cache) {
if (cache === undefined)
return true;
else if (current.t !== cache.t ||
current.r !== cache.r ||
current.b !== cache.b ||
current.l !== cache.... | [
"function",
"checkCacheTRBL",
"(",
"current",
",",
"cache",
")",
"{",
"if",
"(",
"cache",
"===",
"undefined",
")",
"return",
"true",
";",
"else",
"if",
"(",
"current",
".",
"t",
"!==",
"cache",
".",
"t",
"||",
"current",
".",
"r",
"!==",
"cache",
"."... | Compares two objects which have four properties and returns the result of the comparison as a boolean.
@param current The first object with four properties.
@param cache The second object with four properties.
@returns {boolean} True if both objects aren't equal or some of them is undefined, false otherwise. | [
"Compares",
"two",
"objects",
"which",
"have",
"four",
"properties",
"and",
"returns",
"the",
"result",
"of",
"the",
"comparison",
"as",
"a",
"boolean",
"."
] | 8e658d46e2d034a2525269d7c873bbe844762307 | https://github.com/KingSora/OverlayScrollbars/blob/8e658d46e2d034a2525269d7c873bbe844762307/js/OverlayScrollbars.js#L5297-L5306 | train |
ipfs/aegir | src/release/prerelease.js | validGh | function validGh (opts) {
if (!opts.ghrelease) {
return Promise.resolve(true)
}
if (!opts.ghtoken) {
return Promise.reject(new Error('Missing GitHub access token. ' +
'Have you set `AEGIR_GHTOKEN`?'))
}
return Promise.resolve()
} | javascript | function validGh (opts) {
if (!opts.ghrelease) {
return Promise.resolve(true)
}
if (!opts.ghtoken) {
return Promise.reject(new Error('Missing GitHub access token. ' +
'Have you set `AEGIR_GHTOKEN`?'))
}
return Promise.resolve()
} | [
"function",
"validGh",
"(",
"opts",
")",
"{",
"if",
"(",
"!",
"opts",
".",
"ghrelease",
")",
"{",
"return",
"Promise",
".",
"resolve",
"(",
"true",
")",
"}",
"if",
"(",
"!",
"opts",
".",
"ghtoken",
")",
"{",
"return",
"Promise",
".",
"reject",
"(",... | Check if there are valid GitHub credentials for publishing this module | [
"Check",
"if",
"there",
"are",
"valid",
"GitHub",
"credentials",
"for",
"publishing",
"this",
"module"
] | 1cb8cf217bc03524f7f2caaa248b1b99d700d402 | https://github.com/ipfs/aegir/blob/1cb8cf217bc03524f7f2caaa248b1b99d700d402/src/release/prerelease.js#L7-L17 | train |
ipfs/aegir | src/release/prerelease.js | isDirty | function isDirty () {
return pify(git.raw.bind(git))(['status', '-s'])
.then((out) => {
if (out && out.trim().length > 0) {
throw new Error('Dirty git repo, aborting')
}
})
} | javascript | function isDirty () {
return pify(git.raw.bind(git))(['status', '-s'])
.then((out) => {
if (out && out.trim().length > 0) {
throw new Error('Dirty git repo, aborting')
}
})
} | [
"function",
"isDirty",
"(",
")",
"{",
"return",
"pify",
"(",
"git",
".",
"raw",
".",
"bind",
"(",
"git",
")",
")",
"(",
"[",
"'status'",
",",
"'-s'",
"]",
")",
".",
"then",
"(",
"(",
"out",
")",
"=>",
"{",
"if",
"(",
"out",
"&&",
"out",
".",
... | Is the current git workspace dirty? | [
"Is",
"the",
"current",
"git",
"workspace",
"dirty?"
] | 1cb8cf217bc03524f7f2caaa248b1b99d700d402 | https://github.com/ipfs/aegir/blob/1cb8cf217bc03524f7f2caaa248b1b99d700d402/src/release/prerelease.js#L20-L27 | train |
snowflakedb/snowflake-connector-nodejs | lib/agent/socket_util.js | isOcspValidationDisabled | function isOcspValidationDisabled(host)
{
// ocsp is disabled if insecure-connect is enabled, or if we've disabled ocsp
// for non-snowflake endpoints and the host is a non-snowflake endpoint
return GlobalConfig.isInsecureConnect() || (Parameters.getValue(
Parameters.names.JS_DRIVER_DISABLE_OCSP_FOR_NON... | javascript | function isOcspValidationDisabled(host)
{
// ocsp is disabled if insecure-connect is enabled, or if we've disabled ocsp
// for non-snowflake endpoints and the host is a non-snowflake endpoint
return GlobalConfig.isInsecureConnect() || (Parameters.getValue(
Parameters.names.JS_DRIVER_DISABLE_OCSP_FOR_NON... | [
"function",
"isOcspValidationDisabled",
"(",
"host",
")",
"{",
"// ocsp is disabled if insecure-connect is enabled, or if we've disabled ocsp",
"// for non-snowflake endpoints and the host is a non-snowflake endpoint",
"return",
"GlobalConfig",
".",
"isInsecureConnect",
"(",
")",
"||",
... | Determines if ocsp validation is disabled for a given host.
@param {String} host
@returns {boolean} | [
"Determines",
"if",
"ocsp",
"validation",
"is",
"disabled",
"for",
"a",
"given",
"host",
"."
] | 7ad71410a3bb679a96021b6b2d5b9b515f790db8 | https://github.com/snowflakedb/snowflake-connector-nodejs/blob/7ad71410a3bb679a96021b6b2d5b9b515f790db8/lib/agent/socket_util.js#L82-L89 | train |
snowflakedb/snowflake-connector-nodejs | lib/agent/socket_util.js | validateCertChain | function validateCertChain(cert, cb)
{
// walk up the certificate chain and collect all the certificates in an array
var certs = [];
while (cert && cert.issuerCertificate &&
(cert.fingerprint !== cert.issuerCertificate.fingerprint))
{
certs.push(cert);
cert = cert.issuerCertificate;
}
// create a... | javascript | function validateCertChain(cert, cb)
{
// walk up the certificate chain and collect all the certificates in an array
var certs = [];
while (cert && cert.issuerCertificate &&
(cert.fingerprint !== cert.issuerCertificate.fingerprint))
{
certs.push(cert);
cert = cert.issuerCertificate;
}
// create a... | [
"function",
"validateCertChain",
"(",
"cert",
",",
"cb",
")",
"{",
"// walk up the certificate chain and collect all the certificates in an array",
"var",
"certs",
"=",
"[",
"]",
";",
"while",
"(",
"cert",
"&&",
"cert",
".",
"issuerCertificate",
"&&",
"(",
"cert",
"... | Validates a certificate chain using OCSP.
@param {Object} cert a top-level cert that represents the leaf of a
certificate chain.
@param {Function} cb the callback to invoke once the validation is complete. | [
"Validates",
"a",
"certificate",
"chain",
"using",
"OCSP",
"."
] | 7ad71410a3bb679a96021b6b2d5b9b515f790db8 | https://github.com/snowflakedb/snowflake-connector-nodejs/blob/7ad71410a3bb679a96021b6b2d5b9b515f790db8/lib/agent/socket_util.js#L118-L179 | train |
snowflakedb/snowflake-connector-nodejs | lib/agent/socket_util.js | function(certs, index)
{
var cert = certs[index];
validateCert(cert, function(err, data)
{
completed++;
errors[index] = err;
// if we have an ocsp response, cache it
if (data)
{
getOcspResponseCache().set(cert, data);
}
// if this is the last request to ... | javascript | function(certs, index)
{
var cert = certs[index];
validateCert(cert, function(err, data)
{
completed++;
errors[index] = err;
// if we have an ocsp response, cache it
if (data)
{
getOcspResponseCache().set(cert, data);
}
// if this is the last request to ... | [
"function",
"(",
"certs",
",",
"index",
")",
"{",
"var",
"cert",
"=",
"certs",
"[",
"index",
"]",
";",
"validateCert",
"(",
"cert",
",",
"function",
"(",
"err",
",",
"data",
")",
"{",
"completed",
"++",
";",
"errors",
"[",
"index",
"]",
"=",
"err",... | Called for every certificate as we traverse the certificate chain and
validate each one.
@param certs
@param index | [
"Called",
"for",
"every",
"certificate",
"as",
"we",
"traverse",
"the",
"certificate",
"chain",
"and",
"validate",
"each",
"one",
"."
] | 7ad71410a3bb679a96021b6b2d5b9b515f790db8 | https://github.com/snowflakedb/snowflake-connector-nodejs/blob/7ad71410a3bb679a96021b6b2d5b9b515f790db8/lib/agent/socket_util.js#L140-L171 | train | |
snowflakedb/snowflake-connector-nodejs | lib/agent/socket_util.js | validateCert | function validateCert(cert, cb)
{
// if we already have an entry in the cache, use it
var ocspResponse = getOcspResponseCache().get(cert);
if (ocspResponse)
{
process.nextTick(function()
{
Logger.getInstance().trace('Returning OCSP status for certificate %s ' +
'from cache', cert.serialN... | javascript | function validateCert(cert, cb)
{
// if we already have an entry in the cache, use it
var ocspResponse = getOcspResponseCache().get(cert);
if (ocspResponse)
{
process.nextTick(function()
{
Logger.getInstance().trace('Returning OCSP status for certificate %s ' +
'from cache', cert.serialN... | [
"function",
"validateCert",
"(",
"cert",
",",
"cb",
")",
"{",
"// if we already have an entry in the cache, use it",
"var",
"ocspResponse",
"=",
"getOcspResponseCache",
"(",
")",
".",
"get",
"(",
"cert",
")",
";",
"if",
"(",
"ocspResponse",
")",
"{",
"process",
... | Validates a certificate using OCSP.
@param cert the certificate to validate.
@param cb the callback to invoke once the validation is complete. | [
"Validates",
"a",
"certificate",
"using",
"OCSP",
"."
] | 7ad71410a3bb679a96021b6b2d5b9b515f790db8 | https://github.com/snowflakedb/snowflake-connector-nodejs/blob/7ad71410a3bb679a96021b6b2d5b9b515f790db8/lib/agent/socket_util.js#L187-L218 | train |
snowflakedb/snowflake-connector-nodejs | lib/util.js | function (url, paramName, paramValue)
{
// if the specified url is valid
var urlAsObject = Url.parse(url);
if (urlAsObject)
{
// if the url already has query parameters, use '&' as the separator
// when appending the additional query parameter, otherwise use '?'
url +... | javascript | function (url, paramName, paramValue)
{
// if the specified url is valid
var urlAsObject = Url.parse(url);
if (urlAsObject)
{
// if the url already has query parameters, use '&' as the separator
// when appending the additional query parameter, otherwise use '?'
url +... | [
"function",
"(",
"url",
",",
"paramName",
",",
"paramValue",
")",
"{",
"// if the specified url is valid",
"var",
"urlAsObject",
"=",
"Url",
".",
"parse",
"(",
"url",
")",
";",
"if",
"(",
"urlAsObject",
")",
"{",
"// if the url already has query parameters, use '&' ... | Appends a query parameter to a url. If an invalid url is specified, an
exception is thrown.
@param {String} url
@param {String} paramName the name of the query parameter.
@param {String} paramValue the value of the query parameter.
@returns {String} | [
"Appends",
"a",
"query",
"parameter",
"to",
"a",
"url",
".",
"If",
"an",
"invalid",
"url",
"is",
"specified",
"an",
"exception",
"is",
"thrown",
"."
] | 7ad71410a3bb679a96021b6b2d5b9b515f790db8 | https://github.com/snowflakedb/snowflake-connector-nodejs/blob/7ad71410a3bb679a96021b6b2d5b9b515f790db8/lib/util.js#L319-L331 | train | |
snowflakedb/snowflake-connector-nodejs | lib/logger/browser.js | Logger | function Logger(options)
{
/**
* The array to which all log messages will be added.
*
* @type {String[]}
*/
var buffer = [];
/**
* Logs a message at a given level.
*
* @param {String} levelTag the tag associated with the level at which to log
* the message.
* @param {String} message ... | javascript | function Logger(options)
{
/**
* The array to which all log messages will be added.
*
* @type {String[]}
*/
var buffer = [];
/**
* Logs a message at a given level.
*
* @param {String} levelTag the tag associated with the level at which to log
* the message.
* @param {String} message ... | [
"function",
"Logger",
"(",
"options",
")",
"{",
"/**\n * The array to which all log messages will be added.\n *\n * @type {String[]}\n */",
"var",
"buffer",
"=",
"[",
"]",
";",
"/**\n * Logs a message at a given level.\n *\n * @param {String} levelTag the tag associated with ... | Creates a new Logger instance for when we're running in the browser.
@param {Object} [options]
@constructor | [
"Creates",
"a",
"new",
"Logger",
"instance",
"for",
"when",
"we",
"re",
"running",
"in",
"the",
"browser",
"."
] | 7ad71410a3bb679a96021b6b2d5b9b515f790db8 | https://github.com/snowflakedb/snowflake-connector-nodejs/blob/7ad71410a3bb679a96021b6b2d5b9b515f790db8/lib/logger/browser.js#L15-L133 | train |
snowflakedb/snowflake-connector-nodejs | lib/connection/connection_context.js | ConnectionContext | function ConnectionContext(connectionConfig, httpClient, config)
{
// validate input
Errors.assertInternal(Util.isObject(connectionConfig));
Errors.assertInternal(Util.isObject(httpClient));
// if a config object was specified, verify
// that it has all the information we need
var sfServiceConfig;
if (Ut... | javascript | function ConnectionContext(connectionConfig, httpClient, config)
{
// validate input
Errors.assertInternal(Util.isObject(connectionConfig));
Errors.assertInternal(Util.isObject(httpClient));
// if a config object was specified, verify
// that it has all the information we need
var sfServiceConfig;
if (Ut... | [
"function",
"ConnectionContext",
"(",
"connectionConfig",
",",
"httpClient",
",",
"config",
")",
"{",
"// validate input",
"Errors",
".",
"assertInternal",
"(",
"Util",
".",
"isObject",
"(",
"connectionConfig",
")",
")",
";",
"Errors",
".",
"assertInternal",
"(",
... | Creates a new ConnectionContext.
@param {ConnectionConfig} connectionConfig
@param {Object} httpClient
@param {Object} config
@constructor | [
"Creates",
"a",
"new",
"ConnectionContext",
"."
] | 7ad71410a3bb679a96021b6b2d5b9b515f790db8 | https://github.com/snowflakedb/snowflake-connector-nodejs/blob/7ad71410a3bb679a96021b6b2d5b9b515f790db8/lib/connection/connection_context.js#L19-L80 | train |
snowflakedb/snowflake-connector-nodejs | lib/connection/result/sf_timestamp.js | SfTimestamp | function SfTimestamp(epochSeconds, nanoSeconds, scale, timezone, format)
{
// pick reasonable defaults for the inputs if needed
epochSeconds = Util.isNumber(epochSeconds) ? epochSeconds : 0;
nanoSeconds = Util.isNumber(nanoSeconds) ? nanoSeconds : 0;
scale = Util.isNumber(scale) ? scale : 0;
format = Util.isS... | javascript | function SfTimestamp(epochSeconds, nanoSeconds, scale, timezone, format)
{
// pick reasonable defaults for the inputs if needed
epochSeconds = Util.isNumber(epochSeconds) ? epochSeconds : 0;
nanoSeconds = Util.isNumber(nanoSeconds) ? nanoSeconds : 0;
scale = Util.isNumber(scale) ? scale : 0;
format = Util.isS... | [
"function",
"SfTimestamp",
"(",
"epochSeconds",
",",
"nanoSeconds",
",",
"scale",
",",
"timezone",
",",
"format",
")",
"{",
"// pick reasonable defaults for the inputs if needed",
"epochSeconds",
"=",
"Util",
".",
"isNumber",
"(",
"epochSeconds",
")",
"?",
"epochSecon... | Creates a new SfTimestamp instance.
@param {Number} epochSeconds the epoch time in seconds.
@param {Number} nanoSeconds the number of nano seconds (incremental, not
epoch).
@param {Number} scale the precision for the fractional part of the timestamp.
@param {String | Number} [timezone] the timezone name as a string
(e... | [
"Creates",
"a",
"new",
"SfTimestamp",
"instance",
"."
] | 7ad71410a3bb679a96021b6b2d5b9b515f790db8 | https://github.com/snowflakedb/snowflake-connector-nodejs/blob/7ad71410a3bb679a96021b6b2d5b9b515f790db8/lib/connection/result/sf_timestamp.js#L49-L79 | train |
snowflakedb/snowflake-connector-nodejs | lib/core.js | Core | function Core(options)
{
// validate input
Errors.assertInternal(Util.isObject(options));
Errors.assertInternal(
Util.exists(options.httpClient || options.httpClientClass));
Errors.assertInternal(Util.exists(options.loggerClass));
// set the logger instance
Logger.setInstance(new (options.loggerClass... | javascript | function Core(options)
{
// validate input
Errors.assertInternal(Util.isObject(options));
Errors.assertInternal(
Util.exists(options.httpClient || options.httpClientClass));
Errors.assertInternal(Util.exists(options.loggerClass));
// set the logger instance
Logger.setInstance(new (options.loggerClass... | [
"function",
"Core",
"(",
"options",
")",
"{",
"// validate input",
"Errors",
".",
"assertInternal",
"(",
"Util",
".",
"isObject",
"(",
"options",
")",
")",
";",
"Errors",
".",
"assertInternal",
"(",
"Util",
".",
"exists",
"(",
"options",
".",
"httpClient",
... | Creates a new instance of the Snowflake core module.
@param {Object} options
@returns {Object}
@constructor | [
"Creates",
"a",
"new",
"instance",
"of",
"the",
"Snowflake",
"core",
"module",
"."
] | 7ad71410a3bb679a96021b6b2d5b9b515f790db8 | https://github.com/snowflakedb/snowflake-connector-nodejs/blob/7ad71410a3bb679a96021b6b2d5b9b515f790db8/lib/core.js#L24-L184 | train |
snowflakedb/snowflake-connector-nodejs | lib/core.js | function(options, serializedConnection)
{
// check for missing serializedConfig
Errors.checkArgumentExists(Util.exists(serializedConnection),
ErrorCodes.ERR_CONN_DESERIALIZE_MISSING_CONFIG);
// check for invalid serializedConfig
Errors.checkArgumentValid(Util.isString(serializedCo... | javascript | function(options, serializedConnection)
{
// check for missing serializedConfig
Errors.checkArgumentExists(Util.exists(serializedConnection),
ErrorCodes.ERR_CONN_DESERIALIZE_MISSING_CONFIG);
// check for invalid serializedConfig
Errors.checkArgumentValid(Util.isString(serializedCo... | [
"function",
"(",
"options",
",",
"serializedConnection",
")",
"{",
"// check for missing serializedConfig",
"Errors",
".",
"checkArgumentExists",
"(",
"Util",
".",
"exists",
"(",
"serializedConnection",
")",
",",
"ErrorCodes",
".",
"ERR_CONN_DESERIALIZE_MISSING_CONFIG",
"... | Deserializes a serialized connection.
@param {Object} options
@param {String} serializedConnection
@returns {Object} | [
"Deserializes",
"a",
"serialized",
"connection",
"."
] | 7ad71410a3bb679a96021b6b2d5b9b515f790db8 | https://github.com/snowflakedb/snowflake-connector-nodejs/blob/7ad71410a3bb679a96021b6b2d5b9b515f790db8/lib/core.js#L101-L126 | train | |
snowflakedb/snowflake-connector-nodejs | lib/core.js | function(options)
{
var logTag = options.logLevel;
if (Util.exists(logTag))
{
// check that the specified value is a valid tag
Errors.checkArgumentValid(LoggerCore.isValidLogTag(logTag),
ErrorCodes.ERR_GLOGAL_CONFIGURE_INVALID_LOG_LEVEL);
Logger.getInstance().c... | javascript | function(options)
{
var logTag = options.logLevel;
if (Util.exists(logTag))
{
// check that the specified value is a valid tag
Errors.checkArgumentValid(LoggerCore.isValidLogTag(logTag),
ErrorCodes.ERR_GLOGAL_CONFIGURE_INVALID_LOG_LEVEL);
Logger.getInstance().c... | [
"function",
"(",
"options",
")",
"{",
"var",
"logTag",
"=",
"options",
".",
"logLevel",
";",
"if",
"(",
"Util",
".",
"exists",
"(",
"logTag",
")",
")",
"{",
"// check that the specified value is a valid tag",
"Errors",
".",
"checkArgumentValid",
"(",
"LoggerCore... | Configures this instance of the Snowflake core module.
@param {Object} options | [
"Configures",
"this",
"instance",
"of",
"the",
"Snowflake",
"core",
"module",
"."
] | 7ad71410a3bb679a96021b6b2d5b9b515f790db8 | https://github.com/snowflakedb/snowflake-connector-nodejs/blob/7ad71410a3bb679a96021b6b2d5b9b515f790db8/lib/core.js#L145-L169 | train | |
snowflakedb/snowflake-connector-nodejs | lib/logger/node.js | Logger | function Logger(options)
{
var common;
var winstonLogger;
/**
* Logs a message at a given level.
*
* @param {String} levelTag the tag associated with the level at which to log
* the message.
* @param {String} message the message to log.
* @param {Number} bufferMaxLength the maximum size to wh... | javascript | function Logger(options)
{
var common;
var winstonLogger;
/**
* Logs a message at a given level.
*
* @param {String} levelTag the tag associated with the level at which to log
* the message.
* @param {String} message the message to log.
* @param {Number} bufferMaxLength the maximum size to wh... | [
"function",
"Logger",
"(",
"options",
")",
"{",
"var",
"common",
";",
"var",
"winstonLogger",
";",
"/**\n * Logs a message at a given level.\n *\n * @param {String} levelTag the tag associated with the level at which to log\n * the message.\n * @param {String} message the message... | Creates a new Logger instance for when we're running in node.
@param {Object} [options]
@constructor | [
"Creates",
"a",
"new",
"Logger",
"instance",
"for",
"when",
"we",
"re",
"running",
"in",
"node",
"."
] | 7ad71410a3bb679a96021b6b2d5b9b515f790db8 | https://github.com/snowflakedb/snowflake-connector-nodejs/blob/7ad71410a3bb679a96021b6b2d5b9b515f790db8/lib/logger/node.js#L16-L134 | train |
snowflakedb/snowflake-connector-nodejs | lib/connection/connection_config.js | createParameters | function createParameters()
{
var isNonNegativeInteger = Util.number.isNonNegativeInteger.bind(Util.number);
var isPositiveInteger = Util.number.isPositiveInteger.bind(Util.number);
var isNonNegativeNumber = Util.number.isNonNegative.bind(Util.number);
return [
{
name : PARAM_TIMEOUT,
... | javascript | function createParameters()
{
var isNonNegativeInteger = Util.number.isNonNegativeInteger.bind(Util.number);
var isPositiveInteger = Util.number.isPositiveInteger.bind(Util.number);
var isNonNegativeNumber = Util.number.isNonNegative.bind(Util.number);
return [
{
name : PARAM_TIMEOUT,
... | [
"function",
"createParameters",
"(",
")",
"{",
"var",
"isNonNegativeInteger",
"=",
"Util",
".",
"number",
".",
"isNonNegativeInteger",
".",
"bind",
"(",
"Util",
".",
"number",
")",
";",
"var",
"isPositiveInteger",
"=",
"Util",
".",
"number",
".",
"isPositiveIn... | Creates the list of known parameters. If a parameter is marked as external,
its value can be overridden by adding the appropriate name-value mapping to
the ConnectionConfig options.
@returns {Object[]} | [
"Creates",
"the",
"list",
"of",
"known",
"parameters",
".",
"If",
"a",
"parameter",
"is",
"marked",
"as",
"external",
"its",
"value",
"can",
"be",
"overridden",
"by",
"adding",
"the",
"appropriate",
"name",
"-",
"value",
"mapping",
"to",
"the",
"ConnectionCo... | 7ad71410a3bb679a96021b6b2d5b9b515f790db8 | https://github.com/snowflakedb/snowflake-connector-nodejs/blob/7ad71410a3bb679a96021b6b2d5b9b515f790db8/lib/connection/connection_config.js#L441-L514 | train |
snowflakedb/snowflake-connector-nodejs | lib/logger/core.js | function(options)
{
var localIncludeTimestamp;
var localBufferMaxLength;
var localMessageMaxLength;
var localLevel;
// if an options argument is specified
if (Util.exists(options))
{
// make sure it's an object
Errors.assertInternal(Util.isObject(options));... | javascript | function(options)
{
var localIncludeTimestamp;
var localBufferMaxLength;
var localMessageMaxLength;
var localLevel;
// if an options argument is specified
if (Util.exists(options))
{
// make sure it's an object
Errors.assertInternal(Util.isObject(options));... | [
"function",
"(",
"options",
")",
"{",
"var",
"localIncludeTimestamp",
";",
"var",
"localBufferMaxLength",
";",
"var",
"localMessageMaxLength",
";",
"var",
"localLevel",
";",
"// if an options argument is specified",
"if",
"(",
"Util",
".",
"exists",
"(",
"options",
... | Configures this logger.
@param {Object} options | [
"Configures",
"this",
"logger",
"."
] | 7ad71410a3bb679a96021b6b2d5b9b515f790db8 | https://github.com/snowflakedb/snowflake-connector-nodejs/blob/7ad71410a3bb679a96021b6b2d5b9b515f790db8/lib/logger/core.js#L113-L184 | train | |
snowflakedb/snowflake-connector-nodejs | lib/parameters.js | Parameter | function Parameter(options)
{
// validate input
Errors.assertInternal(Util.isObject(options));
Errors.assertInternal(Util.isString(options.name));
Errors.assertInternal(Util.exists(options.value));
var name = options.name;
var value = options.value;
/**
* Returns the name of the parameter.
*
* ... | javascript | function Parameter(options)
{
// validate input
Errors.assertInternal(Util.isObject(options));
Errors.assertInternal(Util.isString(options.name));
Errors.assertInternal(Util.exists(options.value));
var name = options.name;
var value = options.value;
/**
* Returns the name of the parameter.
*
* ... | [
"function",
"Parameter",
"(",
"options",
")",
"{",
"// validate input",
"Errors",
".",
"assertInternal",
"(",
"Util",
".",
"isObject",
"(",
"options",
")",
")",
";",
"Errors",
".",
"assertInternal",
"(",
"Util",
".",
"isString",
"(",
"options",
".",
"name",
... | Creates a new Parameter.
@param {Object} options
@constructor | [
"Creates",
"a",
"new",
"Parameter",
"."
] | 7ad71410a3bb679a96021b6b2d5b9b515f790db8 | https://github.com/snowflakedb/snowflake-connector-nodejs/blob/7ad71410a3bb679a96021b6b2d5b9b515f790db8/lib/parameters.js#L14-L53 | train |
snowflakedb/snowflake-connector-nodejs | lib/errors.js | createError | function createError(name, options)
{
// TODO: validate that name is a string and options is an object
// TODO: this code is a bit of a mess and needs to be cleaned up
// create a new error
var error = new Error();
// set its name
error.name = name;
// set the error code
var code;
error.code = cod... | javascript | function createError(name, options)
{
// TODO: validate that name is a string and options is an object
// TODO: this code is a bit of a mess and needs to be cleaned up
// create a new error
var error = new Error();
// set its name
error.name = name;
// set the error code
var code;
error.code = cod... | [
"function",
"createError",
"(",
"name",
",",
"options",
")",
"{",
"// TODO: validate that name is a string and options is an object",
"// TODO: this code is a bit of a mess and needs to be cleaned up",
"// create a new error",
"var",
"error",
"=",
"new",
"Error",
"(",
")",
";",
... | Creates a generic error.
@param {String} name
@param {Object} options
@returns {Error} | [
"Creates",
"a",
"generic",
"error",
"."
] | 7ad71410a3bb679a96021b6b2d5b9b515f790db8 | https://github.com/snowflakedb/snowflake-connector-nodejs/blob/7ad71410a3bb679a96021b6b2d5b9b515f790db8/lib/errors.js#L469-L568 | train |
snowflakedb/snowflake-connector-nodejs | lib/agent/ocsp_response_cache.js | OcspResponseCache | function OcspResponseCache(capacity, maxAge)
{
// validate input
Errors.assertInternal(Util.number.isPositiveInteger(capacity));
Errors.assertInternal(Util.number.isPositiveInteger(maxAge));
// create a cache to store the responses
var cache = new SimpleCache({ maxSize: capacity });
/**
* Adds an entry... | javascript | function OcspResponseCache(capacity, maxAge)
{
// validate input
Errors.assertInternal(Util.number.isPositiveInteger(capacity));
Errors.assertInternal(Util.number.isPositiveInteger(maxAge));
// create a cache to store the responses
var cache = new SimpleCache({ maxSize: capacity });
/**
* Adds an entry... | [
"function",
"OcspResponseCache",
"(",
"capacity",
",",
"maxAge",
")",
"{",
"// validate input",
"Errors",
".",
"assertInternal",
"(",
"Util",
".",
"number",
".",
"isPositiveInteger",
"(",
"capacity",
")",
")",
";",
"Errors",
".",
"assertInternal",
"(",
"Util",
... | Client-side cache for storing OCSP responses.
@param {Number} capacity
@param {Number} maxAge
@constructor | [
"Client",
"-",
"side",
"cache",
"for",
"storing",
"OCSP",
"responses",
"."
] | 7ad71410a3bb679a96021b6b2d5b9b515f790db8 | https://github.com/snowflakedb/snowflake-connector-nodejs/blob/7ad71410a3bb679a96021b6b2d5b9b515f790db8/lib/agent/ocsp_response_cache.js#L18-L76 | train |
snowflakedb/snowflake-connector-nodejs | lib/connection/result/result_stream.js | ResultStream | function ResultStream(options)
{
// options should be an object
Errors.assertInternal(Util.isObject(options));
var chunks = options.chunks;
var prefetchSize = options.prefetchSize;
// chunks should be an array
Errors.assertInternal(Util.isArray(chunks));
// prefetch size should be non-negative
... | javascript | function ResultStream(options)
{
// options should be an object
Errors.assertInternal(Util.isObject(options));
var chunks = options.chunks;
var prefetchSize = options.prefetchSize;
// chunks should be an array
Errors.assertInternal(Util.isArray(chunks));
// prefetch size should be non-negative
... | [
"function",
"ResultStream",
"(",
"options",
")",
"{",
"// options should be an object",
"Errors",
".",
"assertInternal",
"(",
"Util",
".",
"isObject",
"(",
"options",
")",
")",
";",
"var",
"chunks",
"=",
"options",
".",
"chunks",
";",
"var",
"prefetchSize",
"=... | Creates a stream-like object that can be used to read the contents of an
array of chunks with the ability to prefetch chunks as we go. Every time the
contents of a new chunk become available, a 'data' event is fired. When there
are no more chunks to read, a 'close' event is fired to indicate that the
read operation is ... | [
"Creates",
"a",
"stream",
"-",
"like",
"object",
"that",
"can",
"be",
"used",
"to",
"read",
"the",
"contents",
"of",
"an",
"array",
"of",
"chunks",
"with",
"the",
"ability",
"to",
"prefetch",
"chunks",
"as",
"we",
"go",
".",
"Every",
"time",
"the",
"co... | 7ad71410a3bb679a96021b6b2d5b9b515f790db8 | https://github.com/snowflakedb/snowflake-connector-nodejs/blob/7ad71410a3bb679a96021b6b2d5b9b515f790db8/lib/connection/result/result_stream.js#L24-L121 | train |
snowflakedb/snowflake-connector-nodejs | lib/connection/result/result_stream.js | function(err, chunk)
{
// unsubscribe from the 'loadcomplete' event
chunk.removeListener('loadcomplete', onLoadComplete);
// if the chunk load succeeded
if (!err)
{
// move on to the next chunk
start++;
// emit an event to signal that new data is available
self.emit('data... | javascript | function(err, chunk)
{
// unsubscribe from the 'loadcomplete' event
chunk.removeListener('loadcomplete', onLoadComplete);
// if the chunk load succeeded
if (!err)
{
// move on to the next chunk
start++;
// emit an event to signal that new data is available
self.emit('data... | [
"function",
"(",
"err",
",",
"chunk",
")",
"{",
"// unsubscribe from the 'loadcomplete' event",
"chunk",
".",
"removeListener",
"(",
"'loadcomplete'",
",",
"onLoadComplete",
")",
";",
"// if the chunk load succeeded",
"if",
"(",
"!",
"err",
")",
"{",
"// move on to th... | Called when a chunk fires a 'loadcomplete' event.
@param {Error} err
@param {Chunk} chunk | [
"Called",
"when",
"a",
"chunk",
"fires",
"a",
"loadcomplete",
"event",
"."
] | 7ad71410a3bb679a96021b6b2d5b9b515f790db8 | https://github.com/snowflakedb/snowflake-connector-nodejs/blob/7ad71410a3bb679a96021b6b2d5b9b515f790db8/lib/connection/result/result_stream.js#L49-L70 | train | |
snowflakedb/snowflake-connector-nodejs | lib/connection/result/result_stream.js | function()
{
// get the array of chunks whose contents need to be fetched
var buffer = chunks.slice(start, start + prefetchSize + 1);
// the first chunk in the buffer is the next chunk we want to load
var nextChunk = buffer[0];
// if we don't have anymore chunks to load, we're done
if (!next... | javascript | function()
{
// get the array of chunks whose contents need to be fetched
var buffer = chunks.slice(start, start + prefetchSize + 1);
// the first chunk in the buffer is the next chunk we want to load
var nextChunk = buffer[0];
// if we don't have anymore chunks to load, we're done
if (!next... | [
"function",
"(",
")",
"{",
"// get the array of chunks whose contents need to be fetched",
"var",
"buffer",
"=",
"chunks",
".",
"slice",
"(",
"start",
",",
"start",
"+",
"prefetchSize",
"+",
"1",
")",
";",
"// the first chunk in the buffer is the next chunk we want to load"... | Identifies the next chunk to load and issues requests to fetch both its
contents plus the contents of the next few chunks. If there are no more
chunks to load, a 'close' event is fired on the stream to notify
subscribers that all the chunks have been successfully read. | [
"Identifies",
"the",
"next",
"chunk",
"to",
"load",
"and",
"issues",
"requests",
"to",
"fetch",
"both",
"its",
"contents",
"plus",
"the",
"contents",
"of",
"the",
"next",
"few",
"chunks",
".",
"If",
"there",
"are",
"no",
"more",
"chunks",
"to",
"load",
"... | 7ad71410a3bb679a96021b6b2d5b9b515f790db8 | https://github.com/snowflakedb/snowflake-connector-nodejs/blob/7ad71410a3bb679a96021b6b2d5b9b515f790db8/lib/connection/result/result_stream.js#L78-L108 | train | |
snowflakedb/snowflake-connector-nodejs | lib/connection/statement.js | invokeStatementComplete | function invokeStatementComplete(statement, context)
{
// find out if the result will be streamed;
// if a value is not specified, get it from the connection
var streamResult = context.streamResult;
if (!Util.exists(streamResult))
{
streamResult = context.connectionConfig.getStreamResult();
}
// if t... | javascript | function invokeStatementComplete(statement, context)
{
// find out if the result will be streamed;
// if a value is not specified, get it from the connection
var streamResult = context.streamResult;
if (!Util.exists(streamResult))
{
streamResult = context.connectionConfig.getStreamResult();
}
// if t... | [
"function",
"invokeStatementComplete",
"(",
"statement",
",",
"context",
")",
"{",
"// find out if the result will be streamed;",
"// if a value is not specified, get it from the connection",
"var",
"streamResult",
"=",
"context",
".",
"streamResult",
";",
"if",
"(",
"!",
"Ut... | Invokes the statement complete callback.
@param {Object} statement
@param {Object} context | [
"Invokes",
"the",
"statement",
"complete",
"callback",
"."
] | 7ad71410a3bb679a96021b6b2d5b9b515f790db8 | https://github.com/snowflakedb/snowflake-connector-nodejs/blob/7ad71410a3bb679a96021b6b2d5b9b515f790db8/lib/connection/statement.js#L543-L581 | train |
snowflakedb/snowflake-connector-nodejs | lib/connection/statement.js | createOnStatementRequestSuccRow | function createOnStatementRequestSuccRow(statement, context)
{
return function(body)
{
// if we don't already have a result
if (!context.result)
{
// build a result from the response
context.result = new Result(
{
response : body,
statement : statement,
... | javascript | function createOnStatementRequestSuccRow(statement, context)
{
return function(body)
{
// if we don't already have a result
if (!context.result)
{
// build a result from the response
context.result = new Result(
{
response : body,
statement : statement,
... | [
"function",
"createOnStatementRequestSuccRow",
"(",
"statement",
",",
"context",
")",
"{",
"return",
"function",
"(",
"body",
")",
"{",
"// if we don't already have a result",
"if",
"(",
"!",
"context",
".",
"result",
")",
"{",
"// build a result from the response",
"... | Creates a function that can be used by row statements to process the response
when the request is successful.
@param statement
@param context
@returns {Function} | [
"Creates",
"a",
"function",
"that",
"can",
"be",
"used",
"by",
"row",
"statements",
"to",
"process",
"the",
"response",
"when",
"the",
"request",
"is",
"successful",
"."
] | 7ad71410a3bb679a96021b6b2d5b9b515f790db8 | https://github.com/snowflakedb/snowflake-connector-nodejs/blob/7ad71410a3bb679a96021b6b2d5b9b515f790db8/lib/connection/statement.js#L643-L674 | train |
snowflakedb/snowflake-connector-nodejs | lib/connection/statement.js | FileStatementPreExec | function FileStatementPreExec(
statementOptions, context, services, connectionConfig)
{
// call super
BaseStatement.apply(this, arguments);
// add the result request headers to the context
context.resultRequestHeaders = buildResultRequestHeadersFile();
/**
* Called when the statement request is succe... | javascript | function FileStatementPreExec(
statementOptions, context, services, connectionConfig)
{
// call super
BaseStatement.apply(this, arguments);
// add the result request headers to the context
context.resultRequestHeaders = buildResultRequestHeadersFile();
/**
* Called when the statement request is succe... | [
"function",
"FileStatementPreExec",
"(",
"statementOptions",
",",
"context",
",",
"services",
",",
"connectionConfig",
")",
"{",
"// call super",
"BaseStatement",
".",
"apply",
"(",
"this",
",",
"arguments",
")",
";",
"// add the result request headers to the context",
... | Creates a new FileStatementPreExec instance.
@param {Object} statementOptions
@param {Object} context
@param {Object} services
@param {Object} connectionConfig
@constructor | [
"Creates",
"a",
"new",
"FileStatementPreExec",
"instance",
"."
] | 7ad71410a3bb679a96021b6b2d5b9b515f790db8 | https://github.com/snowflakedb/snowflake-connector-nodejs/blob/7ad71410a3bb679a96021b6b2d5b9b515f790db8/lib/connection/statement.js#L685-L716 | train |
snowflakedb/snowflake-connector-nodejs | lib/connection/statement.js | RowStatementPostExec | function RowStatementPostExec(
statementOptions, context, services, connectionConfig)
{
// call super
BaseStatement.apply(this, arguments);
// add the result request headers to the context
context.resultRequestHeaders = buildResultRequestHeadersRow();
/**
* Called when the statement request is succes... | javascript | function RowStatementPostExec(
statementOptions, context, services, connectionConfig)
{
// call super
BaseStatement.apply(this, arguments);
// add the result request headers to the context
context.resultRequestHeaders = buildResultRequestHeadersRow();
/**
* Called when the statement request is succes... | [
"function",
"RowStatementPostExec",
"(",
"statementOptions",
",",
"context",
",",
"services",
",",
"connectionConfig",
")",
"{",
"// call super",
"BaseStatement",
".",
"apply",
"(",
"this",
",",
"arguments",
")",
";",
"// add the result request headers to the context",
... | Creates a new RowStatementPostExec instance.
@param {Object} statementOptions
@param {Object} context
@param {Object} services
@param {Object} connectionConfig
@constructor | [
"Creates",
"a",
"new",
"RowStatementPostExec",
"instance",
"."
] | 7ad71410a3bb679a96021b6b2d5b9b515f790db8 | https://github.com/snowflakedb/snowflake-connector-nodejs/blob/7ad71410a3bb679a96021b6b2d5b9b515f790db8/lib/connection/statement.js#L729-L768 | train |
snowflakedb/snowflake-connector-nodejs | lib/connection/statement.js | createFnStreamRows | function createFnStreamRows(statement, context)
{
return function(options)
{
// if some options are specified
if (Util.exists(options))
{
// check for invalid options
Errors.checkArgumentValid(Util.isObject(options),
ErrorCodes.ERR_STMT_FETCH_ROWS_INVALID_OPTIONS);
// check ... | javascript | function createFnStreamRows(statement, context)
{
return function(options)
{
// if some options are specified
if (Util.exists(options))
{
// check for invalid options
Errors.checkArgumentValid(Util.isObject(options),
ErrorCodes.ERR_STMT_FETCH_ROWS_INVALID_OPTIONS);
// check ... | [
"function",
"createFnStreamRows",
"(",
"statement",
",",
"context",
")",
"{",
"return",
"function",
"(",
"options",
")",
"{",
"// if some options are specified",
"if",
"(",
"Util",
".",
"exists",
"(",
"options",
")",
")",
"{",
"// check for invalid options",
"Erro... | Creates a function that streams the rows in a statement's result. If start
and end values are specified, only rows in the specified range are streamed.
@param statement
@param context | [
"Creates",
"a",
"function",
"that",
"streams",
"the",
"rows",
"in",
"a",
"statement",
"s",
"result",
".",
"If",
"start",
"and",
"end",
"values",
"are",
"specified",
"only",
"rows",
"in",
"the",
"specified",
"range",
"are",
"streamed",
"."
] | 7ad71410a3bb679a96021b6b2d5b9b515f790db8 | https://github.com/snowflakedb/snowflake-connector-nodejs/blob/7ad71410a3bb679a96021b6b2d5b9b515f790db8/lib/connection/statement.js#L865-L908 | train |
snowflakedb/snowflake-connector-nodejs | lib/connection/statement.js | fetchRowsFromResult | function fetchRowsFromResult(options, statement, context)
{
var numInterrupts = 0;
// forward to the result to get a FetchRowsOperation object
var operation = context.result.fetchRows(options);
// subscribe to the operation's 'complete' event
operation.on('complete', function(err, continueCallback)
{
... | javascript | function fetchRowsFromResult(options, statement, context)
{
var numInterrupts = 0;
// forward to the result to get a FetchRowsOperation object
var operation = context.result.fetchRows(options);
// subscribe to the operation's 'complete' event
operation.on('complete', function(err, continueCallback)
{
... | [
"function",
"fetchRowsFromResult",
"(",
"options",
",",
"statement",
",",
"context",
")",
"{",
"var",
"numInterrupts",
"=",
"0",
";",
"// forward to the result to get a FetchRowsOperation object",
"var",
"operation",
"=",
"context",
".",
"result",
".",
"fetchRows",
"(... | Fetches rows from the statement's result.
@param {Object} options the options passed to fetchRows().
@param {Object} statement
@param {Object} context | [
"Fetches",
"rows",
"from",
"the",
"statement",
"s",
"result",
"."
] | 7ad71410a3bb679a96021b6b2d5b9b515f790db8 | https://github.com/snowflakedb/snowflake-connector-nodejs/blob/7ad71410a3bb679a96021b6b2d5b9b515f790db8/lib/connection/statement.js#L929-L967 | train |
snowflakedb/snowflake-connector-nodejs | lib/connection/statement.js | sendCancelStatement | function sendCancelStatement(statementContext, statement, callback)
{
var url;
var json;
// use different rest endpoints based on whether the statement id is available
if (statementContext.statementId)
{
url = '/queries/' + statementContext.statementId + '/abort-request';
}
else
{
url = '/quer... | javascript | function sendCancelStatement(statementContext, statement, callback)
{
var url;
var json;
// use different rest endpoints based on whether the statement id is available
if (statementContext.statementId)
{
url = '/queries/' + statementContext.statementId + '/abort-request';
}
else
{
url = '/quer... | [
"function",
"sendCancelStatement",
"(",
"statementContext",
",",
"statement",
",",
"callback",
")",
"{",
"var",
"url",
";",
"var",
"json",
";",
"// use different rest endpoints based on whether the statement id is available",
"if",
"(",
"statementContext",
".",
"statementId... | Issues a request to cancel a statement.
@param {Object} statementContext
@param {Object} statement
@param {Function} callback | [
"Issues",
"a",
"request",
"to",
"cancel",
"a",
"statement",
"."
] | 7ad71410a3bb679a96021b6b2d5b9b515f790db8 | https://github.com/snowflakedb/snowflake-connector-nodejs/blob/7ad71410a3bb679a96021b6b2d5b9b515f790db8/lib/connection/statement.js#L976-L1010 | train |
snowflakedb/snowflake-connector-nodejs | lib/connection/statement.js | sendRequestPreExec | function sendRequestPreExec(statementContext, onResultAvailable)
{
// get the request headers
var headers = statementContext.resultRequestHeaders;
// build the basic json for the request
var json =
{
disableOfflineChunks : false,
sqlText : statementContext.sqlText
};
// if binds are... | javascript | function sendRequestPreExec(statementContext, onResultAvailable)
{
// get the request headers
var headers = statementContext.resultRequestHeaders;
// build the basic json for the request
var json =
{
disableOfflineChunks : false,
sqlText : statementContext.sqlText
};
// if binds are... | [
"function",
"sendRequestPreExec",
"(",
"statementContext",
",",
"onResultAvailable",
")",
"{",
"// get the request headers",
"var",
"headers",
"=",
"statementContext",
".",
"resultRequestHeaders",
";",
"// build the basic json for the request",
"var",
"json",
"=",
"{",
"dis... | Issues a request to get the result of a statement that hasn't been previously
executed.
@param statementContext
@param onResultAvailable | [
"Issues",
"a",
"request",
"to",
"get",
"the",
"result",
"of",
"a",
"statement",
"that",
"hasn",
"t",
"been",
"previously",
"executed",
"."
] | 7ad71410a3bb679a96021b6b2d5b9b515f790db8 | https://github.com/snowflakedb/snowflake-connector-nodejs/blob/7ad71410a3bb679a96021b6b2d5b9b515f790db8/lib/connection/statement.js#L1019-L1067 | train |
snowflakedb/snowflake-connector-nodejs | lib/connection/statement.js | buildBindsMap | function buildBindsMap(bindsArray)
{
var bindsMap = {};
var isArrayBinding = bindsArray.length >0 && Util.isArray(bindsArray[0]);
var singleArray = isArrayBinding ? bindsArray[0] : bindsArray;
for (var index = 0, length = singleArray.length; index < length; index++)
{
var value = singleArray[index];
... | javascript | function buildBindsMap(bindsArray)
{
var bindsMap = {};
var isArrayBinding = bindsArray.length >0 && Util.isArray(bindsArray[0]);
var singleArray = isArrayBinding ? bindsArray[0] : bindsArray;
for (var index = 0, length = singleArray.length; index < length; index++)
{
var value = singleArray[index];
... | [
"function",
"buildBindsMap",
"(",
"bindsArray",
")",
"{",
"var",
"bindsMap",
"=",
"{",
"}",
";",
"var",
"isArrayBinding",
"=",
"bindsArray",
".",
"length",
">",
"0",
"&&",
"Util",
".",
"isArray",
"(",
"bindsArray",
"[",
"0",
"]",
")",
";",
"var",
"sing... | Converts a bind variables array to a map that can be included in the
POST-body when issuing a pre-exec statement request.
@param bindsArray
@returns {Object} | [
"Converts",
"a",
"bind",
"variables",
"array",
"to",
"a",
"map",
"that",
"can",
"be",
"included",
"in",
"the",
"POST",
"-",
"body",
"when",
"issuing",
"a",
"pre",
"-",
"exec",
"statement",
"request",
"."
] | 7ad71410a3bb679a96021b6b2d5b9b515f790db8 | https://github.com/snowflakedb/snowflake-connector-nodejs/blob/7ad71410a3bb679a96021b6b2d5b9b515f790db8/lib/connection/statement.js#L1077-L1143 | train |
snowflakedb/snowflake-connector-nodejs | lib/connection/statement.js | sendRequestPostExec | function sendRequestPostExec(statementContext, onResultAvailable)
{
// get the request headers
var headers = statementContext.resultRequestHeaders;
// use the snowflake service to issue the request
sendSfRequest(statementContext,
{
method : 'GET',
headers: headers,
url : Url.format(
{
... | javascript | function sendRequestPostExec(statementContext, onResultAvailable)
{
// get the request headers
var headers = statementContext.resultRequestHeaders;
// use the snowflake service to issue the request
sendSfRequest(statementContext,
{
method : 'GET',
headers: headers,
url : Url.format(
{
... | [
"function",
"sendRequestPostExec",
"(",
"statementContext",
",",
"onResultAvailable",
")",
"{",
"// get the request headers",
"var",
"headers",
"=",
"statementContext",
".",
"resultRequestHeaders",
";",
"// use the snowflake service to issue the request",
"sendSfRequest",
"(",
... | Issues a request to get the result of a statement that has been previously
executed.
@param statementContext
@param onResultAvailable | [
"Issues",
"a",
"request",
"to",
"get",
"the",
"result",
"of",
"a",
"statement",
"that",
"has",
"been",
"previously",
"executed",
"."
] | 7ad71410a3bb679a96021b6b2d5b9b515f790db8 | https://github.com/snowflakedb/snowflake-connector-nodejs/blob/7ad71410a3bb679a96021b6b2d5b9b515f790db8/lib/connection/statement.js#L1152-L1173 | train |
snowflakedb/snowflake-connector-nodejs | lib/connection/statement.js | sendSfRequest | function sendSfRequest(statementContext, options, appendQueryParamOnRetry)
{
var sf = statementContext.services.sf;
var connectionConfig = statementContext.connectionConfig;
// clone the options
options = Util.apply({}, options);
// get the original url and callback
var urlOrig = options.url;
var callba... | javascript | function sendSfRequest(statementContext, options, appendQueryParamOnRetry)
{
var sf = statementContext.services.sf;
var connectionConfig = statementContext.connectionConfig;
// clone the options
options = Util.apply({}, options);
// get the original url and callback
var urlOrig = options.url;
var callba... | [
"function",
"sendSfRequest",
"(",
"statementContext",
",",
"options",
",",
"appendQueryParamOnRetry",
")",
"{",
"var",
"sf",
"=",
"statementContext",
".",
"services",
".",
"sf",
";",
"var",
"connectionConfig",
"=",
"statementContext",
".",
"connectionConfig",
";",
... | Issues a statement-related request using the Snowflake service.
@param {Object} statementContext the statement context.
@param {Object} options the request options.
@param {Boolean} [appendQueryParamOnRetry] whether retry=true should be
appended to the url if the request is retried. | [
"Issues",
"a",
"statement",
"-",
"related",
"request",
"using",
"the",
"Snowflake",
"service",
"."
] | 7ad71410a3bb679a96021b6b2d5b9b515f790db8 | https://github.com/snowflakedb/snowflake-connector-nodejs/blob/7ad71410a3bb679a96021b6b2d5b9b515f790db8/lib/connection/statement.js#L1183-L1246 | train |
snowflakedb/snowflake-connector-nodejs | lib/connection/statement.js | buildResultRequestCallback | function buildResultRequestCallback(
statementContext, headers, onResultAvailable)
{
var callback = function(err, body)
{
// if the result is not ready yet, extract the result url from the response
// and issue a GET request to try to fetch the result again
if (!err && body && (body.code === '333333... | javascript | function buildResultRequestCallback(
statementContext, headers, onResultAvailable)
{
var callback = function(err, body)
{
// if the result is not ready yet, extract the result url from the response
// and issue a GET request to try to fetch the result again
if (!err && body && (body.code === '333333... | [
"function",
"buildResultRequestCallback",
"(",
"statementContext",
",",
"headers",
",",
"onResultAvailable",
")",
"{",
"var",
"callback",
"=",
"function",
"(",
"err",
",",
"body",
")",
"{",
"// if the result is not ready yet, extract the result url from the response",
"// a... | Builds a callback for use in an exec-statement or fetch-result request.
@param statementContext
@param headers
@param onResultAvailable
@returns {Function} | [
"Builds",
"a",
"callback",
"for",
"use",
"in",
"an",
"exec",
"-",
"statement",
"or",
"fetch",
"-",
"result",
"request",
"."
] | 7ad71410a3bb679a96021b6b2d5b9b515f790db8 | https://github.com/snowflakedb/snowflake-connector-nodejs/blob/7ad71410a3bb679a96021b6b2d5b9b515f790db8/lib/connection/statement.js#L1257-L1286 | train |
snowflakedb/snowflake-connector-nodejs | lib/connection/result/chunk.js | Chunk | function Chunk(options)
{
// make sure the options object contains all the necessary information
Errors.assertInternal(Util.isObject(options));
Errors.assertInternal(Util.isObject(options.statement));
Errors.assertInternal(Util.isObject(options.services));
Errors.assertInternal(Util.isNumber(options.startInde... | javascript | function Chunk(options)
{
// make sure the options object contains all the necessary information
Errors.assertInternal(Util.isObject(options));
Errors.assertInternal(Util.isObject(options.statement));
Errors.assertInternal(Util.isObject(options.services));
Errors.assertInternal(Util.isNumber(options.startInde... | [
"function",
"Chunk",
"(",
"options",
")",
"{",
"// make sure the options object contains all the necessary information",
"Errors",
".",
"assertInternal",
"(",
"Util",
".",
"isObject",
"(",
"options",
")",
")",
";",
"Errors",
".",
"assertInternal",
"(",
"Util",
".",
... | Creates a new Chunk.
@param options
@constructor | [
"Creates",
"a",
"new",
"Chunk",
"."
] | 7ad71410a3bb679a96021b6b2d5b9b515f790db8 | https://github.com/snowflakedb/snowflake-connector-nodejs/blob/7ad71410a3bb679a96021b6b2d5b9b515f790db8/lib/connection/result/chunk.js#L15-L48 | train |
snowflakedb/snowflake-connector-nodejs | lib/connection/result/chunk.js | function(err)
{
// we're done loading
self._isLoading = false;
// emit an event to notify subscribers
self.emit('loadcomplete', err, self);
// invoke the callback if one was specified
if (Util.isFunction(callback))
{
callback(err, self);
}
} | javascript | function(err)
{
// we're done loading
self._isLoading = false;
// emit an event to notify subscribers
self.emit('loadcomplete', err, self);
// invoke the callback if one was specified
if (Util.isFunction(callback))
{
callback(err, self);
}
} | [
"function",
"(",
"err",
")",
"{",
"// we're done loading",
"self",
".",
"_isLoading",
"=",
"false",
";",
"// emit an event to notify subscribers",
"self",
".",
"emit",
"(",
"'loadcomplete'",
",",
"err",
",",
"self",
")",
";",
"// invoke the callback if one was specifi... | Completes the chunk load.
@param err | [
"Completes",
"the",
"chunk",
"load",
"."
] | 7ad71410a3bb679a96021b6b2d5b9b515f790db8 | https://github.com/snowflakedb/snowflake-connector-nodejs/blob/7ad71410a3bb679a96021b6b2d5b9b515f790db8/lib/connection/result/chunk.js#L229-L242 | train | |
snowflakedb/snowflake-connector-nodejs | lib/connection/result/chunk.js | convertRowsetToRows | function convertRowsetToRows(
statement,
startIndex,
rowset,
columns,
mapColumnNameToIndices)
{
// assert that rowset and columns are arrays
Errors.assertInternal(Util.isArray(rowset));
Errors.assertInternal(Util.isArray(columns));
//////////////////////////////////////////////////////////... | javascript | function convertRowsetToRows(
statement,
startIndex,
rowset,
columns,
mapColumnNameToIndices)
{
// assert that rowset and columns are arrays
Errors.assertInternal(Util.isArray(rowset));
Errors.assertInternal(Util.isArray(columns));
//////////////////////////////////////////////////////////... | [
"function",
"convertRowsetToRows",
"(",
"statement",
",",
"startIndex",
",",
"rowset",
",",
"columns",
",",
"mapColumnNameToIndices",
")",
"{",
"// assert that rowset and columns are arrays",
"Errors",
".",
"assertInternal",
"(",
"Util",
".",
"isArray",
"(",
"rowset",
... | Converts a rowset to an array of records.
@param statement
@param startIndex the chunk start index.
@param rowset
@param columns
@param mapColumnNameToIndices
@returns {Array}
@private | [
"Converts",
"a",
"rowset",
"to",
"an",
"array",
"of",
"records",
"."
] | 7ad71410a3bb679a96021b6b2d5b9b515f790db8 | https://github.com/snowflakedb/snowflake-connector-nodejs/blob/7ad71410a3bb679a96021b6b2d5b9b515f790db8/lib/connection/result/chunk.js#L298-L393 | train |
snowflakedb/snowflake-connector-nodejs | lib/connection/result/chunk.js | getColumnValue | function getColumnValue(columnIdentifier)
{
// resolve the column identifier to the correct column if possible
var column = resolveColumnIdentifierToColumn(
columns, columnIdentifier, mapColumnNameToIndices);
return column ? column.getRowValue(this) : undefined;
} | javascript | function getColumnValue(columnIdentifier)
{
// resolve the column identifier to the correct column if possible
var column = resolveColumnIdentifierToColumn(
columns, columnIdentifier, mapColumnNameToIndices);
return column ? column.getRowValue(this) : undefined;
} | [
"function",
"getColumnValue",
"(",
"columnIdentifier",
")",
"{",
"// resolve the column identifier to the correct column if possible",
"var",
"column",
"=",
"resolveColumnIdentifierToColumn",
"(",
"columns",
",",
"columnIdentifier",
",",
"mapColumnNameToIndices",
")",
";",
"ret... | Returns the value of a column.
@param {String | Number} columnIdentifier this can be either the column
name or the column index.
@returns {*} | [
"Returns",
"the",
"value",
"of",
"a",
"column",
"."
] | 7ad71410a3bb679a96021b6b2d5b9b515f790db8 | https://github.com/snowflakedb/snowflake-connector-nodejs/blob/7ad71410a3bb679a96021b6b2d5b9b515f790db8/lib/connection/result/chunk.js#L342-L349 | train |
snowflakedb/snowflake-connector-nodejs | lib/connection/result/chunk.js | getColumnValueAsString | function getColumnValueAsString(columnIdentifier)
{
// resolve the column identifier to the correct column if possible
var column = resolveColumnIdentifierToColumn(
columns, columnIdentifier, mapColumnNameToIndices);
return column ? column.getRowValueAsString(this) : undefined;
} | javascript | function getColumnValueAsString(columnIdentifier)
{
// resolve the column identifier to the correct column if possible
var column = resolveColumnIdentifierToColumn(
columns, columnIdentifier, mapColumnNameToIndices);
return column ? column.getRowValueAsString(this) : undefined;
} | [
"function",
"getColumnValueAsString",
"(",
"columnIdentifier",
")",
"{",
"// resolve the column identifier to the correct column if possible",
"var",
"column",
"=",
"resolveColumnIdentifierToColumn",
"(",
"columns",
",",
"columnIdentifier",
",",
"mapColumnNameToIndices",
")",
";"... | Returns the value of a column as a String.
@param {String | Number} columnIdentifier this can be either the column
name or the column index.
@returns {*} | [
"Returns",
"the",
"value",
"of",
"a",
"column",
"as",
"a",
"String",
"."
] | 7ad71410a3bb679a96021b6b2d5b9b515f790db8 | https://github.com/snowflakedb/snowflake-connector-nodejs/blob/7ad71410a3bb679a96021b6b2d5b9b515f790db8/lib/connection/result/chunk.js#L359-L366 | train |
snowflakedb/snowflake-connector-nodejs | lib/connection/result/chunk.js | resolveColumnIdentifierToColumn | function resolveColumnIdentifierToColumn(
columns, columnIdentifier, mapColumnNameToIndices)
{
var columnIndex;
// if the column identifier is a string, treat it as a column
// name and use it to get the index of the specified column
if (Util.isString(columnIdentifier))
{
// if a valid column name wa... | javascript | function resolveColumnIdentifierToColumn(
columns, columnIdentifier, mapColumnNameToIndices)
{
var columnIndex;
// if the column identifier is a string, treat it as a column
// name and use it to get the index of the specified column
if (Util.isString(columnIdentifier))
{
// if a valid column name wa... | [
"function",
"resolveColumnIdentifierToColumn",
"(",
"columns",
",",
"columnIdentifier",
",",
"mapColumnNameToIndices",
")",
"{",
"var",
"columnIndex",
";",
"// if the column identifier is a string, treat it as a column",
"// name and use it to get the index of the specified column",
"i... | Resolves a column identifier to the corresponding column if possible. The
column identifier can be a column name or a column index. If an invalid
column identifier is specified, we return undefined.
@param {Object[]} columns
@param {String | Number} columnIdentifier
@param {Object} mapColumnNameToIndices
@returns {*} | [
"Resolves",
"a",
"column",
"identifier",
"to",
"the",
"corresponding",
"column",
"if",
"possible",
".",
"The",
"column",
"identifier",
"can",
"be",
"a",
"column",
"name",
"or",
"a",
"column",
"index",
".",
"If",
"an",
"invalid",
"column",
"identifier",
"is",... | 7ad71410a3bb679a96021b6b2d5b9b515f790db8 | https://github.com/snowflakedb/snowflake-connector-nodejs/blob/7ad71410a3bb679a96021b6b2d5b9b515f790db8/lib/connection/result/chunk.js#L406-L429 | train |
snowflakedb/snowflake-connector-nodejs | lib/services/large_result_set.js | LargeResultSetService | function LargeResultSetService(connectionConfig, httpClient)
{
// validate input
Errors.assertInternal(Util.isObject(connectionConfig));
Errors.assertInternal(Util.isObject(httpClient));
function isRetryableError(response, err)
{
// https://aws.amazon.com/articles/1904 (Handling Errors)
// Note: 403'... | javascript | function LargeResultSetService(connectionConfig, httpClient)
{
// validate input
Errors.assertInternal(Util.isObject(connectionConfig));
Errors.assertInternal(Util.isObject(httpClient));
function isRetryableError(response, err)
{
// https://aws.amazon.com/articles/1904 (Handling Errors)
// Note: 403'... | [
"function",
"LargeResultSetService",
"(",
"connectionConfig",
",",
"httpClient",
")",
"{",
"// validate input",
"Errors",
".",
"assertInternal",
"(",
"Util",
".",
"isObject",
"(",
"connectionConfig",
")",
")",
";",
"Errors",
".",
"assertInternal",
"(",
"Util",
"."... | Creates a new instance of an LargeResultSetService.
@param {Object} connectionConfig
@param {Object} httpClient
@constructor | [
"Creates",
"a",
"new",
"instance",
"of",
"an",
"LargeResultSetService",
"."
] | 7ad71410a3bb679a96021b6b2d5b9b515f790db8 | https://github.com/snowflakedb/snowflake-connector-nodejs/blob/7ad71410a3bb679a96021b6b2d5b9b515f790db8/lib/services/large_result_set.js#L17-L113 | train |
snowflakedb/snowflake-connector-nodejs | lib/services/large_result_set.js | callback | function callback(err, response, body)
{
if (err)
{
// if we haven't exceeded the maximum number of retries yet and the
// server came back with a retryable error code.
if (numRetries < maxNumRetries && isRetryableError(response, err))
{
// increment the number ... | javascript | function callback(err, response, body)
{
if (err)
{
// if we haven't exceeded the maximum number of retries yet and the
// server came back with a retryable error code.
if (numRetries < maxNumRetries && isRetryableError(response, err))
{
// increment the number ... | [
"function",
"callback",
"(",
"err",
",",
"response",
",",
"body",
")",
"{",
"if",
"(",
"err",
")",
"{",
"// if we haven't exceeded the maximum number of retries yet and the",
"// server came back with a retryable error code.",
"if",
"(",
"numRetries",
"<",
"maxNumRetries",
... | invoked when the request completes | [
"invoked",
"when",
"the",
"request",
"completes"
] | 7ad71410a3bb679a96021b6b2d5b9b515f790db8 | https://github.com/snowflakedb/snowflake-connector-nodejs/blob/7ad71410a3bb679a96021b6b2d5b9b515f790db8/lib/services/large_result_set.js#L50-L95 | train |
snowflakedb/snowflake-connector-nodejs | lib/connection/result/column.js | convertRawDate | function convertRawDate(rawColumnValue, column, context)
{
return new SfTimestamp(
Number(rawColumnValue) * 86400, // convert to seconds
0, // no nano seconds
0, // no scale required
'UTC', // use utc as the tim... | javascript | function convertRawDate(rawColumnValue, column, context)
{
return new SfTimestamp(
Number(rawColumnValue) * 86400, // convert to seconds
0, // no nano seconds
0, // no scale required
'UTC', // use utc as the tim... | [
"function",
"convertRawDate",
"(",
"rawColumnValue",
",",
"column",
",",
"context",
")",
"{",
"return",
"new",
"SfTimestamp",
"(",
"Number",
"(",
"rawColumnValue",
")",
"*",
"86400",
",",
"// convert to seconds",
"0",
",",
"// no nano seconds",
"0",
",",
"// no ... | Converts a raw column value of type Date to a Snowflake Date.
@param {String} rawColumnValue
@param {Object} column
@param {Object} context
@returns {Date} | [
"Converts",
"a",
"raw",
"column",
"value",
"of",
"type",
"Date",
"to",
"a",
"Snowflake",
"Date",
"."
] | 7ad71410a3bb679a96021b6b2d5b9b515f790db8 | https://github.com/snowflakedb/snowflake-connector-nodejs/blob/7ad71410a3bb679a96021b6b2d5b9b515f790db8/lib/connection/result/column.js#L294-L302 | train |
snowflakedb/snowflake-connector-nodejs | lib/connection/result/column.js | convertRawTime | function convertRawTime(rawColumnValue, column, context)
{
var columnScale = column.getScale();
// the values might be big so use BigNumber to do arithmetic
var valFracSecsBig =
new BigNumber(rawColumnValue).times(Math.pow(10, columnScale));
return convertRawTimestampHelper(
valFracSecsBig,
... | javascript | function convertRawTime(rawColumnValue, column, context)
{
var columnScale = column.getScale();
// the values might be big so use BigNumber to do arithmetic
var valFracSecsBig =
new BigNumber(rawColumnValue).times(Math.pow(10, columnScale));
return convertRawTimestampHelper(
valFracSecsBig,
... | [
"function",
"convertRawTime",
"(",
"rawColumnValue",
",",
"column",
",",
"context",
")",
"{",
"var",
"columnScale",
"=",
"column",
".",
"getScale",
"(",
")",
";",
"// the values might be big so use BigNumber to do arithmetic",
"var",
"valFracSecsBig",
"=",
"new",
"Big... | Converts a raw column value of type Time to a Snowflake Time.
@param {String} rawColumnValue
@param {Object} column
@param {Object} context
@returns {Object} | [
"Converts",
"a",
"raw",
"column",
"value",
"of",
"type",
"Time",
"to",
"a",
"Snowflake",
"Time",
"."
] | 7ad71410a3bb679a96021b6b2d5b9b515f790db8 | https://github.com/snowflakedb/snowflake-connector-nodejs/blob/7ad71410a3bb679a96021b6b2d5b9b515f790db8/lib/connection/result/column.js#L313-L326 | train |
snowflakedb/snowflake-connector-nodejs | lib/connection/result/column.js | convertRawTimestampLtz | function convertRawTimestampLtz(rawColumnValue, column, context)
{
var columnScale = column.getScale();
// the values might be big so use BigNumber to do arithmetic
var valFracSecsBig =
new BigNumber(rawColumnValue).times(Math.pow(10, columnScale));
// create a new snowflake date
return convertRawTime... | javascript | function convertRawTimestampLtz(rawColumnValue, column, context)
{
var columnScale = column.getScale();
// the values might be big so use BigNumber to do arithmetic
var valFracSecsBig =
new BigNumber(rawColumnValue).times(Math.pow(10, columnScale));
// create a new snowflake date
return convertRawTime... | [
"function",
"convertRawTimestampLtz",
"(",
"rawColumnValue",
",",
"column",
",",
"context",
")",
"{",
"var",
"columnScale",
"=",
"column",
".",
"getScale",
"(",
")",
";",
"// the values might be big so use BigNumber to do arithmetic",
"var",
"valFracSecsBig",
"=",
"new"... | Converts a raw column value of type TIMESTAMP_LTZ to a Snowflake Date.
@param {String} rawColumnValue
@param {Object} column
@param {Object} context
@returns {Date} | [
"Converts",
"a",
"raw",
"column",
"value",
"of",
"type",
"TIMESTAMP_LTZ",
"to",
"a",
"Snowflake",
"Date",
"."
] | 7ad71410a3bb679a96021b6b2d5b9b515f790db8 | https://github.com/snowflakedb/snowflake-connector-nodejs/blob/7ad71410a3bb679a96021b6b2d5b9b515f790db8/lib/connection/result/column.js#L337-L351 | train |
snowflakedb/snowflake-connector-nodejs | lib/connection/result/column.js | convertRawTimestampTz | function convertRawTimestampTz(rawColumnValue, column, context)
{
var valFracSecsBig;
var valFracSecsWithTzBig;
var timezoneBig;
var timezone;
var timestampAndTZIndex;
// compute the scale factor
var columnScale = column.getScale();
var scaleFactor = Math.pow(10, columnScale);
var resultVersion = co... | javascript | function convertRawTimestampTz(rawColumnValue, column, context)
{
var valFracSecsBig;
var valFracSecsWithTzBig;
var timezoneBig;
var timezone;
var timestampAndTZIndex;
// compute the scale factor
var columnScale = column.getScale();
var scaleFactor = Math.pow(10, columnScale);
var resultVersion = co... | [
"function",
"convertRawTimestampTz",
"(",
"rawColumnValue",
",",
"column",
",",
"context",
")",
"{",
"var",
"valFracSecsBig",
";",
"var",
"valFracSecsWithTzBig",
";",
"var",
"timezoneBig",
";",
"var",
"timezone",
";",
"var",
"timestampAndTZIndex",
";",
"// compute t... | Converts a raw column value of type TIMESTAMP_TZ to a Snowflake Date.
@param {String} rawColumnValue
@param {Object} column
@param {Object} context
@returns {Date} | [
"Converts",
"a",
"raw",
"column",
"value",
"of",
"type",
"TIMESTAMP_TZ",
"to",
"a",
"Snowflake",
"Date",
"."
] | 7ad71410a3bb679a96021b6b2d5b9b515f790db8 | https://github.com/snowflakedb/snowflake-connector-nodejs/blob/7ad71410a3bb679a96021b6b2d5b9b515f790db8/lib/connection/result/column.js#L387-L451 | train |
snowflakedb/snowflake-connector-nodejs | lib/connection/result/column.js | convertRawVariant | function convertRawVariant(rawColumnValue, column, context)
{
var ret;
// if the input is a non-empty string, convert it to a json object
if (Util.string.isNotNullOrEmpty(rawColumnValue))
{
try
{
ret = eval("(" + rawColumnValue + ")");
}
catch (parseError)
{
// TODO: log the err... | javascript | function convertRawVariant(rawColumnValue, column, context)
{
var ret;
// if the input is a non-empty string, convert it to a json object
if (Util.string.isNotNullOrEmpty(rawColumnValue))
{
try
{
ret = eval("(" + rawColumnValue + ")");
}
catch (parseError)
{
// TODO: log the err... | [
"function",
"convertRawVariant",
"(",
"rawColumnValue",
",",
"column",
",",
"context",
")",
"{",
"var",
"ret",
";",
"// if the input is a non-empty string, convert it to a json object",
"if",
"(",
"Util",
".",
"string",
".",
"isNotNullOrEmpty",
"(",
"rawColumnValue",
")... | Converts a raw column value of type Variant to a JavaScript value.
@param {String} rawColumnValue
@param {Object} column
@param {Object} context
@returns {Object | Array} | [
"Converts",
"a",
"raw",
"column",
"value",
"of",
"type",
"Variant",
"to",
"a",
"JavaScript",
"value",
"."
] | 7ad71410a3bb679a96021b6b2d5b9b515f790db8 | https://github.com/snowflakedb/snowflake-connector-nodejs/blob/7ad71410a3bb679a96021b6b2d5b9b515f790db8/lib/connection/result/column.js#L498-L519 | train |
snowflakedb/snowflake-connector-nodejs | lib/connection/result/column.js | convertRawBinary | function convertRawBinary(rawColumnValue, column, context)
{
// Ensure the format is valid.
var format = context.format.toUpperCase();
Errors.assertInternal(format === "HEX" || format === "BASE64");
// Decode hex string sent by GS.
var buffer = Buffer.from(rawColumnValue, "HEX");
if (format === "HEX")
{... | javascript | function convertRawBinary(rawColumnValue, column, context)
{
// Ensure the format is valid.
var format = context.format.toUpperCase();
Errors.assertInternal(format === "HEX" || format === "BASE64");
// Decode hex string sent by GS.
var buffer = Buffer.from(rawColumnValue, "HEX");
if (format === "HEX")
{... | [
"function",
"convertRawBinary",
"(",
"rawColumnValue",
",",
"column",
",",
"context",
")",
"{",
"// Ensure the format is valid.",
"var",
"format",
"=",
"context",
".",
"format",
".",
"toUpperCase",
"(",
")",
";",
"Errors",
".",
"assertInternal",
"(",
"format",
"... | Converts a raw column value of type Binary to a Buffer.
@param {String} rawColumnValue
@param {Object} column
@param {Object} context
@returns {Buffer} | [
"Converts",
"a",
"raw",
"column",
"value",
"of",
"type",
"Binary",
"to",
"a",
"Buffer",
"."
] | 7ad71410a3bb679a96021b6b2d5b9b515f790db8 | https://github.com/snowflakedb/snowflake-connector-nodejs/blob/7ad71410a3bb679a96021b6b2d5b9b515f790db8/lib/connection/result/column.js#L530-L563 | train |
snowflakedb/snowflake-connector-nodejs | lib/connection/result/column.js | extractFromRow | function extractFromRow(row, context, asString)
{
var map = row._arrayProcessedColumns;
var values = row.values;
// get the value
var columnIndex = this.getIndex();
var ret = values[columnIndex];
// if we want the value as a string, and the column is of type variant, and we
// haven't already process... | javascript | function extractFromRow(row, context, asString)
{
var map = row._arrayProcessedColumns;
var values = row.values;
// get the value
var columnIndex = this.getIndex();
var ret = values[columnIndex];
// if we want the value as a string, and the column is of type variant, and we
// haven't already process... | [
"function",
"extractFromRow",
"(",
"row",
",",
"context",
",",
"asString",
")",
"{",
"var",
"map",
"=",
"row",
".",
"_arrayProcessedColumns",
";",
"var",
"values",
"=",
"row",
".",
"values",
";",
"// get the value",
"var",
"columnIndex",
"=",
"this",
".",
... | Extracts the value of a column from a given row.
@param {Object} row
@param {Object} context
@param {Boolean} asString
@returns {*} | [
"Extracts",
"the",
"value",
"of",
"a",
"column",
"from",
"a",
"given",
"row",
"."
] | 7ad71410a3bb679a96021b6b2d5b9b515f790db8 | https://github.com/snowflakedb/snowflake-connector-nodejs/blob/7ad71410a3bb679a96021b6b2d5b9b515f790db8/lib/connection/result/column.js#L709-L742 | train |
snowflakedb/snowflake-connector-nodejs | lib/connection/result/result.js | Result | function Result(options)
{
var data;
var chunkHeaders;
var parametersMap;
var parametersArray;
var length;
var index;
var parameter;
var mapColumnNameToIndices;
var columns;
var column;
// assert that options is a valid object that contains a response, statement,
// services and connection conf... | javascript | function Result(options)
{
var data;
var chunkHeaders;
var parametersMap;
var parametersArray;
var length;
var index;
var parameter;
var mapColumnNameToIndices;
var columns;
var column;
// assert that options is a valid object that contains a response, statement,
// services and connection conf... | [
"function",
"Result",
"(",
"options",
")",
"{",
"var",
"data",
";",
"var",
"chunkHeaders",
";",
"var",
"parametersMap",
";",
"var",
"parametersArray",
";",
"var",
"length",
";",
"var",
"index",
";",
"var",
"parameter",
";",
"var",
"mapColumnNameToIndices",
"... | Creates a new Result.
@param {Object} options
@constructor | [
"Creates",
"a",
"new",
"Result",
"."
] | 7ad71410a3bb679a96021b6b2d5b9b515f790db8 | https://github.com/snowflakedb/snowflake-connector-nodejs/blob/7ad71410a3bb679a96021b6b2d5b9b515f790db8/lib/connection/result/result.js#L21-L128 | train |
snowflakedb/snowflake-connector-nodejs | lib/connection/result/result.js | createSessionState | function createSessionState(responseData)
{
var currentRole = responseData.finalRoleName;
var currentWarehouse = responseData.finalWarehouseName;
var currentDatabaseProvider = responseData.databaseProvider;
var currentDatabase = responseData.finalDatabaseName;
var currentSchema ... | javascript | function createSessionState(responseData)
{
var currentRole = responseData.finalRoleName;
var currentWarehouse = responseData.finalWarehouseName;
var currentDatabaseProvider = responseData.databaseProvider;
var currentDatabase = responseData.finalDatabaseName;
var currentSchema ... | [
"function",
"createSessionState",
"(",
"responseData",
")",
"{",
"var",
"currentRole",
"=",
"responseData",
".",
"finalRoleName",
";",
"var",
"currentWarehouse",
"=",
"responseData",
".",
"finalWarehouseName",
";",
"var",
"currentDatabaseProvider",
"=",
"responseData",
... | Creates a session state object from the values of the current role, current
warehouse, etc., returned in the result response.
@param responseData
@returns {Object} | [
"Creates",
"a",
"session",
"state",
"object",
"from",
"the",
"values",
"of",
"the",
"current",
"role",
"current",
"warehouse",
"etc",
".",
"returned",
"in",
"the",
"result",
"response",
"."
] | 7ad71410a3bb679a96021b6b2d5b9b515f790db8 | https://github.com/snowflakedb/snowflake-connector-nodejs/blob/7ad71410a3bb679a96021b6b2d5b9b515f790db8/lib/connection/result/result.js#L195-L225 | train |
snowflakedb/snowflake-connector-nodejs | lib/connection/result/result.js | createChunks | function createChunks(chunkCfgs,
rowset,
columns,
mapColumnNameToIndices,
chunkHeaders,
statementParameters,
resultVersion,
statement,
services)... | javascript | function createChunks(chunkCfgs,
rowset,
columns,
mapColumnNameToIndices,
chunkHeaders,
statementParameters,
resultVersion,
statement,
services)... | [
"function",
"createChunks",
"(",
"chunkCfgs",
",",
"rowset",
",",
"columns",
",",
"mapColumnNameToIndices",
",",
"chunkHeaders",
",",
"statementParameters",
",",
"resultVersion",
",",
"statement",
",",
"services",
")",
"{",
"var",
"chunks",
";",
"var",
"startIndex... | Creates an array of Chunk instances from the chunk-related information in the
result response.
@param chunkCfgs
@param rowset
@param columns
@param mapColumnNameToIndices
@param chunkHeaders
@param statementParameters
@param resultVersion
@param statement
@param services
@returns {Chunk} | [
"Creates",
"an",
"array",
"of",
"Chunk",
"instances",
"from",
"the",
"chunk",
"-",
"related",
"information",
"in",
"the",
"result",
"response",
"."
] | 7ad71410a3bb679a96021b6b2d5b9b515f790db8 | https://github.com/snowflakedb/snowflake-connector-nodejs/blob/7ad71410a3bb679a96021b6b2d5b9b515f790db8/lib/connection/result/result.js#L243-L299 | train |
snowflakedb/snowflake-connector-nodejs | lib/connection/result/result.js | function(chunk)
{
// get all the rows in the current chunk that overlap with the requested
// window
var chunkStart = chunk.getStartIndex();
var chunkEnd = chunk.getEndIndex();
var rows = chunk.getRows().slice(
Math.max(chunkStart, start) - chunkStart,
Math.min(chunkEnd, en... | javascript | function(chunk)
{
// get all the rows in the current chunk that overlap with the requested
// window
var chunkStart = chunk.getStartIndex();
var chunkEnd = chunk.getEndIndex();
var rows = chunk.getRows().slice(
Math.max(chunkStart, start) - chunkStart,
Math.min(chunkEnd, en... | [
"function",
"(",
"chunk",
")",
"{",
"// get all the rows in the current chunk that overlap with the requested",
"// window",
"var",
"chunkStart",
"=",
"chunk",
".",
"getStartIndex",
"(",
")",
";",
"var",
"chunkEnd",
"=",
"chunk",
".",
"getEndIndex",
"(",
")",
";",
"... | Processes the rows in a given chunk.
@param {Object} chunk | [
"Processes",
"the",
"rows",
"in",
"a",
"given",
"chunk",
"."
] | 7ad71410a3bb679a96021b6b2d5b9b515f790db8 | https://github.com/snowflakedb/snowflake-connector-nodejs/blob/7ad71410a3bb679a96021b6b2d5b9b515f790db8/lib/connection/result/result.js#L402-L471 | train | |
snowflakedb/snowflake-connector-nodejs | lib/connection/result/result.js | function()
{
// get the start position and start time
var startIndex = rowIndex;
var startTime = Date.now();
var each = options.each;
while (rowIndex < rowsLength)
{
// invoke the each() callback on the current row
var ret = each(rows[rowIndex++]);
cont... | javascript | function()
{
// get the start position and start time
var startIndex = rowIndex;
var startTime = Date.now();
var each = options.each;
while (rowIndex < rowsLength)
{
// invoke the each() callback on the current row
var ret = each(rows[rowIndex++]);
cont... | [
"function",
"(",
")",
"{",
"// get the start position and start time",
"var",
"startIndex",
"=",
"rowIndex",
";",
"var",
"startTime",
"=",
"Date",
".",
"now",
"(",
")",
";",
"var",
"each",
"=",
"options",
".",
"each",
";",
"while",
"(",
"rowIndex",
"<",
"r... | create a function that can be called to batch-process rows | [
"create",
"a",
"function",
"that",
"can",
"be",
"called",
"to",
"batch",
"-",
"process",
"rows"
] | 7ad71410a3bb679a96021b6b2d5b9b515f790db8 | https://github.com/snowflakedb/snowflake-connector-nodejs/blob/7ad71410a3bb679a96021b6b2d5b9b515f790db8/lib/connection/result/result.js#L416-L467 | train | |
snowflakedb/snowflake-connector-nodejs | lib/connection/result/result.js | findOverlappingChunks | function findOverlappingChunks(chunks, windowStart, windowEnd)
{
var overlappingChunks = [];
if (chunks.length !== 0)
{
// get the index of the first chunk that overlaps with the specified window
var index = findFirstOverlappingChunk(chunks, windowStart, windowEnd);
// iterate over the chunks starti... | javascript | function findOverlappingChunks(chunks, windowStart, windowEnd)
{
var overlappingChunks = [];
if (chunks.length !== 0)
{
// get the index of the first chunk that overlaps with the specified window
var index = findFirstOverlappingChunk(chunks, windowStart, windowEnd);
// iterate over the chunks starti... | [
"function",
"findOverlappingChunks",
"(",
"chunks",
",",
"windowStart",
",",
"windowEnd",
")",
"{",
"var",
"overlappingChunks",
"=",
"[",
"]",
";",
"if",
"(",
"chunks",
".",
"length",
"!==",
"0",
")",
"{",
"// get the index of the first chunk that overlaps with the ... | Given a sorted array of chunks, returns a sub-array that overlaps with a
specified window.
@param chunks
@param windowStart
@param windowEnd
@returns {Array} | [
"Given",
"a",
"sorted",
"array",
"of",
"chunks",
"returns",
"a",
"sub",
"-",
"array",
"that",
"overlaps",
"with",
"a",
"specified",
"window",
"."
] | 7ad71410a3bb679a96021b6b2d5b9b515f790db8 | https://github.com/snowflakedb/snowflake-connector-nodejs/blob/7ad71410a3bb679a96021b6b2d5b9b515f790db8/lib/connection/result/result.js#L492-L519 | train |
snowflakedb/snowflake-connector-nodejs | lib/connection/result/result.js | findFirstOverlappingChunk | function findFirstOverlappingChunk(chunks, windowStartIndex, windowEndIndex)
{
var helper = function(chunks,
chunkIndexLeft,
chunkIndexRight,
windowStartIndex,
windowEndIndex)
{
var result;
var chunkIndexMiddle;
... | javascript | function findFirstOverlappingChunk(chunks, windowStartIndex, windowEndIndex)
{
var helper = function(chunks,
chunkIndexLeft,
chunkIndexRight,
windowStartIndex,
windowEndIndex)
{
var result;
var chunkIndexMiddle;
... | [
"function",
"findFirstOverlappingChunk",
"(",
"chunks",
",",
"windowStartIndex",
",",
"windowEndIndex",
")",
"{",
"var",
"helper",
"=",
"function",
"(",
"chunks",
",",
"chunkIndexLeft",
",",
"chunkIndexRight",
",",
"windowStartIndex",
",",
"windowEndIndex",
")",
"{"... | Given a sorted array of chunks, returns the index of the first chunk in the
array that overlaps with a specified window.
@param chunks
@param windowStartIndex
@param windowEndIndex
@returns {number} | [
"Given",
"a",
"sorted",
"array",
"of",
"chunks",
"returns",
"the",
"index",
"of",
"the",
"first",
"chunk",
"in",
"the",
"array",
"that",
"overlaps",
"with",
"a",
"specified",
"window",
"."
] | 7ad71410a3bb679a96021b6b2d5b9b515f790db8 | https://github.com/snowflakedb/snowflake-connector-nodejs/blob/7ad71410a3bb679a96021b6b2d5b9b515f790db8/lib/connection/result/result.js#L531-L637 | train |
snowflakedb/snowflake-connector-nodejs | lib/services/sf.js | function(state, transitionContext)
{
// this check is necessary to make sure we don't re-enter a transient state
// like Renewing when we're already in it
if (currentState !== state)
{
// if we have a current state, exit it; the null check is necessary
// because the currentState is undefi... | javascript | function(state, transitionContext)
{
// this check is necessary to make sure we don't re-enter a transient state
// like Renewing when we're already in it
if (currentState !== state)
{
// if we have a current state, exit it; the null check is necessary
// because the currentState is undefi... | [
"function",
"(",
"state",
",",
"transitionContext",
")",
"{",
"// this check is necessary to make sure we don't re-enter a transient state",
"// like Renewing when we're already in it",
"if",
"(",
"currentState",
"!==",
"state",
")",
"{",
"// if we have a current state, exit it; the ... | Transitions to a given state.
@param {Object} state
@param {Object} [transitionContext] | [
"Transitions",
"to",
"a",
"given",
"state",
"."
] | 7ad71410a3bb679a96021b6b2d5b9b515f790db8 | https://github.com/snowflakedb/snowflake-connector-nodejs/blob/7ad71410a3bb679a96021b6b2d5b9b515f790db8/lib/services/sf.js#L106-L126 | train | |
snowflakedb/snowflake-connector-nodejs | lib/services/sf.js | sendHttpRequest | function sendHttpRequest(requestOptions, httpClient)
{
return httpClient.request(
{
method : requestOptions.method,
headers : requestOptions.headers,
url : requestOptions.absoluteUrl,
gzip : requestOptions.gzip,
json : requestOptions.json,
callback : functio... | javascript | function sendHttpRequest(requestOptions, httpClient)
{
return httpClient.request(
{
method : requestOptions.method,
headers : requestOptions.headers,
url : requestOptions.absoluteUrl,
gzip : requestOptions.gzip,
json : requestOptions.json,
callback : functio... | [
"function",
"sendHttpRequest",
"(",
"requestOptions",
",",
"httpClient",
")",
"{",
"return",
"httpClient",
".",
"request",
"(",
"{",
"method",
":",
"requestOptions",
".",
"method",
",",
"headers",
":",
"requestOptions",
".",
"headers",
",",
"url",
":",
"reques... | Issues an http request to Snowflake.
@param {Object} requestOptions
@param {Object} httpClient
@returns {Object} the http request object. | [
"Issues",
"an",
"http",
"request",
"to",
"Snowflake",
"."
] | 7ad71410a3bb679a96021b6b2d5b9b515f790db8 | https://github.com/snowflakedb/snowflake-connector-nodejs/blob/7ad71410a3bb679a96021b6b2d5b9b515f790db8/lib/services/sf.js#L498-L564 | train |
snowflakedb/snowflake-connector-nodejs | lib/services/sf.js | buildLoginUrl | function buildLoginUrl(connectionConfig)
{
var queryParams =
[
{ name: 'warehouse', value: connectionConfig.getWarehouse() },
{ name: 'databaseName', value: connectionConfig.getDatabase() },
{ name: 'schemaName', value: connectionConfig.getSchema() },
{ name: 'roleName', value: connectionCo... | javascript | function buildLoginUrl(connectionConfig)
{
var queryParams =
[
{ name: 'warehouse', value: connectionConfig.getWarehouse() },
{ name: 'databaseName', value: connectionConfig.getDatabase() },
{ name: 'schemaName', value: connectionConfig.getSchema() },
{ name: 'roleName', value: connectionCo... | [
"function",
"buildLoginUrl",
"(",
"connectionConfig",
")",
"{",
"var",
"queryParams",
"=",
"[",
"{",
"name",
":",
"'warehouse'",
",",
"value",
":",
"connectionConfig",
".",
"getWarehouse",
"(",
")",
"}",
",",
"{",
"name",
":",
"'databaseName'",
",",
"value",... | Builds the url for a login request.
@param connectionConfig
@returns {*} | [
"Builds",
"the",
"url",
"for",
"a",
"login",
"request",
"."
] | 7ad71410a3bb679a96021b6b2d5b9b515f790db8 | https://github.com/snowflakedb/snowflake-connector-nodejs/blob/7ad71410a3bb679a96021b6b2d5b9b515f790db8/lib/services/sf.js#L1028-L1053 | train |
snowflakedb/snowflake-connector-nodejs | lib/http/base.js | HttpClient | function HttpClient(connectionConfig)
{
// save the connection config
this._connectionConfig = connectionConfig;
// check that we have a valid request module
var requestModule = this.getRequestModule();
Errors.assertInternal(
Util.isObject(requestModule) || Util.isFunction(requestModule));
} | javascript | function HttpClient(connectionConfig)
{
// save the connection config
this._connectionConfig = connectionConfig;
// check that we have a valid request module
var requestModule = this.getRequestModule();
Errors.assertInternal(
Util.isObject(requestModule) || Util.isFunction(requestModule));
} | [
"function",
"HttpClient",
"(",
"connectionConfig",
")",
"{",
"// save the connection config",
"this",
".",
"_connectionConfig",
"=",
"connectionConfig",
";",
"// check that we have a valid request module",
"var",
"requestModule",
"=",
"this",
".",
"getRequestModule",
"(",
"... | Creates a new HTTP client.
@param connectionConfig
@constructor | [
"Creates",
"a",
"new",
"HTTP",
"client",
"."
] | 7ad71410a3bb679a96021b6b2d5b9b515f790db8 | https://github.com/snowflakedb/snowflake-connector-nodejs/blob/7ad71410a3bb679a96021b6b2d5b9b515f790db8/lib/http/base.js#L18-L27 | train |
snowflakedb/snowflake-connector-nodejs | lib/http/base.js | normalizeHeaders | function normalizeHeaders(headers)
{
var ret = headers;
if (Util.isObject(headers))
{
ret = {};
// shallow copy the headers object and convert some headers like 'Accept'
// and 'Content-Type' to lower case while copying; this is necessary
// because the browser-request module, which we use to ma... | javascript | function normalizeHeaders(headers)
{
var ret = headers;
if (Util.isObject(headers))
{
ret = {};
// shallow copy the headers object and convert some headers like 'Accept'
// and 'Content-Type' to lower case while copying; this is necessary
// because the browser-request module, which we use to ma... | [
"function",
"normalizeHeaders",
"(",
"headers",
")",
"{",
"var",
"ret",
"=",
"headers",
";",
"if",
"(",
"Util",
".",
"isObject",
"(",
"headers",
")",
")",
"{",
"ret",
"=",
"{",
"}",
";",
"// shallow copy the headers object and convert some headers like 'Accept'",
... | Normalizes a request headers object so that we get the same behavior
regardless of whether we're using request.js or browser-request.js.
@param {Object} headers
@returns {Object} | [
"Normalizes",
"a",
"request",
"headers",
"object",
"so",
"that",
"we",
"get",
"the",
"same",
"behavior",
"regardless",
"of",
"whether",
"we",
"re",
"using",
"request",
".",
"js",
"or",
"browser",
"-",
"request",
".",
"js",
"."
] | 7ad71410a3bb679a96021b6b2d5b9b515f790db8 | https://github.com/snowflakedb/snowflake-connector-nodejs/blob/7ad71410a3bb679a96021b6b2d5b9b515f790db8/lib/http/base.js#L199-L236 | train |
snowflakedb/snowflake-connector-nodejs | lib/http/base.js | normalizeResponse | function normalizeResponse(response)
{
// if the response doesn't already have a getResponseHeader() method, add one
if (response && !response.getResponseHeader)
{
response.getResponseHeader = function(header)
{
return response.headers && response.headers[
Util.isString(header) ? heade... | javascript | function normalizeResponse(response)
{
// if the response doesn't already have a getResponseHeader() method, add one
if (response && !response.getResponseHeader)
{
response.getResponseHeader = function(header)
{
return response.headers && response.headers[
Util.isString(header) ? heade... | [
"function",
"normalizeResponse",
"(",
"response",
")",
"{",
"// if the response doesn't already have a getResponseHeader() method, add one",
"if",
"(",
"response",
"&&",
"!",
"response",
".",
"getResponseHeader",
")",
"{",
"response",
".",
"getResponseHeader",
"=",
"functio... | Normalizes the response object so that we can extract response headers from
it in a uniform way regardless of whether we're using request.js or
browser-request.js.
@param {Object} response
@return {Object} | [
"Normalizes",
"the",
"response",
"object",
"so",
"that",
"we",
"can",
"extract",
"response",
"headers",
"from",
"it",
"in",
"a",
"uniform",
"way",
"regardless",
"of",
"whether",
"we",
"re",
"using",
"request",
".",
"js",
"or",
"browser",
"-",
"request",
".... | 7ad71410a3bb679a96021b6b2d5b9b515f790db8 | https://github.com/snowflakedb/snowflake-connector-nodejs/blob/7ad71410a3bb679a96021b6b2d5b9b515f790db8/lib/http/base.js#L247-L260 | train |
snowflakedb/snowflake-connector-nodejs | lib/connection/result/row_stream.js | init | function init()
{
// the stream has now been initialized
initialized = true;
// if we have a result
if (context.result)
{
// if no value was specified for the start index or if the specified start
// index is negative, default to 0, otherwise truncate the fractional part
start =... | javascript | function init()
{
// the stream has now been initialized
initialized = true;
// if we have a result
if (context.result)
{
// if no value was specified for the start index or if the specified start
// index is negative, default to 0, otherwise truncate the fractional part
start =... | [
"function",
"init",
"(",
")",
"{",
"// the stream has now been initialized",
"initialized",
"=",
"true",
";",
"// if we have a result",
"if",
"(",
"context",
".",
"result",
")",
"{",
"// if no value was specified for the start index or if the specified start",
"// index is nega... | Initializes this stream. | [
"Initializes",
"this",
"stream",
"."
] | 7ad71410a3bb679a96021b6b2d5b9b515f790db8 | https://github.com/snowflakedb/snowflake-connector-nodejs/blob/7ad71410a3bb679a96021b6b2d5b9b515f790db8/lib/connection/result/row_stream.js#L92-L135 | train |
snowflakedb/snowflake-connector-nodejs | lib/connection/result/row_stream.js | processRowBuffer | function processRowBuffer()
{
// get the row to add to the read queue
var row = rowBuffer[rowIndex++];
// if we just read the last row in the row buffer, clear the row buffer and
// reset the row index so that we load the next chunk in the result stream
// when _read() is called
if (rowIndex ... | javascript | function processRowBuffer()
{
// get the row to add to the read queue
var row = rowBuffer[rowIndex++];
// if we just read the last row in the row buffer, clear the row buffer and
// reset the row index so that we load the next chunk in the result stream
// when _read() is called
if (rowIndex ... | [
"function",
"processRowBuffer",
"(",
")",
"{",
"// get the row to add to the read queue",
"var",
"row",
"=",
"rowBuffer",
"[",
"rowIndex",
"++",
"]",
";",
"// if we just read the last row in the row buffer, clear the row buffer and",
"// reset the row index so that we load the next c... | Processes the row buffer. | [
"Processes",
"the",
"row",
"buffer",
"."
] | 7ad71410a3bb679a96021b6b2d5b9b515f790db8 | https://github.com/snowflakedb/snowflake-connector-nodejs/blob/7ad71410a3bb679a96021b6b2d5b9b515f790db8/lib/connection/result/row_stream.js#L140-L170 | train |
snowflakedb/snowflake-connector-nodejs | lib/connection/result/row_stream.js | onResultStreamData | function onResultStreamData(chunk)
{
// unsubscribe from the result stream's 'data' and 'close' events
resultStream.removeListener('data', onResultStreamData);
resultStream.removeListener('close', onResultStreamClose);
// get all the rows in the chunk that overlap with the requested window,
// an... | javascript | function onResultStreamData(chunk)
{
// unsubscribe from the result stream's 'data' and 'close' events
resultStream.removeListener('data', onResultStreamData);
resultStream.removeListener('close', onResultStreamClose);
// get all the rows in the chunk that overlap with the requested window,
// an... | [
"function",
"onResultStreamData",
"(",
"chunk",
")",
"{",
"// unsubscribe from the result stream's 'data' and 'close' events",
"resultStream",
".",
"removeListener",
"(",
"'data'",
",",
"onResultStreamData",
")",
";",
"resultStream",
".",
"removeListener",
"(",
"'close'",
"... | Called when the result stream reads a new chunk.
@param {Chunk} chunk | [
"Called",
"when",
"the",
"result",
"stream",
"reads",
"a",
"new",
"chunk",
"."
] | 7ad71410a3bb679a96021b6b2d5b9b515f790db8 | https://github.com/snowflakedb/snowflake-connector-nodejs/blob/7ad71410a3bb679a96021b6b2d5b9b515f790db8/lib/connection/result/row_stream.js#L177-L196 | train |
snowflakedb/snowflake-connector-nodejs | lib/connection/result/row_stream.js | onResultStreamClose | function onResultStreamClose(err, continueCallback)
{
// if the error is retryable and
// the result stream hasn't been closed too many times
if (isResultStreamErrorRetryable(err) &&
(numResultStreamInterrupts <
context.connectionConfig.getResultStreamInterrupts()))
{
numResultSt... | javascript | function onResultStreamClose(err, continueCallback)
{
// if the error is retryable and
// the result stream hasn't been closed too many times
if (isResultStreamErrorRetryable(err) &&
(numResultStreamInterrupts <
context.connectionConfig.getResultStreamInterrupts()))
{
numResultSt... | [
"function",
"onResultStreamClose",
"(",
"err",
",",
"continueCallback",
")",
"{",
"// if the error is retryable and",
"// the result stream hasn't been closed too many times",
"if",
"(",
"isResultStreamErrorRetryable",
"(",
"err",
")",
"&&",
"(",
"numResultStreamInterrupts",
"<... | Called when there are no more chunks to read in the result stream or an
error is encountered while trying to read the next chunk.
@param err
@param continueCallback | [
"Called",
"when",
"there",
"are",
"no",
"more",
"chunks",
"to",
"read",
"in",
"the",
"result",
"stream",
"or",
"an",
"error",
"is",
"encountered",
"while",
"trying",
"to",
"read",
"the",
"next",
"chunk",
"."
] | 7ad71410a3bb679a96021b6b2d5b9b515f790db8 | https://github.com/snowflakedb/snowflake-connector-nodejs/blob/7ad71410a3bb679a96021b6b2d5b9b515f790db8/lib/connection/result/row_stream.js#L205-L232 | train |
snowflakedb/snowflake-connector-nodejs | lib/connection/result/row_stream.js | function(err)
{
// if we have a result stream, stop listening to events on it
if (resultStream)
{
resultStream.removeListener('data', onResultStreamData);
resultStream.removeListener('close', onResultStreamClose);
}
// we're done, so time to clean up
rowBuffer = null;
rowIndex... | javascript | function(err)
{
// if we have a result stream, stop listening to events on it
if (resultStream)
{
resultStream.removeListener('data', onResultStreamData);
resultStream.removeListener('close', onResultStreamClose);
}
// we're done, so time to clean up
rowBuffer = null;
rowIndex... | [
"function",
"(",
"err",
")",
"{",
"// if we have a result stream, stop listening to events on it",
"if",
"(",
"resultStream",
")",
"{",
"resultStream",
".",
"removeListener",
"(",
"'data'",
",",
"onResultStreamData",
")",
";",
"resultStream",
".",
"removeListener",
"(",... | Closes the row stream.
@param {Error} [err] | [
"Closes",
"the",
"row",
"stream",
"."
] | 7ad71410a3bb679a96021b6b2d5b9b515f790db8 | https://github.com/snowflakedb/snowflake-connector-nodejs/blob/7ad71410a3bb679a96021b6b2d5b9b515f790db8/lib/connection/result/row_stream.js#L239-L262 | train | |
snowflakedb/snowflake-connector-nodejs | lib/connection/result/row_stream.js | readNextRow | function readNextRow()
{
// if we have a row buffer, process it
if (rowBuffer)
{
processRowBuffer();
}
else
{
// subscribe to the result stream's 'data' and 'close' events
resultStream.on('data', onResultStreamData);
resultStream.on('close', onResultStreamClose);
... | javascript | function readNextRow()
{
// if we have a row buffer, process it
if (rowBuffer)
{
processRowBuffer();
}
else
{
// subscribe to the result stream's 'data' and 'close' events
resultStream.on('data', onResultStreamData);
resultStream.on('close', onResultStreamClose);
... | [
"function",
"readNextRow",
"(",
")",
"{",
"// if we have a row buffer, process it",
"if",
"(",
"rowBuffer",
")",
"{",
"processRowBuffer",
"(",
")",
";",
"}",
"else",
"{",
"// subscribe to the result stream's 'data' and 'close' events",
"resultStream",
".",
"on",
"(",
"'... | Called when we're ready to read the next row in the result. | [
"Called",
"when",
"we",
"re",
"ready",
"to",
"read",
"the",
"next",
"row",
"in",
"the",
"result",
"."
] | 7ad71410a3bb679a96021b6b2d5b9b515f790db8 | https://github.com/snowflakedb/snowflake-connector-nodejs/blob/7ad71410a3bb679a96021b6b2d5b9b515f790db8/lib/connection/result/row_stream.js#L267-L283 | train |
snowflakedb/snowflake-connector-nodejs | lib/connection/result/row_stream.js | isResultStreamErrorRetryable | function isResultStreamErrorRetryable(error)
{
return Errors.isLargeResultSetError(error) && error.response &&
(error.response.statusCode === 403);
} | javascript | function isResultStreamErrorRetryable(error)
{
return Errors.isLargeResultSetError(error) && error.response &&
(error.response.statusCode === 403);
} | [
"function",
"isResultStreamErrorRetryable",
"(",
"error",
")",
"{",
"return",
"Errors",
".",
"isLargeResultSetError",
"(",
"error",
")",
"&&",
"error",
".",
"response",
"&&",
"(",
"error",
".",
"response",
".",
"statusCode",
"===",
"403",
")",
";",
"}"
] | Determines if a result stream error is a retryable error.
@param {Error} error
@returns {Boolean} | [
"Determines",
"if",
"a",
"result",
"stream",
"error",
"is",
"a",
"retryable",
"error",
"."
] | 7ad71410a3bb679a96021b6b2d5b9b515f790db8 | https://github.com/snowflakedb/snowflake-connector-nodejs/blob/7ad71410a3bb679a96021b6b2d5b9b515f790db8/lib/connection/result/row_stream.js#L316-L320 | train |
snowflakedb/snowflake-connector-nodejs | lib/connection/result/row_stream.js | buildMapColumnExtractFnNames | function buildMapColumnExtractFnNames(columns, fetchAsString)
{
var fnNameGetColumnValue = 'getColumnValue';
var fnNameGetColumnValueAsString = 'getColumnValueAsString';
var index, length, column;
var mapColumnIdToExtractFnName = {};
// if no native types need to be retrieved as strings, extract values norm... | javascript | function buildMapColumnExtractFnNames(columns, fetchAsString)
{
var fnNameGetColumnValue = 'getColumnValue';
var fnNameGetColumnValueAsString = 'getColumnValueAsString';
var index, length, column;
var mapColumnIdToExtractFnName = {};
// if no native types need to be retrieved as strings, extract values norm... | [
"function",
"buildMapColumnExtractFnNames",
"(",
"columns",
",",
"fetchAsString",
")",
"{",
"var",
"fnNameGetColumnValue",
"=",
"'getColumnValue'",
";",
"var",
"fnNameGetColumnValueAsString",
"=",
"'getColumnValueAsString'",
";",
"var",
"index",
",",
"length",
",",
"col... | Builds a map in which the keys are column ids and the values are the names of
the extract functions to use when retrieving row values for the corresponding
columns.
@param {Object[]} columns
@param {String[]} fetchAsString the native types that should be retrieved as
strings.
@returns {Object} | [
"Builds",
"a",
"map",
"in",
"which",
"the",
"keys",
"are",
"column",
"ids",
"and",
"the",
"values",
"are",
"the",
"names",
"of",
"the",
"extract",
"functions",
"to",
"use",
"when",
"retrieving",
"row",
"values",
"for",
"the",
"corresponding",
"columns",
".... | 7ad71410a3bb679a96021b6b2d5b9b515f790db8 | https://github.com/snowflakedb/snowflake-connector-nodejs/blob/7ad71410a3bb679a96021b6b2d5b9b515f790db8/lib/connection/result/row_stream.js#L333-L372 | train |
snowflakedb/snowflake-connector-nodejs | lib/connection/result/row_stream.js | externalizeRow | function externalizeRow(row, columns, mapColumnIdToExtractFnName)
{
var externalizedRow = {};
for (var index = 0, length = columns.length; index < length; index++)
{
var column = columns[index];
var extractFnName = mapColumnIdToExtractFnName[column.getId()];
externalizedRow[column.getName()] = row[ext... | javascript | function externalizeRow(row, columns, mapColumnIdToExtractFnName)
{
var externalizedRow = {};
for (var index = 0, length = columns.length; index < length; index++)
{
var column = columns[index];
var extractFnName = mapColumnIdToExtractFnName[column.getId()];
externalizedRow[column.getName()] = row[ext... | [
"function",
"externalizeRow",
"(",
"row",
",",
"columns",
",",
"mapColumnIdToExtractFnName",
")",
"{",
"var",
"externalizedRow",
"=",
"{",
"}",
";",
"for",
"(",
"var",
"index",
"=",
"0",
",",
"length",
"=",
"columns",
".",
"length",
";",
"index",
"<",
"l... | Converts an internal representation of a result row to a format appropriate
for consumption by the outside world.
@param {Object} row
@param {Object[]} columns
@param {Object} [mapColumnIdToExtractFnName]
@returns {Object} | [
"Converts",
"an",
"internal",
"representation",
"of",
"a",
"result",
"row",
"to",
"a",
"format",
"appropriate",
"for",
"consumption",
"by",
"the",
"outside",
"world",
"."
] | 7ad71410a3bb679a96021b6b2d5b9b515f790db8 | https://github.com/snowflakedb/snowflake-connector-nodejs/blob/7ad71410a3bb679a96021b6b2d5b9b515f790db8/lib/connection/result/row_stream.js#L384-L395 | train |
PlatziDev/pulse-editor | src/utils/get-selection.js | getSelection | function getSelection (field) {
if (typeof field !== 'object') {
throw new TypeError('The field must be an object.')
}
return {
start: field.selectionStart,
end: field.selectionEnd
}
} | javascript | function getSelection (field) {
if (typeof field !== 'object') {
throw new TypeError('The field must be an object.')
}
return {
start: field.selectionStart,
end: field.selectionEnd
}
} | [
"function",
"getSelection",
"(",
"field",
")",
"{",
"if",
"(",
"typeof",
"field",
"!==",
"'object'",
")",
"{",
"throw",
"new",
"TypeError",
"(",
"'The field must be an object.'",
")",
"}",
"return",
"{",
"start",
":",
"field",
".",
"selectionStart",
",",
"en... | Get the element selection start and end values
@param {Element} field The DOM node element
@return {SelectionType} The selection start and end | [
"Get",
"the",
"element",
"selection",
"start",
"and",
"end",
"values"
] | 897bc0e91b365e305c06c038f0192a21e5f5fe4a | https://github.com/PlatziDev/pulse-editor/blob/897bc0e91b365e305c06c038f0192a21e5f5fe4a/src/utils/get-selection.js#L6-L15 | train |
PlatziDev/pulse-editor | src/utils/set-selection-range.js | setSelectionRange | function setSelectionRange (selection = false, field) {
if (!selection) return null
if (typeof selection !== 'object') {
throw new TypeError('The selection must be an object.')
}
if (typeof selection.start !== 'number') {
throw new TypeError('The selection start value must be a number.')
}
if (ty... | javascript | function setSelectionRange (selection = false, field) {
if (!selection) return null
if (typeof selection !== 'object') {
throw new TypeError('The selection must be an object.')
}
if (typeof selection.start !== 'number') {
throw new TypeError('The selection start value must be a number.')
}
if (ty... | [
"function",
"setSelectionRange",
"(",
"selection",
"=",
"false",
",",
"field",
")",
"{",
"if",
"(",
"!",
"selection",
")",
"return",
"null",
"if",
"(",
"typeof",
"selection",
"!==",
"'object'",
")",
"{",
"throw",
"new",
"TypeError",
"(",
"'The selection must... | Set the content selection range in the given field input
@param {Boolean} [selection=false] The selections positions
@param {Element} field The DOMNode field | [
"Set",
"the",
"content",
"selection",
"range",
"in",
"the",
"given",
"field",
"input"
] | 897bc0e91b365e305c06c038f0192a21e5f5fe4a | https://github.com/PlatziDev/pulse-editor/blob/897bc0e91b365e305c06c038f0192a21e5f5fe4a/src/utils/set-selection-range.js#L6-L43 | train |
PlatziDev/pulse-editor | src/utils/create-change-event.js | createChangeEvent | function createChangeEvent (selected, selection, markdown, native, html) {
if (typeof selected !== 'string') {
throw new TypeError('The selected content value must be a string.')
}
if (typeof selection !== 'object') {
throw new TypeError('The selection must be an object.')
}
if (typeof selection.sta... | javascript | function createChangeEvent (selected, selection, markdown, native, html) {
if (typeof selected !== 'string') {
throw new TypeError('The selected content value must be a string.')
}
if (typeof selection !== 'object') {
throw new TypeError('The selection must be an object.')
}
if (typeof selection.sta... | [
"function",
"createChangeEvent",
"(",
"selected",
",",
"selection",
",",
"markdown",
",",
"native",
",",
"html",
")",
"{",
"if",
"(",
"typeof",
"selected",
"!==",
"'string'",
")",
"{",
"throw",
"new",
"TypeError",
"(",
"'The selected content value must be a string... | Create a ChangeEvent object
@param {string} selected The selected text
@param {SelectionType} selection The selection position
@param {string} markdown The current value
@param {Object} native The native triggered DOM event
@param {string} html The parsed value as HT... | [
"Create",
"a",
"ChangeEvent",
"object"
] | 897bc0e91b365e305c06c038f0192a21e5f5fe4a | https://github.com/PlatziDev/pulse-editor/blob/897bc0e91b365e305c06c038f0192a21e5f5fe4a/src/utils/create-change-event.js#L10-L46 | train |
PlatziDev/pulse-editor | src/utils/update-content.js | updateContent | function updateContent (content, selection, updated) {
if (typeof content !== 'string') {
throw new TypeError('The content value must be a string.')
}
if (typeof selection !== 'object') {
throw new TypeError('The selection must be an object.')
}
if (typeof selection.start !== 'number') {
throw n... | javascript | function updateContent (content, selection, updated) {
if (typeof content !== 'string') {
throw new TypeError('The content value must be a string.')
}
if (typeof selection !== 'object') {
throw new TypeError('The selection must be an object.')
}
if (typeof selection.start !== 'number') {
throw n... | [
"function",
"updateContent",
"(",
"content",
",",
"selection",
",",
"updated",
")",
"{",
"if",
"(",
"typeof",
"content",
"!==",
"'string'",
")",
"{",
"throw",
"new",
"TypeError",
"(",
"'The content value must be a string.'",
")",
"}",
"if",
"(",
"typeof",
"sel... | Update the selected content with the updated content in the given full content
@param {string} content The full content string
@param {SelectionType} selection The selections positions
@param {string} updated The update slice of content
@return {string} The final updated content st... | [
"Update",
"the",
"selected",
"content",
"with",
"the",
"updated",
"content",
"in",
"the",
"given",
"full",
"content"
] | 897bc0e91b365e305c06c038f0192a21e5f5fe4a | https://github.com/PlatziDev/pulse-editor/blob/897bc0e91b365e305c06c038f0192a21e5f5fe4a/src/utils/update-content.js#L8-L30 | train |
PlatziDev/pulse-editor | src/utils/get-selected.js | getSelected | function getSelected (content, selection) {
if (typeof content !== 'string') {
throw new TypeError('The content must be a string.')
}
if (typeof selection !== 'object') {
throw new TypeError('The selection must be an object.')
}
if (typeof selection.start !== 'number') {
throw new TypeError('The... | javascript | function getSelected (content, selection) {
if (typeof content !== 'string') {
throw new TypeError('The content must be a string.')
}
if (typeof selection !== 'object') {
throw new TypeError('The selection must be an object.')
}
if (typeof selection.start !== 'number') {
throw new TypeError('The... | [
"function",
"getSelected",
"(",
"content",
",",
"selection",
")",
"{",
"if",
"(",
"typeof",
"content",
"!==",
"'string'",
")",
"{",
"throw",
"new",
"TypeError",
"(",
"'The content must be a string.'",
")",
"}",
"if",
"(",
"typeof",
"selection",
"!==",
"'object... | Get the piece of content selected from a full content stringa and
the selections positios
@param {string} content The full content string
@param {SelectionType} selection The selections positions
@return {string} The sliced string | [
"Get",
"the",
"piece",
"of",
"content",
"selected",
"from",
"a",
"full",
"content",
"stringa",
"and",
"the",
"selections",
"positios"
] | 897bc0e91b365e305c06c038f0192a21e5f5fe4a | https://github.com/PlatziDev/pulse-editor/blob/897bc0e91b365e305c06c038f0192a21e5f5fe4a/src/utils/get-selected.js#L8-L26 | train |
PlatziDev/pulse-editor | src/buttons/base.js | BaseButton | function BaseButton (props) {
return (
<button
{...props}
className={props.className}
onClick={props.onClick}
name={props.name}
disabled={props.disabled}
type='button'
children={props.children}
/>
)
} | javascript | function BaseButton (props) {
return (
<button
{...props}
className={props.className}
onClick={props.onClick}
name={props.name}
disabled={props.disabled}
type='button'
children={props.children}
/>
)
} | [
"function",
"BaseButton",
"(",
"props",
")",
"{",
"return",
"(",
"<",
"button",
"{",
"...",
"props",
"}",
"className",
"=",
"{",
"props",
".",
"className",
"}",
"onClick",
"=",
"{",
"props",
".",
"onClick",
"}",
"name",
"=",
"{",
"props",
".",
"name"... | The basic button without any functionality
@param {Object} props The base button props | [
"The",
"basic",
"button",
"without",
"any",
"functionality"
] | 897bc0e91b365e305c06c038f0192a21e5f5fe4a | https://github.com/PlatziDev/pulse-editor/blob/897bc0e91b365e305c06c038f0192a21e5f5fe4a/src/buttons/base.js#L10-L22 | train |
uber/tchannel-node | request-handler.js | RequestCallbackHandler | function RequestCallbackHandler(callback, thisp) {
var self = this;
self.callback = callback;
self.thisp = thisp || self;
} | javascript | function RequestCallbackHandler(callback, thisp) {
var self = this;
self.callback = callback;
self.thisp = thisp || self;
} | [
"function",
"RequestCallbackHandler",
"(",
"callback",
",",
"thisp",
")",
"{",
"var",
"self",
"=",
"this",
";",
"self",
".",
"callback",
"=",
"callback",
";",
"self",
".",
"thisp",
"=",
"thisp",
"||",
"self",
";",
"}"
] | The non-streamed request handler is only for the cases where neither the request or response can have streams. In this case, a req.stream indicates that the request is fragmented across multiple frames. | [
"The",
"non",
"-",
"streamed",
"request",
"handler",
"is",
"only",
"for",
"the",
"cases",
"where",
"neither",
"the",
"request",
"or",
"response",
"can",
"have",
"streams",
".",
"In",
"this",
"case",
"a",
"req",
".",
"stream",
"indicates",
"that",
"the",
... | d13525e0e157402726c91f05c788ce56dafbe3eb | https://github.com/uber/tchannel-node/blob/d13525e0e157402726c91f05c788ce56dafbe3eb/request-handler.js#L46-L50 | train |
uber/tchannel-node | request-handler.js | StreamedRequestCallbackHandler | function StreamedRequestCallbackHandler(callback, thisp) {
var self = this;
self.callback = callback;
self.thisp = thisp || self;
} | javascript | function StreamedRequestCallbackHandler(callback, thisp) {
var self = this;
self.callback = callback;
self.thisp = thisp || self;
} | [
"function",
"StreamedRequestCallbackHandler",
"(",
"callback",
",",
"thisp",
")",
"{",
"var",
"self",
"=",
"this",
";",
"self",
".",
"callback",
"=",
"callback",
";",
"self",
".",
"thisp",
"=",
"thisp",
"||",
"self",
";",
"}"
] | The streamed request handler is for cases where the handler function elects to deal with whether req.streamed and whether res.streamed. req.streamed may indicated either a streaming request or a fragmented request and the handler must distinguish the cases. | [
"The",
"streamed",
"request",
"handler",
"is",
"for",
"cases",
"where",
"the",
"handler",
"function",
"elects",
"to",
"deal",
"with",
"whether",
"req",
".",
"streamed",
"and",
"whether",
"res",
".",
"streamed",
".",
"req",
".",
"streamed",
"may",
"indicated"... | d13525e0e157402726c91f05c788ce56dafbe3eb | https://github.com/uber/tchannel-node/blob/d13525e0e157402726c91f05c788ce56dafbe3eb/request-handler.js#L86-L90 | train |
uber/tchannel-node | v2/call.js | allocifyPoolFn | function allocifyPoolFn(fn, ResultCons) {
return allocFn;
function allocFn(arg1, arg2, arg3) {
return fn(new ResultCons(), arg1, arg2, arg3);
}
} | javascript | function allocifyPoolFn(fn, ResultCons) {
return allocFn;
function allocFn(arg1, arg2, arg3) {
return fn(new ResultCons(), arg1, arg2, arg3);
}
} | [
"function",
"allocifyPoolFn",
"(",
"fn",
",",
"ResultCons",
")",
"{",
"return",
"allocFn",
";",
"function",
"allocFn",
"(",
"arg1",
",",
"arg2",
",",
"arg3",
")",
"{",
"return",
"fn",
"(",
"new",
"ResultCons",
"(",
")",
",",
"arg1",
",",
"arg2",
",",
... | Calls a pooled function and conveniently allocates a response object for it | [
"Calls",
"a",
"pooled",
"function",
"and",
"conveniently",
"allocates",
"a",
"response",
"object",
"for",
"it"
] | d13525e0e157402726c91f05c788ce56dafbe3eb | https://github.com/uber/tchannel-node/blob/d13525e0e157402726c91f05c788ce56dafbe3eb/v2/call.js#L74-L80 | train |
uber/tchannel-node | benchmarks/compare.js | descStats | function descStats(sample) {
var S = [].concat(sample);
S.sort(function sortOrder(a, b) {
return a - b;
});
var N = S.length;
var q1 = S[Math.floor(0.25 * N)];
var q2 = S[Math.floor(0.50 * N)];
var q3 = S[Math.floor(0.70 * N)];
var iqr = q3 - q1;
var tol = 3 * iqr / 2;
va... | javascript | function descStats(sample) {
var S = [].concat(sample);
S.sort(function sortOrder(a, b) {
return a - b;
});
var N = S.length;
var q1 = S[Math.floor(0.25 * N)];
var q2 = S[Math.floor(0.50 * N)];
var q3 = S[Math.floor(0.70 * N)];
var iqr = q3 - q1;
var tol = 3 * iqr / 2;
va... | [
"function",
"descStats",
"(",
"sample",
")",
"{",
"var",
"S",
"=",
"[",
"]",
".",
"concat",
"(",
"sample",
")",
";",
"S",
".",
"sort",
"(",
"function",
"sortOrder",
"(",
"a",
",",
"b",
")",
"{",
"return",
"a",
"-",
"b",
";",
"}",
")",
";",
"v... | return basic descriptive stats of some numerical sample | [
"return",
"basic",
"descriptive",
"stats",
"of",
"some",
"numerical",
"sample"
] | d13525e0e157402726c91f05c788ce56dafbe3eb | https://github.com/uber/tchannel-node/blob/d13525e0e157402726c91f05c788ce56dafbe3eb/benchmarks/compare.js#L108-L138 | train |
apigee-127/sway | lib/types/parameter.js | Parameter | function Parameter (opOrPathObject, definition, definitionFullyResolved, pathToDefinition) {
// Assign local properties
this.definition = definition;
this.definitionFullyResolved = definitionFullyResolved;
this.pathToDefinition = pathToDefinition;
this.ptr = JsonRefs.pathToPtr(pathToDefinition);
if (_.has(... | javascript | function Parameter (opOrPathObject, definition, definitionFullyResolved, pathToDefinition) {
// Assign local properties
this.definition = definition;
this.definitionFullyResolved = definitionFullyResolved;
this.pathToDefinition = pathToDefinition;
this.ptr = JsonRefs.pathToPtr(pathToDefinition);
if (_.has(... | [
"function",
"Parameter",
"(",
"opOrPathObject",
",",
"definition",
",",
"definitionFullyResolved",
",",
"pathToDefinition",
")",
"{",
"// Assign local properties",
"this",
".",
"definition",
"=",
"definition",
";",
"this",
".",
"definitionFullyResolved",
"=",
"definitio... | The OpenAPI Parameter object.
**Note:** Do not use directly.
**Extra Properties:** Other than the documented properties, this object also exposes all properties of the
[OpenAPI Parameter Object](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#parameterObject).
@param {module:sway.Operation... | [
"The",
"OpenAPI",
"Parameter",
"object",
"."
] | e9ad6e81af41f526567e9d5a0f150e59e429e513 | https://github.com/apigee-127/sway/blob/e9ad6e81af41f526567e9d5a0f150e59e429e513/lib/types/parameter.js#L61-L88 | train |
apigee-127/sway | lib/validation/validators.js | validateStructure | function validateStructure (apiDefinition) {
var results = helpers.validateAgainstSchema(helpers.getJSONSchemaValidator(),
swaggerSchema,
apiDefinition.definitionFullyResolved);
// Make complex JSON Schema validation errors... | javascript | function validateStructure (apiDefinition) {
var results = helpers.validateAgainstSchema(helpers.getJSONSchemaValidator(),
swaggerSchema,
apiDefinition.definitionFullyResolved);
// Make complex JSON Schema validation errors... | [
"function",
"validateStructure",
"(",
"apiDefinition",
")",
"{",
"var",
"results",
"=",
"helpers",
".",
"validateAgainstSchema",
"(",
"helpers",
".",
"getJSONSchemaValidator",
"(",
")",
",",
"swaggerSchema",
",",
"apiDefinition",
".",
"definitionFullyResolved",
")",
... | Validates the resolved OpenAPI Definition against the OpenAPI 3.x JSON Schema.
@param {ApiDefinition} apiDefinition - The `ApiDefinition` object
@returns {object} Object containing the errors and warnings of the validation | [
"Validates",
"the",
"resolved",
"OpenAPI",
"Definition",
"against",
"the",
"OpenAPI",
"3",
".",
"x",
"JSON",
"Schema",
"."
] | e9ad6e81af41f526567e9d5a0f150e59e429e513 | https://github.com/apigee-127/sway/blob/e9ad6e81af41f526567e9d5a0f150e59e429e513/lib/validation/validators.js#L107-L174 | train |
apigee-127/sway | lib/types/api-definition.js | ApiDefinition | function ApiDefinition (definition, definitionRemotesResolved, definitionFullyResolved, references, options) {
var that = this;
debug('Creating ApiDefinition from %s',
_.isString(options.definition) ? options.definition : 'the provided OpenAPI definition');
// Assign this so other object can use it
th... | javascript | function ApiDefinition (definition, definitionRemotesResolved, definitionFullyResolved, references, options) {
var that = this;
debug('Creating ApiDefinition from %s',
_.isString(options.definition) ? options.definition : 'the provided OpenAPI definition');
// Assign this so other object can use it
th... | [
"function",
"ApiDefinition",
"(",
"definition",
",",
"definitionRemotesResolved",
",",
"definitionFullyResolved",
",",
"references",
",",
"options",
")",
"{",
"var",
"that",
"=",
"this",
";",
"debug",
"(",
"'Creating ApiDefinition from %s'",
",",
"_",
".",
"isString... | The OpenAPI Definition object.
**Note:** Do not use directly.
**Extra Properties:** Other than the documented properties, this object also exposes all properties of the
[OpenAPI Object](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#openapi-object).
@param {object} definition - The origin... | [
"The",
"OpenAPI",
"Definition",
"object",
"."
] | e9ad6e81af41f526567e9d5a0f150e59e429e513 | https://github.com/apigee-127/sway/blob/e9ad6e81af41f526567e9d5a0f150e59e429e513/lib/types/api-definition.js#L69-L112 | train |
apigee-127/sway | lib/types/path.js | Path | function Path (apiDefinition, path, definition, definitionFullyResolved, pathToDefinition) {
var basePathPrefix = apiDefinition.definitionFullyResolved.basePath || '/';
var that = this;
var sanitizedPath;
// TODO: We could/should refactor this to use the path module
// Remove trailing slash from the basePat... | javascript | function Path (apiDefinition, path, definition, definitionFullyResolved, pathToDefinition) {
var basePathPrefix = apiDefinition.definitionFullyResolved.basePath || '/';
var that = this;
var sanitizedPath;
// TODO: We could/should refactor this to use the path module
// Remove trailing slash from the basePat... | [
"function",
"Path",
"(",
"apiDefinition",
",",
"path",
",",
"definition",
",",
"definitionFullyResolved",
",",
"pathToDefinition",
")",
"{",
"var",
"basePathPrefix",
"=",
"apiDefinition",
".",
"definitionFullyResolved",
".",
"basePath",
"||",
"'/'",
";",
"var",
"t... | The Path object.
**Note:** Do not use directly.
**Extra Properties:** Other than the documented properties, this object also exposes all properties of the
[OpenAPI Path Object](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#pathItemObject).
@param {module:sway.ApiDefinition} apiDefinition... | [
"The",
"Path",
"object",
"."
] | e9ad6e81af41f526567e9d5a0f150e59e429e513 | https://github.com/apigee-127/sway/blob/e9ad6e81af41f526567e9d5a0f150e59e429e513/lib/types/path.js#L64-L124 | train |
apigee-127/sway | lib/types/response.js | Response | function Response (operationObject, statusCode, definition, definitionFullyResolved, pathToDefinition) {
// Assign local properties
this.definition = definition;
this.definitionFullyResolved = definitionFullyResolved;
this.operationObject = operationObject;
this.pathToDefinition = pathToDefinition;
this.ptr... | javascript | function Response (operationObject, statusCode, definition, definitionFullyResolved, pathToDefinition) {
// Assign local properties
this.definition = definition;
this.definitionFullyResolved = definitionFullyResolved;
this.operationObject = operationObject;
this.pathToDefinition = pathToDefinition;
this.ptr... | [
"function",
"Response",
"(",
"operationObject",
",",
"statusCode",
",",
"definition",
",",
"definitionFullyResolved",
",",
"pathToDefinition",
")",
"{",
"// Assign local properties",
"this",
".",
"definition",
"=",
"definition",
";",
"this",
".",
"definitionFullyResolve... | The OpenAPI Response object.
**Note:** Do not use directly.
**Extra Properties:** Other than the documented properties, this object also exposes all properties of the
[OpenAPI Response Object](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#responseObject).
@param {module:sway.Operation} o... | [
"The",
"OpenAPI",
"Response",
"object",
"."
] | e9ad6e81af41f526567e9d5a0f150e59e429e513 | https://github.com/apigee-127/sway/blob/e9ad6e81af41f526567e9d5a0f150e59e429e513/lib/types/response.js#L60-L73 | train |
adaltas/node-nikita | packages/core/lib/misc/conditions.js | function({options}, succeed, skip) {
return each(options.if_exec).call((cmd, next) => {
this.log({
message: `Nikita \`if_exec\`: ${cmd}`,
level: 'DEBUG',
module: 'nikita/misc/conditions'
});
return this.system.execute({
cmd: cmd,
relax: true,
stderr_... | javascript | function({options}, succeed, skip) {
return each(options.if_exec).call((cmd, next) => {
this.log({
message: `Nikita \`if_exec\`: ${cmd}`,
level: 'DEBUG',
module: 'nikita/misc/conditions'
});
return this.system.execute({
cmd: cmd,
relax: true,
stderr_... | [
"function",
"(",
"{",
"options",
"}",
",",
"succeed",
",",
"skip",
")",
"{",
"return",
"each",
"(",
"options",
".",
"if_exec",
")",
".",
"call",
"(",
"(",
"cmd",
",",
"next",
")",
"=>",
"{",
"this",
".",
"log",
"(",
"{",
"message",
":",
"`",
"\... | The callback `succeed` is called if all the provided command were executed successfully otherwise the callback `skip` is called. | [
"The",
"callback",
"succeed",
"is",
"called",
"if",
"all",
"the",
"provided",
"command",
"were",
"executed",
"successfully",
"otherwise",
"the",
"callback",
"skip",
"is",
"called",
"."
] | 35c4b249da7f3fe3550f1679989d7795969fe6a6 | https://github.com/adaltas/node-nikita/blob/35c4b249da7f3fe3550f1679989d7795969fe6a6/packages/core/lib/misc/conditions.js#L207-L233 | train | |
adaltas/node-nikita | packages/core/lib/misc/conditions.js | function({options}, succeed, skip) {
// Default to `options.target` if "true"
if (typeof options.if_exists === 'boolean' && options.target) {
options.if_exists = options.if_exists ? [options.target] : null;
}
return each(options.if_exists).call((if_exists, next) => {
return this.fs.exists({
... | javascript | function({options}, succeed, skip) {
// Default to `options.target` if "true"
if (typeof options.if_exists === 'boolean' && options.target) {
options.if_exists = options.if_exists ? [options.target] : null;
}
return each(options.if_exists).call((if_exists, next) => {
return this.fs.exists({
... | [
"function",
"(",
"{",
"options",
"}",
",",
"succeed",
",",
"skip",
")",
"{",
"// Default to `options.target` if \"true\"",
"if",
"(",
"typeof",
"options",
".",
"if_exists",
"===",
"'boolean'",
"&&",
"options",
".",
"target",
")",
"{",
"options",
".",
"if_exist... | The callback `succeed` is called if all the provided paths exists otherwise the callback `skip` is called. | [
"The",
"callback",
"succeed",
"is",
"called",
"if",
"all",
"the",
"provided",
"paths",
"exists",
"otherwise",
"the",
"callback",
"skip",
"is",
"called",
"."
] | 35c4b249da7f3fe3550f1679989d7795969fe6a6 | https://github.com/adaltas/node-nikita/blob/35c4b249da7f3fe3550f1679989d7795969fe6a6/packages/core/lib/misc/conditions.js#L442-L468 | train | |
adaltas/node-nikita | packages/core/lib/misc/conditions.js | function({options}, succeed, skip) {
// Default to `options.target` if "true"
if (typeof options.unless_exists === 'boolean' && options.target) {
options.unless_exists = options.unless_exists ? [options.target] : null;
}
return each(options.unless_exists).call((unless_exists, next) => {
retu... | javascript | function({options}, succeed, skip) {
// Default to `options.target` if "true"
if (typeof options.unless_exists === 'boolean' && options.target) {
options.unless_exists = options.unless_exists ? [options.target] : null;
}
return each(options.unless_exists).call((unless_exists, next) => {
retu... | [
"function",
"(",
"{",
"options",
"}",
",",
"succeed",
",",
"skip",
")",
"{",
"// Default to `options.target` if \"true\"",
"if",
"(",
"typeof",
"options",
".",
"unless_exists",
"===",
"'boolean'",
"&&",
"options",
".",
"target",
")",
"{",
"options",
".",
"unle... | The callback `succeed` is called if none of the provided paths exists otherwise the callback `skip` is called. | [
"The",
"callback",
"succeed",
"is",
"called",
"if",
"none",
"of",
"the",
"provided",
"paths",
"exists",
"otherwise",
"the",
"callback",
"skip",
"is",
"called",
"."
] | 35c4b249da7f3fe3550f1679989d7795969fe6a6 | https://github.com/adaltas/node-nikita/blob/35c4b249da7f3fe3550f1679989d7795969fe6a6/packages/core/lib/misc/conditions.js#L478-L504 | train | |
adaltas/node-nikita | packages/core/lib/misc/conditions.js | function({options}, succeed, skip) {
var ssh;
// SSH connection
ssh = this.ssh(options.ssh);
return each(options.should_exist).call(function(should_exist, next) {
return fs.exists(ssh, should_exist, function(err, exists) {
if (exists) {
return next();
} else {
r... | javascript | function({options}, succeed, skip) {
var ssh;
// SSH connection
ssh = this.ssh(options.ssh);
return each(options.should_exist).call(function(should_exist, next) {
return fs.exists(ssh, should_exist, function(err, exists) {
if (exists) {
return next();
} else {
r... | [
"function",
"(",
"{",
"options",
"}",
",",
"succeed",
",",
"skip",
")",
"{",
"var",
"ssh",
";",
"// SSH connection",
"ssh",
"=",
"this",
".",
"ssh",
"(",
"options",
".",
"ssh",
")",
";",
"return",
"each",
"(",
"options",
".",
"should_exist",
")",
"."... | The callback `succeed` is called if all of the provided paths exists otherwise the callback `skip` is called with an error. | [
"The",
"callback",
"succeed",
"is",
"called",
"if",
"all",
"of",
"the",
"provided",
"paths",
"exists",
"otherwise",
"the",
"callback",
"skip",
"is",
"called",
"with",
"an",
"error",
"."
] | 35c4b249da7f3fe3550f1679989d7795969fe6a6 | https://github.com/adaltas/node-nikita/blob/35c4b249da7f3fe3550f1679989d7795969fe6a6/packages/core/lib/misc/conditions.js#L513-L526 | train | |
adaltas/node-nikita | packages/core/lib/misc/ini.js | function(content, undefinedOnly) {
var k, v;
for (k in content) {
v = content[k];
if (v && typeof v === 'object') {
content[k] = module.exports.clean(v, undefinedOnly);
continue;
}
if (typeof v === 'undefined') {
delete content[k];
}
if (!undefinedOnly... | javascript | function(content, undefinedOnly) {
var k, v;
for (k in content) {
v = content[k];
if (v && typeof v === 'object') {
content[k] = module.exports.clean(v, undefinedOnly);
continue;
}
if (typeof v === 'undefined') {
delete content[k];
}
if (!undefinedOnly... | [
"function",
"(",
"content",
",",
"undefinedOnly",
")",
"{",
"var",
"k",
",",
"v",
";",
"for",
"(",
"k",
"in",
"content",
")",
"{",
"v",
"=",
"content",
"[",
"k",
"]",
";",
"if",
"(",
"v",
"&&",
"typeof",
"v",
"===",
"'object'",
")",
"{",
"conte... | Remove undefined and null values | [
"Remove",
"undefined",
"and",
"null",
"values"
] | 35c4b249da7f3fe3550f1679989d7795969fe6a6 | https://github.com/adaltas/node-nikita/blob/35c4b249da7f3fe3550f1679989d7795969fe6a6/packages/core/lib/misc/ini.js#L11-L27 | train |
Subsets and Splits
SQL Console for semeru/code-text-javascript
Retrieves 20,000 non-null code samples labeled as JavaScript, providing a basic overview of the dataset.