simple-squiggle

A restricted subset of Squiggle
Log | Files | Refs | README

equalText.js (1259B)


      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   /**
     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 });