Skip to content

Commit

Permalink
Fix review
Browse files Browse the repository at this point in the history
  • Loading branch information
dy committed Sep 27, 2017
1 parent 31a05ae commit e04cdee
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 11 deletions.
8 changes: 3 additions & 5 deletions index.js
Expand Up @@ -6,8 +6,6 @@
'use strict';

var colorScale = require('./colorScale');
var isPlainObject = require('is-plain-obj');
var clamp = require('clamp');
var lerp = require('lerp')

module.exports = createColormap;
Expand All @@ -24,7 +22,7 @@ function createColormap (spec) {
b = [],
a = [];

if ( !isPlainObject(spec) ) spec = {};
if ( !spec ) spec = {};

nshades = (spec.nshades || 72) - 1;
format = spec.format || 'hex';
Expand Down Expand Up @@ -76,8 +74,8 @@ function createColormap (spec) {
});

// Add alpha channel to the map
alpha[0] = clamp(alpha[0], 0, 1);
alpha[1] = clamp(alpha[1], 0, 1);
alpha[0] = Math.min(Math.max(alpha[0], 0), 1);
alpha[1] = Math.min(Math.max(alpha[1], 0), 1);

var steps = cmap.map(function(c, i) {
var index = cmap[i].index
Expand Down
2 changes: 0 additions & 2 deletions package.json
Expand Up @@ -4,8 +4,6 @@
"description": "Great looking color maps",
"author": "bpostlethwaite",
"dependencies": {
"clamp": "^1.0.1",
"is-plain-obj": "^1.1.0",
"lerp": "^1.0.3"
},
"devDependencies": {
Expand Down
4 changes: 0 additions & 4 deletions test.js
Expand Up @@ -82,7 +82,3 @@ test('alphamap values are computed independently between runs', function(t) {

t.end();
});

test('repeating values', function(t) {
t.end()
});

0 comments on commit e04cdee

Please sign in to comment.