Announcement

Collapse
No announcement yet.

Javascript extensions -

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Javascript extensions -

    I am wanting to extend certain datatypes in while using Javascript in Mirth.

    Consider this function to call on a string datatype to check whether the variable's value ends with a given argument:

    Code:
    String.prototype.endsWith = function(str)
    {return (this.match(str+"$")==str)}
    Usage:

    Code:
    var myString = "Hello world.";
    
    var hasPeriodAtEnd = myString.endsWith('.'); //returns true.
    var hasXYZAtEnd = myString.endsWith('XYZ'); //returns false.
    How would I implement this type of extension, if possible, in Mirth?

  • #2
    You can define general templates in Mirth. Using this aproach you can't extend the string prototype, but you can instead define a function to get the same result

    Comment

    Working...
    X