color-hash
Advanced tools
Comparing version 1.0.0 to 1.0.1
{ | ||
"name": "color-hash", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"homepage": "https://github.com/zenozeng/color-hash", | ||
@@ -5,0 +5,0 @@ "authors": [ |
@@ -10,7 +10,9 @@ !function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var o;"undefined"!=typeof window?o=window:"undefined"!=typeof global?o=global:"undefined"!=typeof self&&(o=self),o.ColorHash=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
var seed = 131; | ||
var seed2 = 137; | ||
var hash = 0; | ||
var MAX_SAFE_INTEGER = parseInt(9007199254740991 / seed / seed); // Number.MAX_SAFE_INTEGER equals 9007199254740991 | ||
// Note: Number.MAX_SAFE_INTEGER equals 9007199254740991 | ||
var MAX_SAFE_INTEGER = parseInt(9007199254740991 / seed2); | ||
for(var i = 0; i < str.length; i++) { | ||
if(hash > MAX_SAFE_INTEGER) { | ||
hash = parseInt(hash / seed); | ||
hash = parseInt(hash / seed2); | ||
} | ||
@@ -17,0 +19,0 @@ hash = hash * seed + str.charCodeAt(i); |
@@ -9,7 +9,9 @@ /** | ||
var seed = 131; | ||
var seed2 = 137; | ||
var hash = 0; | ||
var MAX_SAFE_INTEGER = parseInt(9007199254740991 / seed / seed); // Number.MAX_SAFE_INTEGER equals 9007199254740991 | ||
// Note: Number.MAX_SAFE_INTEGER equals 9007199254740991 | ||
var MAX_SAFE_INTEGER = parseInt(9007199254740991 / seed2); | ||
for(var i = 0; i < str.length; i++) { | ||
if(hash > MAX_SAFE_INTEGER) { | ||
hash = parseInt(hash / seed); | ||
hash = parseInt(hash / seed2); | ||
} | ||
@@ -16,0 +18,0 @@ hash = hash * seed + str.charCodeAt(i); |
{ | ||
"name": "color-hash", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Generate color based on the given string (using HSL color space and BKDRHash).", | ||
@@ -5,0 +5,0 @@ "main": "lib/color-hash.js", |
73967
716