Skip to content

Commit

Permalink
Fix wrong normalization
Browse files Browse the repository at this point in the history
  • Loading branch information
dy committed Feb 15, 2017
1 parent 9ab5cda commit 2735fb4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ var clamp = require('clamp')
module.exports = toNumber

function toNumber (rgba, normalized) {
if(!normalized) normalized = true
if(normalized == null) normalized = true

var r = rgba[0], g = rgba[1], b = rgba[2], a = rgba[3]

Expand Down
1 change: 1 addition & 0 deletions test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const toNumber = require('./')
const assert = require('assert')

assert.notEqual(toNumber([31, 47, 185, 178.5], false), toNumber([36, 54, 188, 178.5], false))
assert.equal(toNumber([0,0,0,0]), 0)
assert.equal(toNumber([1,1,1,1]), 0xffffffff)
assert.equal(toNumber([0,0,0,1]), 0x000000ff)
Expand Down

0 comments on commit 2735fb4

Please sign in to comment.