mirror of https://github.com/status-im/metro.git
Fix flow error when calling hash.digest()
Reviewed By: cpojer Differential Revision: D6598742 fbshipit-source-id: 47bd6f0ee0d54c61c2ff9b201005e7366d9df76d
This commit is contained in:
parent
3b497585f1
commit
dfb5d95a0d
|
@ -0,0 +1,30 @@
|
||||||
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
|
exports[`exports the blacklist creator 1`] = `
|
||||||
|
Object {
|
||||||
|
"data": Array [
|
||||||
|
56,
|
||||||
|
131,
|
||||||
|
13,
|
||||||
|
89,
|
||||||
|
254,
|
||||||
|
63,
|
||||||
|
108,
|
||||||
|
210,
|
||||||
|
213,
|
||||||
|
112,
|
||||||
|
53,
|
||||||
|
173,
|
||||||
|
11,
|
||||||
|
21,
|
||||||
|
31,
|
||||||
|
184,
|
||||||
|
133,
|
||||||
|
221,
|
||||||
|
114,
|
||||||
|
86,
|
||||||
|
1,
|
||||||
|
],
|
||||||
|
"type": "Buffer",
|
||||||
|
}
|
||||||
|
`;
|
|
@ -0,0 +1,18 @@
|
||||||
|
/**
|
||||||
|
* Copyright (c) 2015-present, Facebook, Inc.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This source code is licensed under the BSD-style license found in the
|
||||||
|
* LICENSE file in the root directory of this source tree. An additional grant
|
||||||
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
|
*
|
||||||
|
* @format
|
||||||
|
* @emails oncall+js_foundation
|
||||||
|
*/
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
const meta = require('../meta');
|
||||||
|
|
||||||
|
it('exports the blacklist creator', () => {
|
||||||
|
expect(meta('some formatted code', 'utf8')).toMatchSnapshot();
|
||||||
|
});
|
|
@ -31,7 +31,7 @@ module.exports = function(
|
||||||
const buffer: Buffer = asBuffer(code, encoding);
|
const buffer: Buffer = asBuffer(code, encoding);
|
||||||
const hash = crypto.createHash('sha1');
|
const hash = crypto.createHash('sha1');
|
||||||
hash.update(buffer);
|
hash.update(buffer);
|
||||||
const digest = hash.digest('buffer');
|
const digest = hash.digest();
|
||||||
const signature = Buffer.alloc
|
const signature = Buffer.alloc
|
||||||
? Buffer.alloc(digest.length + 1)
|
? Buffer.alloc(digest.length + 1)
|
||||||
: new Buffer(digest.length + 1);
|
: new Buffer(digest.length + 1);
|
||||||
|
|
Loading…
Reference in New Issue