function encode(data, level) {
    return (!level || level <= 0 ? encode_1.encodeXML : encode_1.encodeHTML)(data);
}
Encodes a string with entities.

@param data String to encode.
@param level Optional level to encode at. 0 = XML, 1 = HTML. Default is 0.
@deprecated Use `encodeHTML`, `encodeXML` or `encodeNonAsciiHTML` directly.