Skip to content

Commit 6c4e53e

Browse files
committed
Merge branch 'agilgur5-object-hash-update'
2 parents 947da25 + 3d3e4eb commit 6c4e53e

6 files changed

+53
-43
lines changed

dist/rollup-plugin-typescript2.cjs.js

+23-18
Original file line numberDiff line numberDiff line change
@@ -23537,22 +23537,25 @@ var hashes = crypto.getHashes ? crypto.getHashes().slice() : ['sha1', 'md5'];
2353723537
hashes.push('passthrough');
2353823538
var encodings = ['buffer', 'hex', 'binary', 'base64'];
2353923539

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;
2354523548
options.algorithm = options.algorithm.toLowerCase();
2354623549
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;
2355623559

2355723560
if(typeof object === 'undefined') {
2355823561
throw new Error('Object argument required.');
@@ -23605,8 +23608,9 @@ function hash(object, options) {
2360523608

2360623609
var hasher = typeHasher(options, hashingStream);
2360723610
hasher.dispatch(object);
23608-
if (!hashingStream.update)
23611+
if (!hashingStream.update) {
2360923612
hashingStream.end('');
23613+
}
2361023614

2361123615
if (hashingStream.digest) {
2361223616
return hashingStream.digest(options.encoding === 'buffer' ? undefined : options.encoding);
@@ -23642,10 +23646,11 @@ exports.writeToStream = function(object, options, stream) {
2364223646
function typeHasher(options, writeTo, context){
2364323647
context = context || [];
2364423648
var write = function(str) {
23645-
if (writeTo.update)
23649+
if (writeTo.update) {
2364623650
return writeTo.update(str, 'utf8');
23647-
else
23651+
} else {
2364823652
return writeTo.write(str, 'utf8');
23653+
}
2364923654
};
2365023655

2365123656
return {
@@ -23688,7 +23693,7 @@ function typeHasher(options, writeTo, context){
2368823693
return write(object);
2368923694
}
2369023695

23691-
if(objType !== 'object' && objType !== 'function') {
23696+
if(objType !== 'object' && objType !== 'function' && objType !== 'asyncfunction') {
2369223697
if(this['_' + objType]) {
2369323698
this['_' + objType](object);
2369423699
} else if (options.ignoreUnknown) {

dist/rollup-plugin-typescript2.cjs.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/rollup-plugin-typescript2.es.js

+23-18
Original file line numberDiff line numberDiff line change
@@ -23531,22 +23531,25 @@ var hashes = crypto.getHashes ? crypto.getHashes().slice() : ['sha1', 'md5'];
2353123531
hashes.push('passthrough');
2353223532
var encodings = ['buffer', 'hex', 'binary', 'base64'];
2353323533

23534-
function applyDefaults(object, options){
23535-
options = options || {};
23536-
options.algorithm = options.algorithm || 'sha1';
23537-
options.encoding = options.encoding || 'hex';
23538-
options.excludeValues = options.excludeValues ? true : false;
23534+
function applyDefaults(object, sourceOptions){
23535+
sourceOptions = sourceOptions || {};
23536+
23537+
// create a copy rather than mutating
23538+
var options = {};
23539+
options.algorithm = sourceOptions.algorithm || 'sha1';
23540+
options.encoding = sourceOptions.encoding || 'hex';
23541+
options.excludeValues = sourceOptions.excludeValues ? true : false;
2353923542
options.algorithm = options.algorithm.toLowerCase();
2354023543
options.encoding = options.encoding.toLowerCase();
23541-
options.ignoreUnknown = options.ignoreUnknown !== true ? false : true; // default to false
23542-
options.respectType = options.respectType === false ? false : true; // default to true
23543-
options.respectFunctionNames = options.respectFunctionNames === false ? false : true;
23544-
options.respectFunctionProperties = options.respectFunctionProperties === false ? false : true;
23545-
options.unorderedArrays = options.unorderedArrays !== true ? false : true; // default to false
23546-
options.unorderedSets = options.unorderedSets === false ? false : true; // default to false
23547-
options.unorderedObjects = options.unorderedObjects === false ? false : true; // default to true
23548-
options.replacer = options.replacer || undefined;
23549-
options.excludeKeys = options.excludeKeys || undefined;
23544+
options.ignoreUnknown = sourceOptions.ignoreUnknown !== true ? false : true; // default to false
23545+
options.respectType = sourceOptions.respectType === false ? false : true; // default to true
23546+
options.respectFunctionNames = sourceOptions.respectFunctionNames === false ? false : true;
23547+
options.respectFunctionProperties = sourceOptions.respectFunctionProperties === false ? false : true;
23548+
options.unorderedArrays = sourceOptions.unorderedArrays !== true ? false : true; // default to false
23549+
options.unorderedSets = sourceOptions.unorderedSets === false ? false : true; // default to false
23550+
options.unorderedObjects = sourceOptions.unorderedObjects === false ? false : true; // default to true
23551+
options.replacer = sourceOptions.replacer || undefined;
23552+
options.excludeKeys = sourceOptions.excludeKeys || undefined;
2355023553

2355123554
if(typeof object === 'undefined') {
2355223555
throw new Error('Object argument required.');
@@ -23599,8 +23602,9 @@ function hash(object, options) {
2359923602

2360023603
var hasher = typeHasher(options, hashingStream);
2360123604
hasher.dispatch(object);
23602-
if (!hashingStream.update)
23605+
if (!hashingStream.update) {
2360323606
hashingStream.end('');
23607+
}
2360423608

2360523609
if (hashingStream.digest) {
2360623610
return hashingStream.digest(options.encoding === 'buffer' ? undefined : options.encoding);
@@ -23636,10 +23640,11 @@ exports.writeToStream = function(object, options, stream) {
2363623640
function typeHasher(options, writeTo, context){
2363723641
context = context || [];
2363823642
var write = function(str) {
23639-
if (writeTo.update)
23643+
if (writeTo.update) {
2364023644
return writeTo.update(str, 'utf8');
23641-
else
23645+
} else {
2364223646
return writeTo.write(str, 'utf8');
23647+
}
2364323648
};
2364423649

2364523650
return {
@@ -23682,7 +23687,7 @@ function typeHasher(options, writeTo, context){
2368223687
return write(object);
2368323688
}
2368423689

23685-
if(objType !== 'object' && objType !== 'function') {
23690+
if(objType !== 'object' && objType !== 'function' && objType !== 'asyncfunction') {
2368623691
if(this['_' + objType]) {
2368723692
this['_' + objType](object);
2368823693
} else if (options.ignoreUnknown) {

dist/rollup-plugin-typescript2.es.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
"colors": "1.3.3",
5353
"graphlib": "2.1.7",
5454
"lodash": "4.17.15",
55-
"object-hash": "1.3.1",
55+
"object-hash": "2.0.2",
5656
"rimraf": "3.0.0",
5757
"rollup": "^1.26.3 ",
5858
"rollup-plugin-commonjs": "10.1.0",

0 commit comments

Comments
 (0)