No Description

comparer.js 844B

12345678910111213141516171819202122232425262728293031323334
  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. if(!Array.isArray(a) && Array.isArray(b))
  12. return false
  13. return (a.length == b.length) && a.every(function(element, index) {
  14. return element === b[index];
  15. });
  16. },
  17. hasValue : (a, b) => (a !== void 0) && (Array.isArray(a) ? a.length !==0 : true),
  18. isArray : (a, b) => Array.isArray(a),
  19. hasProperties : (a, b) => {
  20. let res = true
  21. for(let i in a) {
  22. let found = false
  23. for(let j in b) {
  24. if(b[j] === i) {
  25. found = true
  26. break;
  27. }
  28. }
  29. res = res && found
  30. }
  31. return res
  32. }
  33. }