ngraph.physics.primitives
Advanced tools
Comparing version 0.0.1 to 0.0.2
10
index.js
@@ -7,11 +7,11 @@ module.exports = { | ||
function Body() { | ||
function Body(x, y) { | ||
this.pos = new Vector2d(x, y); | ||
this.force = new Vector2d(); | ||
this.pos = new Vector2d(); | ||
this.mass = 1; | ||
} | ||
function Vector2d() { | ||
this.x = 0; | ||
this.y = 0; | ||
function Vector2d(x, y) { | ||
this.x = typeof x === 'number' ? x : 0; | ||
this.y = typeof y === 'number' ? y : 0; | ||
} |
{ | ||
"name": "ngraph.physics.primitives", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "Physics primitives for ngraph.* libraries", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -16,3 +16,11 @@ var test = require('tap').test, | ||
t.ok(typeof vector.y === 'number', 'Vector has y coordinates'); | ||
var initialized = new primitives.Vector2d(1, 2); | ||
t.equal(initialized.x, 1, 'Vector initialized imporperly'); | ||
t.equal(initialized.y, 2, 'Vector initialized imporperly'); | ||
var badInput = new primitives.Vector2d('hello world'); | ||
t.equal(badInput.x, 0, 'Vector should be resilient to bed input'); | ||
t.equal(badInput.y, 0, 'Vector should be resilient to bed input'); | ||
t.end(); | ||
}); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4561
35