Comparing version 21.1.1 to 21.1.2
38
json.js
@@ -12,3 +12,3 @@ | ||
, escRe = /['\n\r\u2028\u2029]|\\(?!x2e)/g | ||
, pathRe = /(^$|.+?)(?:\[([^\]]*)\]|\{([^}]*)})?(\.(?=[^.])|$)/g | ||
, pathRe = /(^$|.+?)(?:\[([^\]]*)\](\*.*)?|\{([^}]*)})?(\.(?=[^.])|$)/g | ||
, reEscRe = /[.+^=:${}()|\/\\]/g | ||
@@ -124,3 +124,3 @@ , keyRe = /\[(.*?)\]/g | ||
function pathGet(str, path, arr, obj, dot) { | ||
function pathGet(str, path, arr, arrExt, obj, dot) { | ||
var v = dot ? "(o=" : "(c=" | ||
@@ -131,11 +131,13 @@ , sub = arr || obj | ||
sub ? | ||
pathGet(0, path, 0, 0, 1) + (arr ? "i" : "j") + "(o)&&" + v + ( | ||
pathGet(0, path, 0, 0, 0, 1) + (arr ? "i" : "j") + "(o)&&" + v + ( | ||
// TODO:2021-01-22:lauri:Filter with single loop | ||
arrExt ? "o.filter(m('" + sub[0] + "'))" + (arrExt === "*" ? "" : ".map(p('" + arrExt.slice(1) + "'))") : | ||
sub[1] ? (arr ? "o" : "K(o)") + (sub[0] === "*" ? "" : ".length") : | ||
+arr == arr ? "o[" + (arr < 0 ? "o.length" + arr : arr) + "]" : | ||
(arr ? "I" : "J") + "(o,f('" + sub[0] + "'))" | ||
(arr ? "I" : "J") + "(o,m('" + sub[0] + "'))" | ||
) + ")" : | ||
v + "o['" + path + ( | ||
arr === "" ? "'])&&i(c)&&c" : | ||
obj === "" ? "'])&&j(c)&&c" : | ||
"'])" | ||
v + "o['" + path + "'])" + ( | ||
arr === "" ? "&&i(c)&&c" : | ||
obj === "" ? "&&j(c)&&c" : | ||
"" | ||
) | ||
@@ -145,3 +147,3 @@ ) + (dot ? "&&" : "") | ||
function pathSet(str, path, arr, obj, dot) { | ||
function pathSet(str, path, arr, arrExt, obj, dot) { | ||
var op = "o['" + path + "']" | ||
@@ -151,3 +153,3 @@ , out = "" | ||
if (sub) { | ||
out = "(o="+(arr?"i":"j")+"(o['" + path + "'])?o['" + path + "']:(o['" + path + "']="+(arr?"[]":"{}")+"))&&" | ||
out = "(o=" + (arr ? "i(" : "j(") + op + ")?" + op + ":(" + op + (arr ? "=[]" : "={}") +"))&&" | ||
if (arr === "-") { | ||
@@ -160,3 +162,3 @@ op = "o[o.length]" | ||
op = "o[t]" | ||
out += "(t="+(arr?"I":"J")+"(o,f('" + sub + "'),1))!=null&&" | ||
out += "(t=" + (arr ? "I" : "J") + "(o,m('" + sub + "'),1))!=null&&" | ||
} | ||
@@ -173,7 +175,7 @@ } | ||
return map[str] || (map[str] = Function( | ||
"i,j,I,J,K,f", | ||
"i,j,I,J,K,m,p", | ||
"return function(d,v,b){var c,o,t;return (o=d)&&" + | ||
pathStr(str, set) + | ||
(set ? ",c}": "!==void 0?c:v}") | ||
)(isArray, isObject, inArray, inObject, KEYS, matcher)) | ||
)(isArray, isObject, inArray, inObject, KEYS, matcher, pathFn)) | ||
} | ||
@@ -204,3 +206,3 @@ | ||
fn = filterFns[key] = Function( | ||
fns[str] ? "a" : "a,i,j,I,J,K,f,p,t", | ||
fns[str] ? "a" : "a,i,j,I,J,K,m,p,t", | ||
"return function(d,b){var o;return " + optimized + "}" | ||
@@ -284,3 +286,3 @@ ) | ||
m[6] ? m[7] : | ||
primitiveRe.test(m[0]) ? JSON.parse(m[0]) : | ||
primitiveRe.test(m[0]) ? exports.parse(m[0]) : | ||
(isRe = globRe.test(m[0])) ? RegExp( | ||
@@ -296,4 +298,4 @@ "^" + m[0] | ||
idd = ( | ||
m[2] ? "f." + m[2].toLowerCase() : | ||
m[3] ? "f" : | ||
m[2] ? "m." + m[2].toLowerCase() : | ||
m[3] ? "m" : | ||
isArray || attr === "c" ? arrIdx(arr, matcher(isRe ? "~" : op)) : | ||
@@ -361,3 +363,3 @@ "" | ||
"return function(o,a){return " + | ||
JSON.stringify(map).replace(/:(\d+)/g,":g[$1](o)") + "}" | ||
exports.stringify(map).replace(/:(\d+)/g,":g[$1](o)") + "}" | ||
)(arr, aclFn) | ||
@@ -364,0 +366,0 @@ } |
{ | ||
"name": "litejs", | ||
"version": "21.1.1", | ||
"version": "21.1.2", | ||
"description": "Full-stack web framework in a tiny package", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -24,3 +24,5 @@ | ||
+negod.space || negod.space | ||
) | ||
// Line and Paragraph separator needing to be escaped in JavaScript but not in JSON, | ||
// escape those so the JSON can be evaluated or directly utilized within JSONP. | ||
).replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029") | ||
}, | ||
@@ -115,3 +117,2 @@ // RFC 4180 optional parameters: charset, header | ||
}, | ||
mimeType: "application/octet-stream", | ||
rangeSize: 500 * 1024, | ||
@@ -386,8 +387,7 @@ status: { | ||
, resHead = {} | ||
, negod = res.opts._accept(reqHead.accept || reqHead["content-type"]) | ||
, negod = res.opts._accept(reqHead.accept || reqHead["content-type"] || "*/*") | ||
, opts = Object.assign({statusCode: res.statusCode}, res.opts, negod, opts_) | ||
, format = negod.subtype || "json" | ||
, outStream = opts.stream || res | ||
if (!format) { | ||
if (!negod.match) { | ||
return res.sendStatus(406) // Not Acceptable | ||
@@ -467,8 +467,3 @@ } | ||
} else { | ||
// Line and Paragraph separator needing to be escaped in JavaScript but not in JSON, | ||
// escape those so the JSON can be evaluated or directly utilized within JSONP. | ||
outStream.end( | ||
format === "json" ? body.replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029") : | ||
body | ||
) | ||
outStream.end(body) | ||
} | ||
@@ -491,3 +486,3 @@ } | ||
opts.filename = opts.download === true ? file.split("/").pop() : opts.download | ||
opts.mimeType = res.opts.mime[ file.split(".").pop() ] || res.opts.mimeType | ||
opts.mimeType = res.opts.mime[ file.split(".").pop() ] || "application/octet-stream" | ||
opts.sendfile = file | ||
@@ -494,0 +489,0 @@ |
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
57982
1943