comparison backends/directory.js @ 28:7cfcd7d5796c

Replace Paul Sowden’s ISO8601 functions by my own, since their licence is possibly incompatible with AGPL.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Mon, 01 Nov 2010 03:01:40 +0100
parents a36a514e8be8
children e007a6364bf0
comparison
equal deleted inserted replaced
27:a36a514e8be8 28:7cfcd7d5796c
34 34
35 fs.readdir(dir, function(err, files) { 35 fs.readdir(dir, function(err, files) {
36 function sanitize(o) { 36 function sanitize(o) {
37 var n = {}; 37 var n = {};
38 for (var i in o) { 38 for (var i in o) {
39 if (i == 'content' || o[i].setISO8601) 39 if (i == 'content' || o[i].setFromISO8601)
40 n[i] = o[i].toString(); 40 n[i] = o[i].toString();
41 else if (o[i] instanceof Array) 41 else if (o[i] instanceof Array)
42 n[i] = o[i]; 42 n[i] = o[i];
43 else if (typeof o[i] == 'object') 43 else if (typeof o[i] == 'object')
44 n[i] = sanitize(o[i]); 44 n[i] = sanitize(o[i]);
107 for (var i in o) { 107 for (var i in o) {
108 if (typeof o[i] == 'string' && i == 'content') 108 if (typeof o[i] == 'string' && i == 'content')
109 parseStanza(o, i); 109 parseStanza(o, i);
110 else if (typeof o[i] == 'string' && regexp(o[i])) { 110 else if (typeof o[i] == 'string' && regexp(o[i])) {
111 var today = new Date(); 111 var today = new Date();
112 today.setISO8601(o[i]); 112 today.setFromISO8601(o[i]);
113 o[i] = today; 113 o[i] = today;
114 } else if (typeof o[i] == 'object') 114 } else if (typeof o[i] == 'object')
115 endParsing(o[i]); 115 endParsing(o[i]);
116 } 116 }
117 return o; 117 return o;