iemjs
v0.0.7
Published
Iowa Environmental Mesonet JavaScript utilities for weather data applications
Maintainers
Readme
IEM JavaScript Utilities
A collection of JavaScript utilities for weather data applications from the Iowa Environmental Mesonet.
Installation
npm install iemjsUsage
ES Modules (Node.js/bundlers)
// Import specific utilities
import { escapeHTML, requireSelectElement } from 'iemjs/domUtils';
// Or import everything
import * as IEM from 'iemjs';Browser ES Modules (direct import from this repo)
// Import from web-accessible location
import { escapeHTML, requireSelectElement } from '/js/iemjs/domUtils.js';Modules
domUtils
Utilities for safe DOM manipulation:
escapeHTML(text)- Escape HTML to prevent XSSgetElementById(id, ElementType)- Safe element retrieval with type checkingrequireSelectElement(id)- Get select element or throw errorrequireInputElement(id)- Get input element or throw errorsetSelectValue(selectElement, value)- Set select value with validationclearSelect(selectElement, placeholder)- Clear and reset select optionsaddSelectOption(selectElement, value, text, selected)- Add option to selectcreateElementWithText(tag, text, className)- Create element with text contentshowElement(element)/hideElement(element)- Show/hide elementsremoveAllChildren(element)- Remove all child nodes
iemdata
Weather and climate data constants:
iemdata.states- US states listiemdata.vtec_phenomena- Weather event phenomenaiemdata.vtec_significance- Weather event significance levels
License
MIT
