This is a playground
to test code. It runs a full Node.js
environment and already has all of npm
’s 1,000,000+ packages pre-installed, including upc-database
with all npm
packages installed. Try it out:
// Switch node version to Node6
var UPC = require('upc-database');
var upc = new UPC('your key');
upc.json('0111222333446', function(resp){
if(!resp.serverError && resp.valid){
console.dir(resp);
} else if(!resp.serverError && !resp.valid){
console.log(resp.reason);
} else {
console.log('server error');
}
});
upc.xml('0111222333446', function(resp){
if(!resp.serverError && resp.valid){
console.dir(resp);
} else if(!resp.serverError && !resp.valid){
console.log(resp.reason);
} else {
console.log('server error');
}
});
This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.