@maphubs/tokml
Advanced tools
Comparing version 0.6.0 to 0.6.1
@@ -0,1 +1,6 @@ | ||
## 0.6.1 | ||
- Fix #4 error with non-string id values | ||
- Upgrade dev dependencies to fix tests and pass code coverage check | ||
## 0.6.0 | ||
@@ -2,0 +7,0 @@ |
@@ -64,3 +64,3 @@ var esc = require('./lib/xml-escape') | ||
var attributes = {} | ||
if (_.id) attributes.id = _.id | ||
if (_.id) attributes.id = _.id.toString(); | ||
return ( | ||
@@ -67,0 +67,0 @@ styleDefinition + |
@@ -0,8 +1,9 @@ | ||
/* istanbul ignore file */ | ||
// strxml from https://github.com/mapbox/strxml | ||
var esc = require("./xml-escape"); | ||
var esc = require('./xml-escape') | ||
module.exports.attr = attr; | ||
module.exports.tagClose = tagClose; | ||
module.exports.tag = tag; | ||
module.exports.attr = attr | ||
module.exports.tagClose = tagClose | ||
module.exports.tag = tag | ||
@@ -14,11 +15,11 @@ /** | ||
function attr(attributes) { | ||
if (!Object.keys(attributes).length) return ""; | ||
if (!Object.keys(attributes).length) return '' | ||
return ( | ||
" " + | ||
' ' + | ||
Object.keys(attributes) | ||
.map(function (key) { | ||
return key + '="' + esc(attributes[key]) + '"'; | ||
return key + '="' + esc(attributes[key]) + '"' | ||
}) | ||
.join(" ") | ||
); | ||
.join(' ') | ||
) | ||
} | ||
@@ -32,3 +33,3 @@ | ||
function tagClose(el, attributes) { | ||
return "<" + el + attr(attributes) + "/>"; | ||
return '<' + el + attr(attributes) + '/>' | ||
} | ||
@@ -43,16 +44,16 @@ | ||
function tag(el, attributes, contents) { | ||
if (Array.isArray(attributes) || typeof attributes === "string") { | ||
contents = attributes; | ||
attributes = {}; | ||
if (Array.isArray(attributes) || typeof attributes === 'string') { | ||
contents = attributes | ||
attributes = {} | ||
} | ||
if (Array.isArray(contents)) | ||
contents = | ||
"\n" + | ||
'\n' + | ||
contents | ||
.map(function (content) { | ||
return " " + content; | ||
return ' ' + content | ||
}) | ||
.join("\n") + | ||
"\n"; | ||
return "<" + el + attr(attributes) + ">" + contents + "</" + el + ">"; | ||
.join('\n') + | ||
'\n' | ||
return '<' + el + attr(attributes) + '>' + contents + '</' + el + '>' | ||
} |
@@ -0,22 +1,23 @@ | ||
/* istanbul ignore file */ | ||
// originally from https://github.com/miketheprogrammer/xml-escape | ||
var escape = (module.exports = function escape(string, ignore) { | ||
var pattern; | ||
var pattern | ||
if (string === null || string === undefined) return; | ||
if (string === null || string === undefined) return | ||
ignore = (ignore || "").replace(/[^&"<>\']/g, ""); | ||
pattern = "([&\"<>'])".replace(new RegExp("[" + ignore + "]", "g"), ""); | ||
ignore = (ignore || '').replace(/[^&"<>\']/g, '') | ||
pattern = '([&"<>\'])'.replace(new RegExp('[' + ignore + ']', 'g'), '') | ||
return string.replace(new RegExp(pattern, "g"), function (str, item) { | ||
return escape.map[item]; | ||
}); | ||
}); | ||
return string.replace(new RegExp(pattern, 'g'), function (str, item) { | ||
return escape.map[item] | ||
}) | ||
}) | ||
var map = (escape.map = { | ||
">": ">", | ||
"<": "<", | ||
"'": "'", | ||
'"': """, | ||
"&": "&", | ||
}); | ||
'>': '>', | ||
'<': '<', | ||
"'": ''', | ||
'"': '"', | ||
'&': '&' | ||
}) |
{ | ||
"name": "@maphubs/tokml", | ||
"version": "0.6.0", | ||
"version": "0.6.1", | ||
"description": "convert geojson to kml", | ||
@@ -28,7 +28,7 @@ "main": "index.js", | ||
"browserify": "^16.5.2", | ||
"coveralls": "^3.1.0", | ||
"coveralls": "^3.1.1", | ||
"fuzzer": "^0.2.1", | ||
"glob": "^7.1.3", | ||
"glob": "^7.2.0", | ||
"nyc": "^15.1.0", | ||
"tap": "^14.10.8" | ||
"tap": "^15.1.6" | ||
}, | ||
@@ -35,0 +35,0 @@ "dependencies": { |
68
tokml.js
@@ -65,3 +65,3 @@ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.tokml = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){ | ||
var attributes = {} | ||
if (_.id) attributes.id = _.id | ||
if (_.id) attributes.id = _.id.toString(); | ||
return ( | ||
@@ -407,9 +407,10 @@ styleDefinition + | ||
},{"./lib/strxml":2,"./lib/xml-escape":3}],2:[function(require,module,exports){ | ||
/* istanbul ignore file */ | ||
// strxml from https://github.com/mapbox/strxml | ||
var esc = require("./xml-escape"); | ||
var esc = require('./xml-escape') | ||
module.exports.attr = attr; | ||
module.exports.tagClose = tagClose; | ||
module.exports.tag = tag; | ||
module.exports.attr = attr | ||
module.exports.tagClose = tagClose | ||
module.exports.tag = tag | ||
@@ -421,11 +422,11 @@ /** | ||
function attr(attributes) { | ||
if (!Object.keys(attributes).length) return ""; | ||
if (!Object.keys(attributes).length) return '' | ||
return ( | ||
" " + | ||
' ' + | ||
Object.keys(attributes) | ||
.map(function (key) { | ||
return key + '="' + esc(attributes[key]) + '"'; | ||
return key + '="' + esc(attributes[key]) + '"' | ||
}) | ||
.join(" ") | ||
); | ||
.join(' ') | ||
) | ||
} | ||
@@ -439,3 +440,3 @@ | ||
function tagClose(el, attributes) { | ||
return "<" + el + attr(attributes) + "/>"; | ||
return '<' + el + attr(attributes) + '/>' | ||
} | ||
@@ -450,43 +451,44 @@ | ||
function tag(el, attributes, contents) { | ||
if (Array.isArray(attributes) || typeof attributes === "string") { | ||
contents = attributes; | ||
attributes = {}; | ||
if (Array.isArray(attributes) || typeof attributes === 'string') { | ||
contents = attributes | ||
attributes = {} | ||
} | ||
if (Array.isArray(contents)) | ||
contents = | ||
"\n" + | ||
'\n' + | ||
contents | ||
.map(function (content) { | ||
return " " + content; | ||
return ' ' + content | ||
}) | ||
.join("\n") + | ||
"\n"; | ||
return "<" + el + attr(attributes) + ">" + contents + "</" + el + ">"; | ||
.join('\n') + | ||
'\n' | ||
return '<' + el + attr(attributes) + '>' + contents + '</' + el + '>' | ||
} | ||
},{"./xml-escape":3}],3:[function(require,module,exports){ | ||
/* istanbul ignore file */ | ||
// originally from https://github.com/miketheprogrammer/xml-escape | ||
var escape = (module.exports = function escape(string, ignore) { | ||
var pattern; | ||
var pattern | ||
if (string === null || string === undefined) return; | ||
if (string === null || string === undefined) return | ||
ignore = (ignore || "").replace(/[^&"<>\']/g, ""); | ||
pattern = "([&\"<>'])".replace(new RegExp("[" + ignore + "]", "g"), ""); | ||
ignore = (ignore || '').replace(/[^&"<>\']/g, '') | ||
pattern = '([&"<>\'])'.replace(new RegExp('[' + ignore + ']', 'g'), '') | ||
return string.replace(new RegExp(pattern, "g"), function (str, item) { | ||
return escape.map[item]; | ||
}); | ||
}); | ||
return string.replace(new RegExp(pattern, 'g'), function (str, item) { | ||
return escape.map[item] | ||
}) | ||
}) | ||
var map = (escape.map = { | ||
">": ">", | ||
"<": "<", | ||
"'": "'", | ||
'"': """, | ||
"&": "&", | ||
}); | ||
'>': '>', | ||
'<': '<', | ||
"'": ''', | ||
'"': '"', | ||
'&': '&' | ||
}) | ||
},{}]},{},[1])(1) | ||
}); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
67071
1026
0