No Description

comparer.js 802B

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