@@ -23537,22 +23537,25 @@ var hashes = crypto.getHashes ? crypto.getHashes().slice() : ['sha1', 'md5'];
23537
23537
hashes.push('passthrough');
23538
23538
var encodings = ['buffer', 'hex', 'binary', 'base64'];
23539
23539
23540
- function applyDefaults(object, options){
23541
- options = options || {};
23542
- options.algorithm = options.algorithm || 'sha1';
23543
- options.encoding = options.encoding || 'hex';
23544
- options.excludeValues = options.excludeValues ? true : false;
23540
+ function applyDefaults(object, sourceOptions){
23541
+ sourceOptions = sourceOptions || {};
23542
+
23543
+ // create a copy rather than mutating
23544
+ var options = {};
23545
+ options.algorithm = sourceOptions.algorithm || 'sha1';
23546
+ options.encoding = sourceOptions.encoding || 'hex';
23547
+ options.excludeValues = sourceOptions.excludeValues ? true : false;
23545
23548
options.algorithm = options.algorithm.toLowerCase();
23546
23549
options.encoding = options.encoding.toLowerCase();
23547
- options.ignoreUnknown = options .ignoreUnknown !== true ? false : true; // default to false
23548
- options.respectType = options .respectType === false ? false : true; // default to true
23549
- options.respectFunctionNames = options .respectFunctionNames === false ? false : true;
23550
- options.respectFunctionProperties = options .respectFunctionProperties === false ? false : true;
23551
- options.unorderedArrays = options .unorderedArrays !== true ? false : true; // default to false
23552
- options.unorderedSets = options .unorderedSets === false ? false : true; // default to false
23553
- options.unorderedObjects = options .unorderedObjects === false ? false : true; // default to true
23554
- options.replacer = options .replacer || undefined;
23555
- options.excludeKeys = options .excludeKeys || undefined;
23550
+ options.ignoreUnknown = sourceOptions .ignoreUnknown !== true ? false : true; // default to false
23551
+ options.respectType = sourceOptions .respectType === false ? false : true; // default to true
23552
+ options.respectFunctionNames = sourceOptions .respectFunctionNames === false ? false : true;
23553
+ options.respectFunctionProperties = sourceOptions .respectFunctionProperties === false ? false : true;
23554
+ options.unorderedArrays = sourceOptions .unorderedArrays !== true ? false : true; // default to false
23555
+ options.unorderedSets = sourceOptions .unorderedSets === false ? false : true; // default to false
23556
+ options.unorderedObjects = sourceOptions .unorderedObjects === false ? false : true; // default to true
23557
+ options.replacer = sourceOptions .replacer || undefined;
23558
+ options.excludeKeys = sourceOptions .excludeKeys || undefined;
23556
23559
23557
23560
if(typeof object === 'undefined') {
23558
23561
throw new Error('Object argument required.');
@@ -23605,8 +23608,9 @@ function hash(object, options) {
23605
23608
23606
23609
var hasher = typeHasher(options, hashingStream);
23607
23610
hasher.dispatch(object);
23608
- if (!hashingStream.update)
23611
+ if (!hashingStream.update) {
23609
23612
hashingStream.end('');
23613
+ }
23610
23614
23611
23615
if (hashingStream.digest) {
23612
23616
return hashingStream.digest(options.encoding === 'buffer' ? undefined : options.encoding);
@@ -23642,10 +23646,11 @@ exports.writeToStream = function(object, options, stream) {
23642
23646
function typeHasher(options, writeTo, context){
23643
23647
context = context || [];
23644
23648
var write = function(str) {
23645
- if (writeTo.update)
23649
+ if (writeTo.update) {
23646
23650
return writeTo.update(str, 'utf8');
23647
- else
23651
+ } else {
23648
23652
return writeTo.write(str, 'utf8');
23653
+ }
23649
23654
};
23650
23655
23651
23656
return {
@@ -23688,7 +23693,7 @@ function typeHasher(options, writeTo, context){
23688
23693
return write(object);
23689
23694
}
23690
23695
23691
- if(objType !== 'object' && objType !== 'function') {
23696
+ if(objType !== 'object' && objType !== 'function' && objType !== 'asyncfunction' ) {
23692
23697
if(this['_' + objType]) {
23693
23698
this['_' + objType](object);
23694
23699
} else if (options.ignoreUnknown) {
0 commit comments