Function escObject

  • Returns an object which escapes properties sourced from it. Escaping markup is a key component of template rendering, so this is an important function to have here.

    NB: there are no tests yet. Please report any bugs.

    Parameters

    • rawObject: any

    Returns any

    Example

    import { esc } from 'deleight/apriori'
    const obj = { a: 1, b: 'no special chars', c: '<p>But I am a paragraph</p>', d: { e: '<p>"esc" will still work here</p>' } }
    const escObj = esc(obj);
    console.log(escObj.c); // &lt;p&gt;But I am a paragraph&lt;/p&gt;
    console.log(escObj.d.e); // &lt;p&gt;&quot;esc&quot; will still work here&lt;/p&gt;