bignum in browser
This commit is contained in:
parent
bd7d3c8e79
commit
b509732aa3
27
Gruntfile.js
27
Gruntfile.js
|
@ -4,17 +4,36 @@ module.exports = function(grunt) {
|
||||||
|
|
||||||
//Load NPM tasks
|
//Load NPM tasks
|
||||||
grunt.loadNpmTasks('grunt-browserify');
|
grunt.loadNpmTasks('grunt-browserify');
|
||||||
|
grunt.loadNpmTasks('grunt-contrib-watch');
|
||||||
|
grunt.loadNpmTasks('grunt-mocha-test');
|
||||||
|
|
||||||
// Project Configuration
|
// Project Configuration
|
||||||
grunt.initConfig({
|
grunt.initConfig({
|
||||||
browserify: {
|
browserify: {
|
||||||
basic: {
|
client: {
|
||||||
src: ['main2.js'],
|
src: ['main.js'],
|
||||||
dest: 'browser/bundle.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']);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
'use strict';
|
||||||
require('classtool');
|
require('classtool');
|
||||||
|
|
||||||
function spec(b) {
|
function spec(b) {
|
||||||
|
|
|
@ -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>
|
|
@ -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);
|
||||||
|
|
22
package.json
22
package.json
|
@ -7,8 +7,14 @@
|
||||||
"email": "stephen@bitpay.com"
|
"email": "stephen@bitpay.com"
|
||||||
},
|
},
|
||||||
"contributors": [
|
"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": [
|
"keywords": [
|
||||||
"bitcoin",
|
"bitcoin",
|
||||||
|
@ -25,16 +31,20 @@
|
||||||
"scripts": {},
|
"scripts": {},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"classtool": "=1.0.0",
|
"classtool": "=1.0.0",
|
||||||
"base58-native": "=0.1.1",
|
"base58-native": "=0.1.3",
|
||||||
"bindings": "=1.1.0",
|
"bindings": "=1.1.1",
|
||||||
"bufferput": "=0.1.1",
|
"bufferput": "=0.1.1",
|
||||||
"bignum": "=0.6.1",
|
"bignum": "=0.6.1",
|
||||||
"binary": "=0.3.0",
|
"binary": "=0.3.0",
|
||||||
"step": "=0.0.4",
|
"step": "=0.0.4",
|
||||||
"buffers": "=0.1.1",
|
"buffers": "=0.1.1",
|
||||||
"buffertools": "=1.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"
|
"license": "MIT"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue