| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 32839c6 commit 8653d92
13 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -231,7 +231,7 @@ const { requireFromInside, importFromInside } = fromInside; | |||
| 231 | 231 | }); | |
| 232 | 232 | ||
| 233 | 233 | function assertStartsWith(actual, expected) { | |
| 234 | - const start = actual.toString().substr(0, expected.length); | ||
| 234 | + const start = actual.toString().slice(0, expected.length); | ||
| 235 | 235 | strictEqual(start, expected); | |
| 236 | 236 | } | |
| 237 | 237 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -124,7 +124,7 @@ requireFixture('#cjs').then(mustCall((actual) => { | |||
| 124 | 124 | })); | |
| 125 | 125 | ||
| 126 | 126 | function assertStartsWith(actual, expected) { | |
| 127 | - const start = actual.toString().substr(0, expected.length); | ||
| 127 | + const start = actual.toString().slice(0, expected.length); | ||
| 128 | 128 | strictEqual(start, expected); | |
| 129 | 129 | } | |
| 130 | 130 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -284,7 +284,7 @@ for (const test of TEST_CASES) { | |||
| 284 | 284 | cipher.update('01234567', 'hex'); | |
| 285 | 285 | cipher.final(); | |
| 286 | 286 | const tag = cipher.getAuthTag(); | |
| 287 | - assert.strictEqual(tag.toString('hex'), fullTag.substr(0, 2 * e)); | ||
| 287 | + assert.strictEqual(tag.toString('hex'), fullTag.slice(0, 2 * e)); | ||
| 288 | 288 | } | |
| 289 | 289 | } | |
| 290 | 290 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -272,8 +272,8 @@ for (let i = 0, l = rfc4231.length; i < l; i++) { | |||
| 272 | 272 | .update(rfc4231[i].data) | |
| 273 | 273 | .digest('hex'); | |
| 274 | 274 | if (rfc4231[i].truncate) { | |
| 275 | - actual = actual.substr(0, 32); // first 128 bits == 32 hex chars | ||
| 276 | - strRes = strRes.substr(0, 32); | ||
| 275 | + actual = actual.slice(0, 32); // first 128 bits == 32 hex chars | ||
| 276 | + strRes = strRes.slice(0, 32); | ||
| 277 | 277 | } | |
| 278 | 278 | const expected = rfc4231[i].hmac[hash]; | |
| 279 | 279 | assert.strictEqual( | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -34,11 +34,11 @@ for (let n = 0; n < 130; n++) { | |||
| 34 | 34 | ||
| 35 | 35 | // Check that version 4 identifier was populated. | |
| 36 | 36 | assert.strictEqual( | |
| 37 | - Buffer.from(uuid.substr(14, 2), 'hex')[0] & 0x40, 0x40); | ||
| 37 | + Buffer.from(uuid.slice(14, 16), 'hex')[0] & 0x40, 0x40); | ||
| 38 | 38 | ||
| 39 | 39 | // Check that clock_seq_hi_and_reserved was populated with reserved bits. | |
| 40 | 40 | assert.strictEqual( | |
| 41 | - Buffer.from(uuid.substr(19, 2), 'hex')[0] & 0b1100_0000, 0b1000_0000); | ||
| 41 | + Buffer.from(uuid.slice(19, 21), 'hex')[0] & 0b1100_0000, 0b1000_0000); | ||
| 42 | 42 | } | |
| 43 | 43 | ||
| 44 | 44 | // Test non-buffered UUID's | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -42,7 +42,7 @@ let root = '/'; | |||
| 42 | 42 | let assertEqualPath = assert.strictEqual; | |
| 43 | 43 | if (common.isWindows) { | |
| 44 | 44 | // Something like "C:\\" | |
| 45 | - root = process.cwd().substr(0, 3); | ||
| 45 | + root = process.cwd().slice(0, 3); | ||
| 46 | 46 | assertEqualPath = function(path_left, path_right, message) { | |
| 47 | 47 | assert | |
| 48 | 48 | .strictEqual(path_left.toLowerCase(), path_right.toLowerCase(), message); | |
@@ -367,7 +367,7 @@ function test_deep_symlink_mix(realpath, realpathSync, callback) { | |||
| 367 | 367 | function test_non_symlinks(realpath, realpathSync, callback) { | |
| 368 | 368 | console.log('test_non_symlinks'); | |
| 369 | 369 | const entrydir = path.dirname(tmpAbsDir); | |
| 370 | - const entry = `${tmpAbsDir.substr(entrydir.length + 1)}/cycles/root.js`; | ||
| 370 | + const entry = `${tmpAbsDir.slice(entrydir.length + 1)}/cycles/root.js`; | ||
| 371 | 371 | const expected = `${tmpAbsDir}/cycles/root.js`; | |
| 372 | 372 | const origcwd = process.cwd(); | |
| 373 | 373 | process.chdir(entrydir); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -26,7 +26,7 @@ const server = http.createServer(function(req, res) { | |||
| 26 | 26 | res.removeHeader('Date'); | |
| 27 | 27 | res.setHeader('Keep-Alive', 'timeout=1'); | |
| 28 | 28 | ||
| 29 | - switch (req.url.substr(1)) { | ||
| 29 | + switch (req.url.slice(1)) { | ||
| 30 | 30 | case 'multiple-writes': | |
| 31 | 31 | delete req.headers.host; | |
| 32 | 32 | assert.deepStrictEqual(req.headers, expectedHeadersMultipleWrites); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -100,7 +100,7 @@ function test_upgrade_with_listener() { | |||
| 100 | 100 | assert.strictEqual(typeof data, 'string'); | |
| 101 | 101 | ||
| 102 | 102 | if (state === 1) { | |
| 103 | - assert.strictEqual(data.substr(0, 12), 'HTTP/1.1 101'); | ||
| 103 | + assert.strictEqual(data.slice(0, 12), 'HTTP/1.1 101'); | ||
| 104 | 104 | assert.strictEqual(request_upgradeHead.toString('utf8'), 'WjN}|M(6'); | |
| 105 | 105 | conn.write('test', 'utf8'); | |
| 106 | 106 | } else if (state === 2) { | |
@@ -133,7 +133,7 @@ function test_upgrade_no_listener() { | |||
| 133 | 133 | ||
| 134 | 134 | conn.once('data', (data) => { | |
| 135 | 135 | assert.strictEqual(typeof data, 'string'); | |
| 136 | - assert.strictEqual(data.substr(0, 12), 'HTTP/1.1 200'); | ||
| 136 | + assert.strictEqual(data.slice(0, 12), 'HTTP/1.1 200'); | ||
| 137 | 137 | conn.end(); | |
| 138 | 138 | }); | |
| 139 | 139 | ||
@@ -153,7 +153,7 @@ function test_standard_http() { | |||
| 153 | 153 | ||
| 154 | 154 | conn.once('data', function(data) { | |
| 155 | 155 | assert.strictEqual(typeof data, 'string'); | |
| 156 | - assert.strictEqual(data.substr(0, 12), 'HTTP/1.1 200'); | ||
| 156 | + assert.strictEqual(data.slice(0, 12), 'HTTP/1.1 200'); | ||
| 157 | 157 | conn.end(); | |
| 158 | 158 | }); | |
| 159 | 159 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3,7 +3,7 @@ const common = require('../common'); | |||
| 3 | 3 | const assert = require('assert'); | |
| 4 | 4 | const path = require('path'); | |
| 5 | 5 | ||
| 6 | - assert.strictEqual(path.dirname(__filename).substr(-13), | ||
| 6 | + assert.strictEqual(path.dirname(__filename).slice(-13), | ||
| 7 | 7 | common.isWindows ? 'test\\parallel' : 'test/parallel'); | |
| 8 | 8 | ||
| 9 | 9 | assert.strictEqual(path.posix.dirname('/a/b/'), '/a'); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -584,7 +584,7 @@ testMe.complete('obj.', common.mustCall(function(error, data) { | |||
| 584 | 584 | ||
| 585 | 585 | data[0].forEach((key) => { | |
| 586 | 586 | if (!key || key === 'ele.biu') return; | |
| 587 | - assert.notStrictEqual(ele[key.substr(4)], undefined); | ||
| 587 | + assert.notStrictEqual(ele[key.slice(4)], undefined); | ||
| 588 | 588 | }); | |
| 589 | 589 | })); | |
| 590 | 590 | }); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments