Comparing version 0.2.24 to 0.2.25
@@ -148,2 +148,21 @@ #Change Log | ||
* Removed a few try catch statements that caused issues to the core. | ||
* Updated readme | ||
* Updated readme | ||
**omega 0.2.25** | ||
* Router module can now accept urls that contain versions in the following format: `\d{1,2}(\.)\d{1,2}((\.)\d{1,2})?$` Note that adding 'v' before the numbers does not matter just as long its in the form. | ||
* If you want to use multiline line in JSON. Just create the text in the following form and it will work: | ||
```js | ||
//ja.js | ||
module.exports = { | ||
"index": { | ||
"something": [ | ||
"line1", | ||
" line2", | ||
" line3", | ||
].join('\n'), | ||
"so forth and so on": "something" | ||
} | ||
}; | ||
``` |
@@ -5,3 +5,3 @@ /*jslint node: true, forin: true, jslint white: true, newcap: true*/ | ||
* gengojs | ||
* version : 0.2.24 | ||
* version : 0.2.25 | ||
* author : Takeshi Iwana | ||
@@ -89,3 +89,3 @@ * https://github.com/iwatakeshi | ||
//version | ||
VERSION = '0.2.24', | ||
VERSION = '0.2.25', | ||
//configuration with defaults set | ||
@@ -92,0 +92,0 @@ CONFIG = { |
@@ -149,3 +149,2 @@ /*jslint node: true, forin: true, jslint white: true, newcap: true*/ | ||
result = value; | ||
console.log("result:", result); | ||
} | ||
@@ -309,3 +308,3 @@ }); | ||
//https://github.com/rhalff/dot-object/blob/master/index.js | ||
function dotParser(path, obj, remove) { | ||
function dotParser(path, obj) { | ||
var i, keys, val; | ||
@@ -315,19 +314,20 @@ if (path.indexOf('.') !== -1) { | ||
for (i = 0; i < keys.length; i++) { | ||
if (obj.hasOwnProperty(keys[i])) { | ||
if (i === (keys.length - 1)) { | ||
if (remove) { | ||
val = obj[keys[i]]; | ||
delete obj[keys[i]]; | ||
return val; | ||
if (keys[i].indexOf("*") !== -1) { | ||
keys[i] = keys[i].replace('*', '.'); | ||
} | ||
if (obj) { | ||
if (obj.hasOwnProperty(keys[i])) { | ||
if (i === (keys.length - 1)) { | ||
return obj[keys[i]]; | ||
} else { | ||
return obj[keys[i]]; | ||
obj = obj[keys[i]]; | ||
} | ||
} else { | ||
obj = obj[keys[i]]; | ||
debug("module: parse, fn: dotParser, Type Cannot read property " + keys[i] + " of undefined").warn(); | ||
if (config().router()) { | ||
debug("Could be universe?").warn(); | ||
} | ||
return undefined; | ||
} | ||
} else { | ||
debug("module: parse, fn: dotParser, Type Cannot read property of " + keys[i] + " undefined").warn(); | ||
if (config().router()) { | ||
debug("Could be universe?").warn(); | ||
} | ||
return undefined; | ||
@@ -338,9 +338,3 @@ } | ||
} else { | ||
if (remove) { | ||
val = obj[path]; | ||
delete obj[path]; | ||
return val; | ||
} else { | ||
return obj[path]; | ||
} | ||
return obj[path]; | ||
} | ||
@@ -347,0 +341,0 @@ } |
@@ -22,2 +22,3 @@ /*jslint node: true, forin: true, jslint white: true, newcap: true*/ | ||
baseUrl, | ||
_ = require('underscore'), | ||
debug = require('./utils.js').debug, | ||
@@ -63,3 +64,3 @@ hasModule = (typeof module !== 'undefined' && module.exports); | ||
return dotPath.match(/\./g).length; | ||
}else{ | ||
} else { | ||
return 0; | ||
@@ -85,3 +86,6 @@ } | ||
var pathArray = path.split('/'), | ||
filteredPathArray = [], | ||
newpath = []; | ||
var regexVersion = /\d{1,2}(\.)\d{1,2}((\.)\d{1,2})?$/; | ||
if (pathArray.length < 3) { | ||
@@ -96,2 +100,13 @@ //its safe to say that pathArray[0] will always be '' | ||
} else { | ||
var regexVersion = /\d{1,2}(\.)\d{1,2}((\.)\d{1,2})?$/; | ||
_.each(pathArray, function(item) { | ||
if (item.match(regexVersion)) { | ||
filteredPathArray.push(item.replace('.', '*')); | ||
} else { | ||
filteredPathArray.push(item); | ||
} | ||
}); | ||
pathArray = filteredPathArray; | ||
for (var count = 1; count < pathArray.length; count++) { | ||
@@ -98,0 +113,0 @@ if (count === 1) { |
@@ -5,3 +5,3 @@ /*jslint node: true, forin: true, jslint white: true, newcap: true*/ | ||
* gengojs | ||
* version : 0.2.24 | ||
* version : 0.2.25 | ||
* author : Takeshi Iwana | ||
@@ -21,3 +21,3 @@ * https://github.com/iwatakeshi | ||
lib, | ||
VERSION = 'omega 0.2.24', | ||
VERSION = 'omega 0.2.25', | ||
//gengo modules | ||
@@ -95,3 +95,3 @@ config = require('./modules/config.js'), | ||
if (arg.locale) { | ||
_locale = arg.locale; | ||
_locale = localemap.moment[arg.locale]; | ||
} | ||
@@ -149,3 +149,3 @@ } else if (_.isString(arg)) { | ||
if (arg.locale) { | ||
_locale = arg.locale; | ||
_locale = localemap.numeral[arg.locale]; | ||
} | ||
@@ -254,3 +254,2 @@ if (arg.self) { | ||
if (_.isString(override)) { | ||
//check if the string contains a locale | ||
@@ -257,0 +256,0 @@ if (override) { |
{ | ||
"name": "gengojs", | ||
"version": "0.2.24", | ||
"version": "0.2.25", | ||
"description": "An uber basic and simple i18n library for Express 4", | ||
@@ -5,0 +5,0 @@ "main": "gengo.js", |
@@ -48,3 +48,3 @@ Gengo.js | ||
* More tests | ||
* Revamped gengo.js which is currently under alpha status. It's <em>way</em> better: | ||
* Revamped gengo.js which is currently under omega status. It's <em>way</em> better: | ||
* Bracket notation support | ||
@@ -241,2 +241,21 @@ * Dot notation support | ||
* Removed a few try catch statements that caused issues to the core. | ||
* Updated readme | ||
* Updated readme | ||
**omega 0.2.25** | ||
* Router module can now accept urls that contain versions in the following format: `\d{1,2}(\.)\d{1,2}((\.)\d{1,2})?$` Note that adding 'v' before the numbers does not matter just as long its in the form. | ||
* If you want to use multiline line in JSON. Just create the text in the following form and it will work: | ||
```js | ||
//ja.js | ||
module.exports = { | ||
"index": { | ||
"something": [ | ||
"line1", | ||
" line2", | ||
" line3", | ||
].join('\n'), | ||
"so forth and so on": "something" | ||
} | ||
}; | ||
``` |
198116
4784
259