diff --git a/api.js b/api.js index ab69e5e616..1bfc46f2e4 100644 --- a/api.js +++ b/api.js @@ -807,7 +807,7 @@ API.prototype.getBrowserTimingHeader = function getBrowserTimingHeader(options = * Only the first 13 chars of the license should be used for hashing with * the transaction name. */ - const key = config.license_key.substr(0, 13) + const key = config.license_key.substring(0, 13) rumHash.transactionName = hashes.obfuscateNameUsingKey(name, key) rumHash.queueTime = trans.queueTime diff --git a/bin/create-docs-pr.js b/bin/create-docs-pr.js index ceea213c7b..6db947facd 100644 --- a/bin/create-docs-pr.js +++ b/bin/create-docs-pr.js @@ -241,7 +241,7 @@ function formatReleaseNotes(releaseDate, version, body, frontmatter) { '---', 'subject: Node.js agent', `releaseDate: '${releaseDate}'`, - `version: ${version.substr(1)}`, // remove the `v` from start of version + `version: ${version.substring(1)}`, // remove the `v` from start of version `downloadLink: 'https://www.npmjs.com/package/newrelic'`, `security: ${frontmatter.security}`, `bugs: ${frontmatter.bugfixes}`, @@ -279,7 +279,7 @@ function addReleaseNotesFile(body, version) { function getFileName(version) { // change `v0.0.0` to `0-0-0` - version = version.substr(1).replace(/\./g, '-') + version = version.substring(1).replace(/\./g, '-') const FILE = `node-agent-${version}.mdx` return `${RELEASE_NOTES_PATH}/${FILE}` } diff --git a/lib/config/attribute-filter.js b/lib/config/attribute-filter.js index 468773cfbc..2cfa623e3e 100644 --- a/lib/config/attribute-filter.js +++ b/lib/config/attribute-filter.js @@ -367,7 +367,7 @@ function _convertRulesToRegex(rules) { if (i !== r.length - 1) { v += '.' } else if (/\\\*$/.test(v)) { - v = v.substr(0, v.length - 2) + v = v.substring(0, v.length - 2) } const idx = c.findIndex(function findV(a) { diff --git a/lib/instrumentation/aws-sdk/util.js b/lib/instrumentation/aws-sdk/util.js index c5b4912a8a..194b2b91b5 100644 --- a/lib/instrumentation/aws-sdk/util.js +++ b/lib/instrumentation/aws-sdk/util.js @@ -14,7 +14,7 @@ function grabLastUrlSegment(url = '/') { // string for null, undefined, NaN etc. url = '' + (url || '/') const lastSlashIndex = url.lastIndexOf('/') - return url.substr(lastSlashIndex + 1) + return url.substring(lastSlashIndex + 1) } /** diff --git a/lib/shim/datastore-shim.js b/lib/shim/datastore-shim.js index 82bee9e62e..9c1b85bfcc 100644 --- a/lib/shim/datastore-shim.js +++ b/lib/shim/datastore-shim.js @@ -376,10 +376,10 @@ function parseQuery(query, nodule) { // strip enclosing special characters from collection (table) name if (typeof collection === 'string' && collection.length > 2) { if (/^[\[{'"`]/.test(collection)) { - collection = collection.substr(1) + collection = collection.substring(1) } if (/[\]}'"`]$/.test(collection)) { - collection = collection.substr(0, collection.length - 1) + collection = collection.substring(0, collection.length - 1) } } diff --git a/lib/transaction/name-state.js b/lib/transaction/name-state.js index 3bcd746c75..e1eb4d9ac8 100644 --- a/lib/transaction/name-state.js +++ b/lib/transaction/name-state.js @@ -187,7 +187,7 @@ NameState.prototype.getPath = function getPath() { if (a[0] !== '/' && path[path.length - 1] !== '/') { path += '/' } else if (a[0] === '/' && path[path.length - 1] === '/') { - a = a.substr(1) + a = a.substring(1) } path += a } diff --git a/lib/util/hashes.js b/lib/util/hashes.js index 9e269598ea..1439e0064a 100644 --- a/lib/util/hashes.js +++ b/lib/util/hashes.js @@ -41,7 +41,8 @@ function calculatePathHash(appName, pathName, referingPathHash) { const result = (rotated ^ hash) >>> 0 // This is a trick to pad it out to 8 chars regardless of length. - return ('00000000' + result.toString(16)).substr(-8) + const str = '00000000' + result.toString(16) + return str.substring(str.length - 8) } function getHash(appName, txName) { @@ -78,7 +79,7 @@ function int32ToByteArray(int32) { // Lookup table for converting byte values to hex const byteToHex = [] for (let i = 0; i < 256; ++i) { - byteToHex[i] = (i + 0x100).toString(16).substr(1) + byteToHex[i] = (i + 0x100).toString(16).substring(1) } function makeId(length = 16) { diff --git a/lib/utilization/docker-info.js b/lib/utilization/docker-info.js index fe92783d0c..eeb8843c28 100644 --- a/lib/utilization/docker-info.js +++ b/lib/utilization/docker-info.js @@ -41,7 +41,7 @@ module.exports.getBootId = function getBootId(agent, callback) { if (data.length !== 36) { bootIdError() if (data.length > 128) { - data = data.substr(0, 128) + data = data.substring(0, 128) } } diff --git a/lib/utilization/gcp-info.js b/lib/utilization/gcp-info.js index 990c4f73dd..380fd75d59 100644 --- a/lib/utilization/gcp-info.js +++ b/lib/utilization/gcp-info.js @@ -54,8 +54,10 @@ function fetchGCPInfo(agent, callback) { agent.metrics.getOrCreateMetric(NAMES.UTILIZATION.GCP_ERROR).incrementCallCount() } else { // normalize - results.machineType = results.machineType.substr(results.machineType.lastIndexOf('/') + 1) - results.zone = results.zone.substr(results.zone.lastIndexOf('/') + 1) + results.machineType = results.machineType.substring( + results.machineType.lastIndexOf('/') + 1 + ) + results.zone = results.zone.substring(results.zone.lastIndexOf('/') + 1) resultDict = results } diff --git a/test/integration/instrumentation/http-rum.tap.js b/test/integration/instrumentation/http-rum.tap.js index 87ab732785..b9ffc47386 100644 --- a/test/integration/instrumentation/http-rum.tap.js +++ b/test/integration/instrumentation/http-rum.tap.js @@ -56,14 +56,14 @@ test('custom naming rules should be applied early for RUM', function (t) { function done(res) { res.pipe( new StreamSink(function (err, header) { - t.equal(header.substr(0, 7), '