Skip to main content
Version: 0.4.2

sanitize_list_index

FunctionPrivateSource

index: int = sanitize_list_index(index: Any)

Try to ensure index to be a int. If failed, raise ValueError.

Arguments

Requires

ArgumentTypeRequired
Description
indexAnyThe value to be sanitized.

Returns

ArgumentType
Description
indexintThe sanitized index.

Examples

Sanitize an index

sanitize_an_index.py
from dash_json_grid.mixins import sanitize_list_index


print(repr(1), repr(sanitize_list_index(1)))
print(repr("10"), repr(sanitize_list_index("10")))