Comparing version 21.3.1 to 21.6.0
@@ -12,10 +12,10 @@ | ||
, escapeRe = /[.+?^!:${}()|\[\]\/\\]/g | ||
, fnStr = 'for(;(m=r.exec(i))&&(m=' | ||
, fnStr = 'if(typeof i=="string")for(;(m=r.exec(i))&&(m=' | ||
return Function( | ||
'c,R,D', | ||
'c,R,D,u', | ||
'var r=/(?:^|,\\s*)(?:(' + | ||
('' + rules).replace(/[^,;]+|\s*;\s*(\w+)=("([^"]*)"|[^,;\s]*)|,/ig, function add(rule, key, token, qstr, offset, all) { | ||
if (key) { | ||
fnStr += ',' + key + ':D(m[' + (++group) + '],m[' + (++group + 1) + ']==null?m[' + (group++) + ']||' + | ||
fnStr += ',' + key + ':D(m[' + (group += 3) + ']===u?m[' + (group - 1) + ']||' + | ||
JSON.stringify(qstr === void 0 ? token : qstr) + ':m[' + group + '])' | ||
@@ -65,5 +65,5 @@ return '(?=(?:"[^"]*"|[^,])*;\\s*' + key + '(=|\\*=utf-8\'\\w*\')("([^"]*)"|[^\\s,;]+)|)' | ||
'return l}' | ||
)(choices, rules, function(op, str) { | ||
)(choices, rules, function(str) { | ||
try { | ||
str = decodeURIComponent(str) | ||
return decodeURIComponent(str) | ||
} catch (e) {} | ||
@@ -70,0 +70,0 @@ return str |
12
i18n.js
@@ -42,3 +42,5 @@ | ||
currentMap[tmp[1]][tmp[2]] || | ||
currentMap[tmp[2]] | ||
currentMap[tmp[2]] || | ||
fallback || | ||
tmp[2] | ||
) || fallback | ||
@@ -141,3 +143,4 @@ ) : | ||
isObject(currentMap[sub]) && currentMap[sub][word] || | ||
currentMap[word || sub] | ||
isString(currentMap[sub + word]) && currentMap[sub + word] || | ||
isString(currentMap[word]) && currentMap[word] | ||
) || isString(fallback) && fallback || "" | ||
@@ -339,3 +342,3 @@ } | ||
if ((i-=2) < 0 || arr[i] && (arr[i] == "" + val || +arr[i] <= val)) { | ||
return arr[i + 1] || "" | ||
return arr[i + 1] ? arr[i + 1].replace("#", val) : "" | ||
} | ||
@@ -358,3 +361,4 @@ } | ||
i18n.map = function(input, str, sep, lastSep) { | ||
if (!isArray(input)) return input | ||
if (isObject(input)) input = Object.values(input) | ||
else if (!isArray(input)) return input | ||
var arr = input.map(function(data) { | ||
@@ -361,0 +365,0 @@ return i18n(str, data) |
{ | ||
"name": "litejs", | ||
"version": "21.3.1", | ||
"version": "21.6.0", | ||
"description": "Full-stack web framework in a tiny package", | ||
@@ -26,2 +26,3 @@ "license": "MIT", | ||
"litejs": { | ||
"build": false, | ||
"lint": "jshint *.js" | ||
@@ -28,0 +29,0 @@ }, |
@@ -1,26 +0,18 @@ | ||
[npm package]: https://npmjs.org/package/litejs | ||
[LiteJS]: https://github.com/litejs/litejs | ||
[UI]: https://github.com/litejs/ui | ||
[CLI]: https://github.com/litejs/cli | ||
[web]: https://www.litejs.com/ | ||
[wiki]: https://github.com/litejs/litejs/wiki | ||
[Quick-Start]: https://github.com/litejs/litejs/wiki/Quick-Start | ||
[size]: https://packagephobia.now.sh/badge?p=litejs | ||
[size-src]: https://packagephobia.now.sh/result?p=litejs | ||
[wiki]: https://github.com/litejs/litejs/wiki | ||
LiteJS – [![size][size]][size-src] | ||
====== | ||
LiteJS is a full-stack web framework in a tiny package. | ||
[LiteJS][] is a full-stack web framework in a tiny package. | ||
It is split into three main package by designated install location: | ||
- **[litejs][LiteJS]** - Server and core libraries installed as `dependencies` | ||
- **[@litejs/ui][UI]** - UI engine installed as devDependencies | ||
- **[@litejs/cli][CLI]** - Command line tools installed as global package | ||
## Get Started | ||
Build your first LiteJS app with in 5 minute [Quick Start Guide](https://github.com/litejs/litejs/wiki/Quick-Start). | ||
Build your first [LiteJS][] app with in 5 minute [Quick Start Guide][Quick-Start]. | ||
See [wiki][] for more. | ||
@@ -31,6 +23,4 @@ | ||
[GitHub repo][LiteJS] | | ||
[npm package][] | | ||
[Travis CI](https://travis-ci.org/litejs/litejs) | | ||
[Coveralls code coverage](https://coveralls.io/github/litejs/litejs) | ||
[GitHub repo](https://github.com/litejs/litejs) | | ||
[npm package](https://npmjs.org/package/litejs) | ||
@@ -37,0 +27,0 @@ |
@@ -108,7 +108,8 @@ | ||
function rand(len) { | ||
for (var out = ""; out.length < len; ) { | ||
out += (Date.now() * Math.random()).toString(36).split(".")[0] | ||
function rand(min, max) { | ||
if (typeof max === "number") return Math.random() * (max - min) + min | ||
for (var out = ""; out.length < min; ) { | ||
out += Math.random().toString(36).slice(2) | ||
} | ||
return out.slice(-len) | ||
return out.slice(-min) | ||
} | ||
@@ -115,0 +116,0 @@ |
2337
71505
33