Skip to main content
Version: 2.10.2 (terbaru)

XSS Protection

FoalTS provides some utils to protect you against XSS attacks.

escape(str: string): string

Escapes HTML and returns a new string.

escapeProp(object: object, propName: string): void

Escapes HTML in the given property.

escapeProp(myObject, 'foobar')

is equivalent to

myObject.foobar = escape(myObject.foobar)