| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 45b730e commit 355523f
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -24,7 +24,6 @@ const { compare } = process.binding('buffer'); | |||
| 24 | 24 | const util = require('util'); | |
| 25 | 25 | const { isSet, isMap } = process.binding('util'); | |
| 26 | 26 | const { objectToString } = require('internal/util'); | |
| 27 | - const { Buffer } = require('buffer'); | ||
| 28 | 27 | const errors = require('internal/errors'); | |
| 29 | 28 | ||
| 30 | 29 | // The assert module provides functions that throw | |
@@ -119,6 +118,7 @@ function areSimilarRegExps(a, b) { | |||
| 119 | 118 | // barrier including the Buffer.from operation takes the advantage of the faster | |
| 120 | 119 | // compare otherwise. 300 was the number after which compare became faster. | |
| 121 | 120 | function areSimilarTypedArrays(a, b) { | |
| 121 | + const { from } = require('buffer').Buffer; | ||
| 122 | 122 | const len = a.byteLength; | |
| 123 | 123 | if (len !== b.byteLength) { | |
| 124 | 124 | return false; | |
@@ -131,12 +131,8 @@ function areSimilarTypedArrays(a, b) { | |||
| 131 | 131 | } | |
| 132 | 132 | return true; | |
| 133 | 133 | } | |
| 134 | - return compare(Buffer.from(a.buffer, | ||
| 135 | - a.byteOffset, | ||
| 136 | - len), | ||
| 137 | - Buffer.from(b.buffer, | ||
| 138 | - b.byteOffset, | ||
| 139 | - b.byteLength)) === 0; | ||
| 134 | + return compare(from(a.buffer, a.byteOffset, len), | ||
| 135 | + from(b.buffer, b.byteOffset, b.byteLength)) === 0; | ||
| 140 | 136 | } | |
| 141 | 137 | ||
| 142 | 138 | function isFloatTypedArrayTag(tag) { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments