Update checked-in dependencies
This commit is contained in:
parent
6b0d45a5c6
commit
cc1adb825a
4247 changed files with 144820 additions and 149530 deletions
60
node_modules/eslint-module-utils/hash.js
generated
vendored
60
node_modules/eslint-module-utils/hash.js
generated
vendored
|
|
@ -2,58 +2,58 @@
|
|||
* utilities for hashing config objects.
|
||||
* basically iteratively updates hash with a JSON-like format
|
||||
*/
|
||||
'use strict'
|
||||
exports.__esModule = true
|
||||
'use strict';
|
||||
exports.__esModule = true;
|
||||
|
||||
const createHash = require('crypto').createHash
|
||||
const createHash = require('crypto').createHash;
|
||||
|
||||
const stringify = JSON.stringify
|
||||
const stringify = JSON.stringify;
|
||||
|
||||
function hashify(value, hash) {
|
||||
if (!hash) hash = createHash('sha256')
|
||||
if (!hash) hash = createHash('sha256');
|
||||
|
||||
if (value instanceof Array) {
|
||||
hashArray(value, hash)
|
||||
if (Array.isArray(value)) {
|
||||
hashArray(value, hash);
|
||||
} else if (value instanceof Object) {
|
||||
hashObject(value, hash)
|
||||
hashObject(value, hash);
|
||||
} else {
|
||||
hash.update(stringify(value) || 'undefined')
|
||||
hash.update(stringify(value) || 'undefined');
|
||||
}
|
||||
|
||||
return hash
|
||||
return hash;
|
||||
}
|
||||
exports.default = hashify
|
||||
exports.default = hashify;
|
||||
|
||||
function hashArray(array, hash) {
|
||||
if (!hash) hash = createHash('sha256')
|
||||
if (!hash) hash = createHash('sha256');
|
||||
|
||||
hash.update('[')
|
||||
hash.update('[');
|
||||
for (let i = 0; i < array.length; i++) {
|
||||
hashify(array[i], hash)
|
||||
hash.update(',')
|
||||
hashify(array[i], hash);
|
||||
hash.update(',');
|
||||
}
|
||||
hash.update(']')
|
||||
hash.update(']');
|
||||
|
||||
return hash
|
||||
return hash;
|
||||
}
|
||||
hashify.array = hashArray
|
||||
exports.hashArray = hashArray
|
||||
hashify.array = hashArray;
|
||||
exports.hashArray = hashArray;
|
||||
|
||||
function hashObject(object, hash) {
|
||||
if (!hash) hash = createHash('sha256')
|
||||
if (!hash) hash = createHash('sha256');
|
||||
|
||||
hash.update('{')
|
||||
hash.update('{');
|
||||
Object.keys(object).sort().forEach(key => {
|
||||
hash.update(stringify(key))
|
||||
hash.update(':')
|
||||
hashify(object[key], hash)
|
||||
hash.update(',')
|
||||
})
|
||||
hash.update('}')
|
||||
hash.update(stringify(key));
|
||||
hash.update(':');
|
||||
hashify(object[key], hash);
|
||||
hash.update(',');
|
||||
});
|
||||
hash.update('}');
|
||||
|
||||
return hash
|
||||
return hash;
|
||||
}
|
||||
hashify.object = hashObject
|
||||
exports.hashObject = hashObject
|
||||
hashify.object = hashObject;
|
||||
exports.hashObject = hashObject;
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue