Test case details

Preparation Code

<script type="module"> import stringify from 'https://cdn.jsdelivr.net/npm/json-stable-stringify@1.1.1/+esm'; window.stringify = stringify; </script> <script type="module"> import { Md5 } from 'https://cdn.jsdelivr.net/npm/ts-md5@1.3.1/+esm'; window.Md5 = Md5; </script> <script type="module"> import { dequal } from 'https://cdn.jsdelivr.net/npm/dequal@2.0.3/lite/index.mjs'; window.deepEqual = dequal; </script>
const obj1 = Array.from({ length: 100 }).reduce( o => ({ bbbbbbb: '11111111', cccccc: '111111111', aaaaaaa: o }), {} ); const obj2 = Array.from({ length: 100 }).reduce( o => ({ bbbbbbb: '11111111', cccccc: '111111111', aaaaaaa: o }), {} ); function createHash(obj) { function replacer(key, value) { if (value instanceof RegExp) return '__REGEXP ' + value.toString(); else return value; } return Md5.hashStr(stringify(obj, { replacer })); }

Test cases

Test #1

deepEqual(obj1, obj2)

Test #2

createHash(obj1) === createHash(obj2)