From 4d4324ca8facc2a85937d8e06fd11fe9e484c752 Mon Sep 17 00:00:00 2001 From: Sergey Kamardin Date: Fri, 20 Mar 2015 12:38:20 +0300 Subject: [PATCH 1/2] Remove _ from code --- src/templates/js | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/src/templates/js b/src/templates/js index c8cdfec..08c2fa3 100644 --- a/src/templates/js +++ b/src/templates/js @@ -7,6 +7,25 @@ root.palette = factory(); } })(this, function() { + // avoid using lodash in dependencies + function keys(obj) { + var keys, key; + + keys = []; + + for (var key in obj) if (obj.hasOwnProperty(key)) { + keys.push(key); + } + + return keys; + } + + // avoid using lodash in dependencies + function random(min, max) { + return Math.floor(Math.random() * ( max - min + 1 )) + min; + } + + return { palette: { <% _.forIn(colors, function(shades, color) { %> @@ -25,12 +44,12 @@ _.forIn(shades, function(hex, shade) { %> random: function(shade) { var colors, color, shades; - colors = _.keys(this.palette); - color = colors[_.random(0, colors.length - 1)]; + colors = keys(this.palette); + color = colors[random(0, colors.length - 1)]; - if (_.isUndefined(shade)) { - shades = _.keys(color); - shade = shades[_.random(0, shades.length - 1)]; + if (shade == null) { + shades = keys(color); + shade = shades[random(0, shades.length - 1)]; } return this.get(color, shade); From 3dcf1f5add381795ba44fb7dd09358edb0453f48 Mon Sep 17 00:00:00 2001 From: Dan Date: Fri, 20 Mar 2015 23:46:30 +0900 Subject: [PATCH 2/2] Bump version --- CHANGELOG.md | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fdb6423..083847e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ -# 1.2.1 +# 1.2.2 -2015-03-18 +2015-03-20 - Add random function in the js version diff --git a/package.json b/package.json index fbd4cdf..bc5763e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "google-material-color", - "version": "1.2.1", + "version": "1.2.2", "description": "Google material color (http://www.google.com/design/spec/style/color.html) implementation for Sass, Less, Stylus, CSS and JS.", "main": "dist/palette.js", "scripts": {