不要怂,就是干,撸起袖子干!

Commit 11b8b58b by tomchentw

fix(hstore): check string before parsing

1 parent 37a8ddbb
Showing with 7 additions and 2 deletions
...@@ -34,9 +34,14 @@ module.exports = { ...@@ -34,9 +34,14 @@ module.exports = {
} }
}, },
parse: function(string) { parse: function(string) {
var self = this var self = this,
object = { }
if (('string' !== typeof string) || (0 === string.length)) {
return object;
}
const rx = /\"((?:\\\"|[^"])*)\"\s*\=\>\s*((?:true|false|NULL|\d+|\d+\.\d+|\"((?:\\\"|[^"])*)\"))/g const rx = /\"((?:\\\"|[^"])*)\"\s*\=\>\s*((?:true|false|NULL|\d+|\d+\.\d+|\"((?:\\\"|[^"])*)\"))/g
var object = { }
string.replace(rx, function(match, key, value, innerValue) { string.replace(rx, function(match, key, value, innerValue) {
switch(value) { switch(value) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!