export function getStringFromAttribute(name, value) {
    if (typeof value === 'boolean') {
        if (value) {
            return name;
        }
    }
    else if (typeof value === 'number') {
        return `${name}=${value.toString()}`;
    }
    else if (typeof value === 'string') {
        const escapedValue = value.toString()
            .replace(/&/g, '&amp;')
            .replace(/'/g, '&apos;')
            .replace(/"/g, '&quot;')
            .replace(/</g, '&lt;')
            .replace(/>/g, '&gt;');
        return `${name}="${escapedValue}"`;
    }
    return '';
}
export function getStringsFromAttributes(attributes) {
    const result = [];
    Object.entries(attributes).forEach(([name, value]) => {
        const str = getStringFromAttribute(name, value);
        if (str) {
            result.push(str);
        }
    });
    return result;
}
//# sourceMappingURL=attr.js.map