Endo API documentation
    Preparing search index...

    Variable isWellFormedStringConst

    isWellFormedString: (str: any) => boolean = ...

    Is the argument a well-formed string?

    Unfortunately, the standard built-in String.prototype.isWellFormed does a ToString on its input, causing it to judge non-strings to be well-formed strings if they coerce to a well-formed strings. This recapitulates the mistake in having the global isNaN coerce its inputs, causing it to judge non-string to be NaN if they coerce to NaN.

    This isWellFormedString function only judges well-formed strings to be well-formed strings. For all non-strings it returns false.

    Type declaration

      • (str: any): boolean
      • Parameters

        • str: any

        Returns boolean