summaryrefslogtreecommitdiff
path: root/tools/eslint/node_modules/safe-buffer/index.js
diff options
context:
space:
mode:
authorRich Trott <rtrott@gmail.com>2017-06-23 20:14:33 -0700
committerRich Trott <rtrott@gmail.com>2017-06-27 06:16:51 -0700
commitaaee43473b7abc2522d9968a92fb4c819fc7d7b3 (patch)
treed9b7e84c5d7aa3fec9474773735f702dd7590778 /tools/eslint/node_modules/safe-buffer/index.js
parentfda25665be353396518927ad42a2f617816591c6 (diff)
downloadnode-new-aaee43473b7abc2522d9968a92fb4c819fc7d7b3.tar.gz
tools: update to ESLint 4.1.0
Update ESLint to 4.1.0. This fixes a bug that previously prevented us from using the new and stricter indentation checking. Refs: https://github.com/eslint/eslint/issues/8721 PR-URL: https://github.com/nodejs/node/pull/13895 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Michaƫl Zasso <targos@protonmail.com>
Diffstat (limited to 'tools/eslint/node_modules/safe-buffer/index.js')
-rw-r--r--tools/eslint/node_modules/safe-buffer/index.js16
1 files changed, 10 insertions, 6 deletions
diff --git a/tools/eslint/node_modules/safe-buffer/index.js b/tools/eslint/node_modules/safe-buffer/index.js
index 74a7358ee8..22438dabbb 100644
--- a/tools/eslint/node_modules/safe-buffer/index.js
+++ b/tools/eslint/node_modules/safe-buffer/index.js
@@ -1,12 +1,18 @@
+/* eslint-disable node/no-deprecated-api */
var buffer = require('buffer')
+var Buffer = buffer.Buffer
+// alternative to using Object.keys for old browsers
+function copyProps (src, dst) {
+ for (var key in src) {
+ dst[key] = src[key]
+ }
+}
if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) {
module.exports = buffer
} else {
// Copy properties from require('buffer')
- Object.keys(buffer).forEach(function (prop) {
- exports[prop] = buffer[prop]
- })
+ copyProps(buffer, exports)
exports.Buffer = SafeBuffer
}
@@ -15,9 +21,7 @@ function SafeBuffer (arg, encodingOrOffset, length) {
}
// Copy static methods from Buffer
-Object.keys(Buffer).forEach(function (prop) {
- SafeBuffer[prop] = Buffer[prop]
-})
+copyProps(Buffer, SafeBuffer)
SafeBuffer.from = function (arg, encodingOrOffset, length) {
if (typeof arg === 'number') {