From 61cfd79f90f7463ba1f9149d8d988bb081f6a3a1 Mon Sep 17 00:00:00 2001
From: feige <791364011@qq.com>
Date: 星期四, 29 八月 2024 12:30:19 +0800
Subject: [PATCH] Merge branch 'master' of http://47.93.189.255:8099/r/zhangshi_app_web
---
node_modules/object-hash/index.js | 54 +++++++++++++++++++++++++++++++++---------------------
1 files changed, 33 insertions(+), 21 deletions(-)
diff --git a/node_modules/object-hash/index.js b/node_modules/object-hash/index.js
index 0b1b169..657aff2 100644
--- a/node_modules/object-hash/index.js
+++ b/node_modules/object-hash/index.js
@@ -58,22 +58,25 @@
hashes.push('passthrough');
var encodings = ['buffer', 'hex', 'binary', 'base64'];
-function applyDefaults(object, options){
- options = options || {};
- options.algorithm = options.algorithm || 'sha1';
- options.encoding = options.encoding || 'hex';
- options.excludeValues = options.excludeValues ? true : false;
+function applyDefaults(object, sourceOptions){
+ sourceOptions = sourceOptions || {};
+
+ // create a copy rather than mutating
+ var options = {};
+ options.algorithm = sourceOptions.algorithm || 'sha1';
+ options.encoding = sourceOptions.encoding || 'hex';
+ options.excludeValues = sourceOptions.excludeValues ? true : false;
options.algorithm = options.algorithm.toLowerCase();
options.encoding = options.encoding.toLowerCase();
- options.ignoreUnknown = options.ignoreUnknown !== true ? false : true; // default to false
- options.respectType = options.respectType === false ? false : true; // default to true
- options.respectFunctionNames = options.respectFunctionNames === false ? false : true;
- options.respectFunctionProperties = options.respectFunctionProperties === false ? false : true;
- options.unorderedArrays = options.unorderedArrays !== true ? false : true; // default to false
- options.unorderedSets = options.unorderedSets === false ? false : true; // default to false
- options.unorderedObjects = options.unorderedObjects === false ? false : true; // default to true
- options.replacer = options.replacer || undefined;
- options.excludeKeys = options.excludeKeys || undefined;
+ options.ignoreUnknown = sourceOptions.ignoreUnknown !== true ? false : true; // default to false
+ options.respectType = sourceOptions.respectType === false ? false : true; // default to true
+ options.respectFunctionNames = sourceOptions.respectFunctionNames === false ? false : true;
+ options.respectFunctionProperties = sourceOptions.respectFunctionProperties === false ? false : true;
+ options.unorderedArrays = sourceOptions.unorderedArrays !== true ? false : true; // default to false
+ options.unorderedSets = sourceOptions.unorderedSets === false ? false : true; // default to false
+ options.unorderedObjects = sourceOptions.unorderedObjects === false ? false : true; // default to true
+ options.replacer = sourceOptions.replacer || undefined;
+ options.excludeKeys = sourceOptions.excludeKeys || undefined;
if(typeof object === 'undefined') {
throw new Error('Object argument required.');
@@ -126,8 +129,9 @@
var hasher = typeHasher(options, hashingStream);
hasher.dispatch(object);
- if (!hashingStream.update)
- hashingStream.end('')
+ if (!hashingStream.update) {
+ hashingStream.end('');
+ }
if (hashingStream.digest) {
return hashingStream.digest(options.encoding === 'buffer' ? undefined : options.encoding);
@@ -163,11 +167,12 @@
function typeHasher(options, writeTo, context){
context = context || [];
var write = function(str) {
- if (writeTo.update)
+ if (writeTo.update) {
return writeTo.update(str, 'utf8');
- else
+ } else {
return writeTo.write(str, 'utf8');
- }
+ }
+ };
return {
dispatch: function(value){
@@ -209,7 +214,7 @@
return write(object);
}
- if(objType !== 'object' && objType !== 'function') {
+ if(objType !== 'object' && objType !== 'function' && objType !== 'asyncfunction') {
if(this['_' + objType]) {
this['_' + objType](object);
} else if (options.ignoreUnknown) {
@@ -387,6 +392,10 @@
var arr = Array.from(set);
return this._array(arr, options.unorderedSets !== false);
},
+ _file: function(file) {
+ write('file:');
+ return this.dispatch([file.name, file.size, file.type, file.lastModfied]);
+ },
_blob: function() {
if (options.ignoreUnknown) {
return write('[blob]');
@@ -397,6 +406,9 @@
'Use "options.replacer" or "options.ignoreUnknown"\n');
},
_domwindow: function() { return write('domwindow'); },
+ _bigint: function(number){
+ return write('bigint:' + number.toString());
+ },
/* Node.js standard native objects */
_process: function() { return write('process'); },
_timer: function() { return write('timer'); },
@@ -414,7 +426,7 @@
_dataview: function() { return write('dataview'); },
_signal: function() { return write('signal'); },
_fsevent: function() { return write('fsevent'); },
- _tlswrap: function() { return write('tlswrap'); }
+ _tlswrap: function() { return write('tlswrap'); },
};
}
--
Gitblit v1.9.1