Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

document new ID now is random current timestamp in base-32

  • Loading branch information...
commit 326d49cd2721d52b99f9f4e0b29924f46e833995 1 parent de86ff1
@pgte authored
View
2  docs/web/views/examples/odm.jade
@@ -1,5 +1,5 @@
#examples
- h1 Examples (raw accesss)
+ h1 Examples (ODM)
h2 Define a User model
p
View
5 lib/alfred/meta/model/document.js
@@ -19,10 +19,7 @@ Document.prototype._assureNotNew = function() {
}
var newId = function() {
- function S4() {
- return (((1+Math.random())*0x10000)|0).toString(16).substring(1);
- }
- return (S4()+S4()+"-"+S4()+"-"+S4()+"-"+S4()+"-"+S4()+S4()+S4());
+ return (Math.floor(Math.random() * 100000000000000000) + Date.now()).toString(32);
};
Document.prototype.isValid = function() {
View
3  package.json
@@ -1,6 +1,6 @@
{ "name" : "alfred"
, "description" : "In-process key-value store"
-, "version" : "0.5.0b3"
+, "version" : "0.5.1b1"
, "homepage" : "http://pgte.github.com/alfred"
, "author" : "Pedro Teixeira <pedro.teixeira@gmail.com> (http://metaduck.com)"
, "contributors" :
@@ -15,6 +15,7 @@
, "web" : "http://github.com/pgte/alfred/issues"
}
, "directories" : { "lib" : "./lib/alfred" }
+, "main" : "./index.js"
, "engines" : { "node" : ">=0.3.1" }
, "scripts" : {}
, "dependencies" :
View
5 test/model/test_inspect.js
@@ -8,10 +8,7 @@ var assert = require('assert')
var DB_PATH = __dirname + '/../../tmp/db';
var USER = {name: 'Pedro', age: 35, sex: 'm'};
-var EXPECTED_INSPECT = "{ name: 'Pedro',\n\
- age: 35,\n\
- sex: 'm',\n\
- id: '<<<ID>>>' }";
+var EXPECTED_INSPECT = "{ name: 'Pedro', age: 35, sex: 'm', id: '<<<ID>>>' }";
module.exports.setup = function(next) {
(function removeFilesUnder(dir) {

0 comments on commit 326d49c

Please sign in to comment.
Something went wrong with that request. Please try again.