UNPKG

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