equalText.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import { factory } from '../../utils/factory.js';
  2. var name = 'equalText';
  3. var dependencies = ['typed', 'compareText', 'isZero'];
  4. export var createEqualText = /* #__PURE__ */factory(name, dependencies, _ref => {
  5. var {
  6. typed,
  7. compareText,
  8. isZero
  9. } = _ref;
  10. /**
  11. * Check equality of two strings. Comparison is case sensitive.
  12. *
  13. * For matrices, the function is evaluated element wise.
  14. *
  15. * Syntax:
  16. *
  17. * math.equalText(x, y)
  18. *
  19. * Examples:
  20. *
  21. * math.equalText('Hello', 'Hello') // returns true
  22. * math.equalText('a', 'A') // returns false
  23. * math.equal('2e3', '2000') // returns true
  24. * math.equalText('2e3', '2000') // returns false
  25. *
  26. * math.equalText('B', ['A', 'B', 'C']) // returns [false, true, false]
  27. *
  28. * See also:
  29. *
  30. * equal, compareText, compare, compareNatural
  31. *
  32. * @param {string | Array | DenseMatrix} x First string to compare
  33. * @param {string | Array | DenseMatrix} y Second string to compare
  34. * @return {number | Array | DenseMatrix} Returns true if the values are equal, and false if not.
  35. */
  36. return typed(name, {
  37. 'any, any': function anyAny(x, y) {
  38. return isZero(compareText(x, y));
  39. }
  40. });
  41. });