Repositorio del curso CCOM4030 el semestre B91 del proyecto Artesanías con el Instituto de Cultura

isMatch.js 409B

12345678910111213
  1. import keys from './keys.js';
  2. // Returns whether an object has a given set of `key:value` pairs.
  3. export default function isMatch(object, attrs) {
  4. var _keys = keys(attrs), length = _keys.length;
  5. if (object == null) return !length;
  6. var obj = Object(object);
  7. for (var i = 0; i < length; i++) {
  8. var key = _keys[i];
  9. if (attrs[key] !== obj[key] || !(key in obj)) return false;
  10. }
  11. return true;
  12. }