This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
new Person().load({ | |
keys: 'age', | |
startkey: 28, | |
endkey: 50 | |
}, function(error, people) { | |
for (var i = 0; i < people.length; i++) { | |
people[i].sayName(); | |
} | |
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var endtable = require('endtable'); | |
var engine = new endtable.Engine({ | |
database: 'people_example', | |
username: 'xxxxxx', | |
password: 'xxxxxx', | |
host: 'xxxxxx.couchone.com' | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var ben = new Person({ | |
name: 'Benjamin Coe', | |
age: 27, | |
sex: 'male', | |
interests: ['climbing'] | |
}); | |
ben.interests.push('programming'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Person = endtable.Object.extend( | |
{ | |
sayName: function() { | |
sys.puts('Hello, my name is ' + this.name + '!'); | |
} | |
}, | |
{ | |
engine: engine, | |
type: 'person' | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
parseInt('06'); // 6 | |
parseInt('08'); // 0 |