const camaro = require('bindings')('camaro.node')

function isNonEmptyString(str) {
    return typeof str === 'string' && str.length > 0
}

function transform(xml, template) {
    if (!isNonEmptyString(xml)) {
        throw new TypeEror('1st argument must be a non-empty string')
    }

    if (typeof template !== 'object') {
        throw new TypeEror('2nd argument must be a template object')
    }

    const template_string = JSON.stringify(template)
    let result = camaro.transform(xml, template_string)
    
    if (result) {
        try {
            result = JSON.parse(result)
        } catch (err) {
            throw new TypeError('Invalid input: Malformed xml')
        }
    } else {
        throw new TypeError('Invalid input: Malformed xml')
    }

    return result
}

module.exports = transform

@@ -223,24 +223,25 @@
 w new TypeEr
+r
 or('1st argu
@@ -345,16 +345,17 @@
 w TypeEr
+r
 or('2nd 

Fix typo TypeError