@maphubs/tokml
Version:
convert geojson to kml
24 lines (18 loc) • 575 B
JavaScript
/* istanbul ignore file */
// originally from https://github.com/miketheprogrammer/xml-escape
var escape = (module.exports = function escape(string, ignore) {
var pattern
if (string === null || string === undefined) return
ignore = (ignore || '').replace(/[^&"<>\']/g, '')
pattern = '([&"<>\'])'.replace(new RegExp('[' + ignore + ']', 'g'), '')
return string.replace(new RegExp(pattern, 'g'), function (str, item) {
return escape.map[item]
})
})
var map = (escape.map = {
'>': '>',
'<': '<',
"'": ''',
'"': '"',
'&': '&'
})