ascent.encode

Encoding methods for data in Ascent

ascent.encode.base64()

Encodes a string in base64 format.

ascent.encode.b64(input:string) : string;
Parameter
Type
Description

string

string

Value to encode

Examples

To base64-encode the username

let encoded = ascent.encode.b64("Username");

console.log(encoded) // VXNlcm5hbWU=

ascent.encode.gzip()

Compress a string using Gzip. Output a base64 encoded string

ascent.encode.gzip(input: string): string;
Parameter
Type
Description

string

string

Value to encode

Examples

To encode the username

ascent.encode.uri()

Encodes a string using URI encoding

Parameter
Type
Description

string

string

Value to encode

Examples

To encode the username

ascent.encode.hex

Encodes a string in Hexadecimal format.

Parameter
Type
Description

string

string

Value to encode

Examples

To encode the username

ascent.encode.flatten()

Flattens a nested object into a single-level key-value mapping using dot . and bracket [] notation.

Function
Description

ascent.encode.flatten()

Takes a nested JSON object and flattens it into a flat key-value map.

Examples

To flatten a nested resource object:

Last updated

Was this helpful?