bitcore/examples/Address.js

29 lines
635 B
JavaScript
Raw Normal View History

2014-02-24 04:06:54 -08:00
'use strict';
2014-03-12 09:08:52 -07:00
var run = function() {
2014-03-12 10:21:23 -07:00
// Replace '../bitcore' with 'bitcore' if you use this code elsewhere.
var bitcore = require('../bitcore');
var Address = bitcore.Address;
2014-03-12 09:08:52 -07:00
var addrs = [
'1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa',
'1A1zP1eP5QGefi2DMPTfTL5SLmv7Dixxxx',
'A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa',
'1600 Pennsylvania Ave NW',
].map(function(addr) {
return new Address(addr);
});
2014-03-12 09:08:52 -07:00
addrs.forEach(function(addr) {
var valid = addr.isValid();
console.log(addr.data + ' is ' + (valid ? '' : 'not ') + 'valid');
});
};
module.exports.run = run;
if (require.main === module) {
run();
}