Fix flow error when calling hash.digest()

Reviewed By: cpojer

Differential Revision: D6598742

fbshipit-source-id: 47bd6f0ee0d54c61c2ff9b201005e7366d9df76d
This commit is contained in:
Rafael Oleza 2017-12-19 03:35:39 -08:00 committed by Facebook Github Bot
parent 3b497585f1
commit dfb5d95a0d
3 changed files with 49 additions and 1 deletions

View File

@ -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",
}
`;

View File

@ -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();
});

View File

@ -31,7 +31,7 @@ module.exports = function(
const buffer: Buffer = asBuffer(code, encoding);
const hash = crypto.createHash('sha1');
hash.update(buffer);
const digest = hash.digest('buffer');
const digest = hash.digest();
const signature = Buffer.alloc
? Buffer.alloc(digest.length + 1)
: new Buffer(digest.length + 1);