Lewati ke konten utama
Versi: v2

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)