Nenhuma descrição

comparer.js 831B

12345678910111213141516171819202122232425262728293031323334353637
  1. export default {
  2. greater : (a, b) => a > b,
  3. smaller : (a, b) => a < b,
  4. instanceOf : (a, b) => a instanceof b,
  5. typeof : (a, b) => typeof a === b,
  6. IsNull : (a, b) => a === null,
  7. exists : (a, b) => {
  8. return a !== null && a !== void 0
  9. },
  10. equalToArray : (a, b) => {
  11. var i = a.length;
  12. if (i != b.length) return false;
  13. while (i--) {
  14. if (a[i] !== b[i]) return false;
  15. }
  16. return true;
  17. },
  18. hasValue : (a, b) => (a !== void 0) && (Array.isArray(a) ? a.length !==0 : true),
  19. isArray : (a, b) => Array.isArray(a),
  20. hasProperties : (a, b) => {
  21. let res = true
  22. let c = 0
  23. for(let i in a) {
  24. let found = false
  25. for(let j in b) {
  26. c++
  27. if(j === a[i]) {
  28. found = true
  29. break;
  30. }
  31. }
  32. res = res && found
  33. }
  34. return res
  35. }
  36. }