Skip to main content
The filter data utilities provide functions to search, filter, and process camera collections based on various criteria.

filterDataUnique

Filter out cameras with a specific design value from a dictionary of camera arrays.
filterDataUnique(obj, value)
obj
object
required
Dictionary containing arrays of camera objects
value
string
required
Design value to exclude from results (case-insensitive)
return
object
Filtered dictionary with cameras that don’t match the specified design value

Usage

const filtered = filterDataUnique(camerasDict, 'bullet');
// Excludes all cameras with diseño: 'bullet'

findCamara

Find a specific camera by its model identifier.
findCamara(camara, params)
camara
array
required
Array of camera objects to search
params
string
required
Model identifier to match
return
array
Array of cameras matching the specified model

Usage

const cameras = findCamara(allCameras, 'DS-2CD2043G2-I');
// Returns all cameras with modelo: 'DS-2CD2043G2-I'

filterCamaras

Filter cameras by a specific key-value pair across all camera properties.
filterCamaras(listCams, key, value)
listCams
object
required
Dictionary or object containing camera data
key
string
required
Property name to filter by (automatically normalized and lowercased)
value
any
required
Value to match for the specified key
return
array
Array of camera objects matching the key-value criteria

Usage

const hdCameras = filterCamaras(cameras, 'resolución', '1080p');
// Returns cameras with resolucion: '1080p'

const hikvisionCams = filterCamaras(cameras, 'marca', 'Hikvision');
// Returns all Hikvision brand cameras
The key parameter is normalized using normalizeString() to remove accents and converted to lowercase for matching.

makeTextFile

Generate a downloadable text file from data, typically used for exporting camera information.
makeTextFile(text)
text
string
required
Content to include in the text file
return
string
Object URL that can be used as a download link href

Usage

const downloadUrl = makeTextFile(JSON.stringify(cameraData));
link.href = downloadUrl;
// Creates a downloadable text file with camera data
The function automatically revokes previously generated URLs to prevent memory leaks. Store the returned URL immediately in your download link.

Build docs developers (and LLMs) love