• function

Returns a string with {param} replaced values from data.

can.sub(str, data, remove, s)


  1. str {String}

    The string to make substitutes on

  2. data {Object}

    The data to be used to look for properties. If it's an array, multiple objects can be used.

  3. remove {Boolean}Optional

    if a match is found, remove the property from the object

  4. s {String}

    The string to replace



The converted string or null if any data to render are undefined or null

can.sub returns a string with {param} replaced values from data, where param is the name of an object property.

can.sub("foo {bar}", {bar: "far"}) //-> "foo far"