1 | import { factory } from '../../utils/factory'
|
2 |
|
3 | const name = 'equalText'
|
4 | const dependencies = [
|
5 | 'typed',
|
6 | 'compareText',
|
7 | 'isZero'
|
8 | ]
|
9 |
|
10 | export const createEqualText = /* #__PURE__ */ factory(name, dependencies, ({ typed, compareText, isZero }) => {
|
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 (x, y) {
|
39 | return isZero(compareText(x, y))
|
40 | }
|
41 | })
|
42 | })
|