bignum in browser

This commit is contained in:
Manuel Araoz 2014-01-30 15:17:06 -05:00
parent bd7d3c8e79
commit b509732aa3
5 changed files with 64 additions and 12 deletions

View File

@ -4,17 +4,36 @@ module.exports = function(grunt) {
//Load NPM tasks
grunt.loadNpmTasks('grunt-browserify');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-mocha-test');
// Project Configuration
grunt.initConfig({
browserify: {
basic: {
src: ['main2.js'],
dest: 'browser/bundle.js'
client: {
src: ['main.js'],
dest: 'browser/bundle.js',
options: {
alias: ['browserify-bignum/bignumber.js:bignum']
}
}
}
},
watch: {
scripts: {
files: ['**/*.js', '**/*.html', '!**/node_modules/**', '!**/bundle.js'],
tasks: ['browserify'/*, 'mochaTest'*/],
},
},
mochaTest: {
options: {
reporter: 'spec',
},
src: ['test/*.js'],
},
});
grunt.registerTask('default', ['browserify']);
grunt.registerTask('default', ['watch']);
};

View File

@ -1,3 +1,4 @@
'use strict';
require('classtool');
function spec(b) {

12
browser/sample.html Normal file
View File

@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<script src="bundle.js"></script>
</head>
<body>
<script type="text/javascript">
</script>
</body>
</html>

10
main.js Normal file
View File

@ -0,0 +1,10 @@
//var Enc = require('./util/EncodedData').class();
//require('base58-native');
var bignum = require('bignum');
var b = bignum('782910138827292261791972728324982')
.sub('182373273283402171237474774728373')
.div(8);
console.log(b);

View File

@ -7,9 +7,15 @@
"email": "stephen@bitpay.com"
},
"contributors": [
{"name": "Stefan Thomas", "email": "moon@justmoon.net"},
{"name": "Jeff Garzik", "email": "jgarzik@bitpay.com"}
],
{
"name": "Stefan Thomas",
"email": "moon@justmoon.net"
},
{
"name": "Jeff Garzik",
"email": "jgarzik@bitpay.com"
}
],
"keywords": [
"bitcoin",
"btc",
@ -25,16 +31,20 @@
"scripts": {},
"dependencies": {
"classtool": "=1.0.0",
"base58-native": "=0.1.1",
"bindings": "=1.1.0",
"base58-native": "=0.1.3",
"bindings": "=1.1.1",
"bufferput": "=0.1.1",
"bignum": "=0.6.1",
"binary": "=0.3.0",
"step": "=0.0.4",
"buffers": "=0.1.1",
"buffertools": "=1.1.1",
"mocha": ">=1.15.1"
"mocha": ">=1.15.1",
"browserify-bignum": "1.3.0-2"
},
"devDependencies": {
"grunt-contrib-watch": "~0.5.3",
"grunt-mocha-test": "~0.8.2"
},
"devDependencies": {},
"license": "MIT"
}