Skip to content

Commit

Permalink
remove use of substr
Browse files Browse the repository at this point in the history
  • Loading branch information
vitaly-t committed Apr 6, 2024
1 parent 06947b2 commit ad5f18e
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions lib/formatting.js
Expand Up @@ -170,7 +170,7 @@ const formatAs = {
array({query, array, raw, options}) {
options = options && typeof options === 'object' ? options : {};
return query.replace(npm.patterns.multipleValues, name => {
const v = formatAs.stripName(name.substr(1), raw);
const v = formatAs.stripName(name.substring(1), raw);
const idx = v.name - 1;
if (idx >= maxVariable) {
throw new RangeError(`Variable $${v.name} exceeds supported maximum of $${maxVariable}`);
Expand Down Expand Up @@ -200,7 +200,7 @@ const formatAs = {
const mod = name.match(npm.patterns.hasValidModifier);
if (mod) {
return {
name: name.substr(0, mod.index),
name: name.substring(0, mod.index),
fm: fmMap[mod[0]] | (raw ? fmFlags.raw : 0)
};
}
Expand Down
4 changes: 2 additions & 2 deletions lib/helpers/column.js
Expand Up @@ -266,11 +266,11 @@ function parseColumn(name) {
const res = {};
if (name[0] === '?') {
res.cnd = true;
name = name.substr(1);
name = name.substring(1);
}
const mod = name.match(npm.patterns.hasValidModifier);
if (mod) {
res.name = name.substr(0, mod.index);
res.name = name.substring(0, mod.index);
res.mod = mod[0];
} else {
res.name = name;
Expand Down
2 changes: 1 addition & 1 deletion lib/utils/index.js
Expand Up @@ -162,7 +162,7 @@ function addInspection(type, cb) {
// This is for detecting when to skip executing ROLLBACK for a failed transaction.
function isConnectivityError(err) {
const code = err && typeof err.code === 'string' && err.code;
const cls = code && code.substr(0, 2); // Error Class
const cls = code && code.substring(0, 2); // Error Class
// istanbul ignore next (we cannot test-cover all error cases):
return code === 'ECONNRESET' || (cls === '08' && code !== '08P01') || (cls === '57' && code !== '57014');
// Code 'ECONNRESET' - Connectivity issue handled by the driver.
Expand Down
2 changes: 1 addition & 1 deletion lib/utils/public.js
Expand Up @@ -39,7 +39,7 @@ const npm = {
*/
function camelize(text) {
text = text.replace(/[-_\s.]+(.)?/g, (_, c) => c ? c.toUpperCase() : '');
return text.substr(0, 1).toLowerCase() + text.substr(1);
return text.substring(0, 1).toLowerCase() + text.substring(1);
}

/**
Expand Down

0 comments on commit ad5f18e

Please sign in to comment.