function _updateHashWithValue()

in packages/aws-rfdk/lib/lambdas/nodejs/lib/custom-resource/hash.ts [10:27]


  function _updateHashWithValue(hash: Hash, val: any) {
    if (Array.isArray(val)) {
      for (const item of val) {
        _updateHashWithValue(hash, item);
      }
    } else if (typeof val === 'object') {
      for (const [key, item] of Object.entries(val).sort()) {
        hash.update(key);
        _updateHashWithValue(hash, item);
      }
    } else if (typeof val === 'number') {
      hash.update(val.toString());
    } else if (typeof val === 'string') {
      hash.update(val);
    } else {
      throw new Error(`Unexpected value type: ${typeof(val)}`);
    }
  }