abcq
Advanced tools
Comparing version 0.1.5 to 0.1.6
@@ -5,2 +5,7 @@ # Change Log | ||
<a name="0.1.6"></a> | ||
## [0.1.6](https://github.com/pixelass/abcq/compare/v0.1.5...v0.1.6) (2016-09-09) | ||
<a name="0.1.5"></a> | ||
@@ -7,0 +12,0 @@ ## [0.1.5](https://github.com/pixelass/abcq/compare/v0.1.4...v0.1.5) (2016-09-09) |
@@ -108,10 +108,2 @@ (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){ | ||
this.counter = this.options.counter; | ||
/** | ||
* Object to store already generated combinations. | ||
* If a this object contains a requested value it will be returned | ||
* instead of canverting it again | ||
* @type {Object} | ||
* @private | ||
*/ | ||
this.storage = {}; | ||
} | ||
@@ -148,4 +140,2 @@ | ||
* calling `generate` | ||
* Only converts a number when requested the first time. If the number | ||
* has been converted before it will be taken from the storage. | ||
* | ||
@@ -179,4 +169,3 @@ * @param {Number} i A number greater than `-1`. Given a list of `"ab" | ||
* check if the number is smaller than 0. | ||
* Then return `null` or check if the number has been generated before. | ||
* Then return the number from the storage or continue | ||
* Then return `null` or continue | ||
*/ | ||
@@ -211,12 +200,5 @@ if (i < 0) { | ||
var previousSlots = nextSlot ? this.charsAt(nextSlot - 1) : ''; | ||
/* add the current slot */ | ||
/* convert the current slot */ | ||
var currentSlot = this.chars[i % this.chars.length]; | ||
var combination = previousSlots + currentSlot; | ||
/* | ||
* Save the value for faster usage when needed again. | ||
* Then return the combination | ||
*/ | ||
this.storage[i] = combination; | ||
return combination; | ||
return previousSlots + currentSlot; | ||
} | ||
@@ -223,0 +205,0 @@ }]); |
@@ -5,4 +5,4 @@ (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){ | ||
},{"./":2}],2:[function(require,module,exports){ | ||
"use strict";function _classCallCheck(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(exports,"__esModule",{value:!0});var _createClass=function(){function t(t,e){for(var r=0;r<e.length;r++){var a=e[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(t,a.key,a)}}return function(e,r,a){return r&&t(e.prototype,r),a&&t(e,a),e}}(),alphabet="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",abcQ=function(){function t(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];_classCallCheck(this,t);var r={chars:alphabet,counter:-1};this.options=Object.assign(r,e),this.chars=this.options.chars,this.counter=this.options.counter,this.storage={}}return _createClass(t,[{key:"generate",value:function(){return this.charsAt(++this.counter)}},{key:"charsAt",value:function(t){if(t<0)return null;var e=~~(t/this.chars.length),r=e?this.charsAt(e-1):"",a=this.chars[t%this.chars.length],n=r+a;return this.storage[t]=n,n}}]),t}();exports.default=abcQ; | ||
"use strict";function _classCallCheck(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(exports,"__esModule",{value:!0});var _createClass=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),alphabet="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",abcQ=function(){function t(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];_classCallCheck(this,t);var r={chars:alphabet,counter:-1};this.options=Object.assign(r,e),this.chars=this.options.chars,this.counter=this.options.counter}return _createClass(t,[{key:"generate",value:function(){return this.charsAt(++this.counter)}},{key:"charsAt",value:function(t){if(t<0)return null;var e=~~(t/this.chars.length),r=e?this.charsAt(e-1):"",n=this.chars[t%this.chars.length];return r+n}}]),t}();exports.default=abcQ; | ||
},{}]},{},[1]); |
@@ -83,10 +83,2 @@ 'use strict'; | ||
this.counter = this.options.counter; | ||
/** | ||
* Object to store already generated combinations. | ||
* If a this object contains a requested value it will be returned | ||
* instead of canverting it again | ||
* @type {Object} | ||
* @private | ||
*/ | ||
this.storage = {}; | ||
} | ||
@@ -124,4 +116,2 @@ | ||
* calling `generate` | ||
* Only converts a number when requested the first time. If the number | ||
* has been converted before it will be taken from the storage. | ||
* | ||
@@ -155,4 +145,3 @@ * @param {Number} i A number greater than `-1`. Given a list of `"ab" | ||
* check if the number is smaller than 0. | ||
* Then return `null` or check if the number has been generated before. | ||
* Then return the number from the storage or continue | ||
* Then return `null` or continue | ||
*/ | ||
@@ -187,12 +176,5 @@ if (i < 0) { | ||
var previousSlots = nextSlot ? this.charsAt(nextSlot - 1) : ''; | ||
/* add the current slot */ | ||
/* convert the current slot */ | ||
var currentSlot = this.chars[i % this.chars.length]; | ||
var combination = previousSlots + currentSlot; | ||
/* | ||
* Save the value for faster usage when needed again. | ||
* Then return the combination | ||
*/ | ||
this.storage[i] = combination; | ||
return combination; | ||
return previousSlots + currentSlot; | ||
} | ||
@@ -199,0 +181,0 @@ }]); |
{ | ||
"name": "abcq", | ||
"version": "0.1.5", | ||
"version": "0.1.6", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "repository": "git@github.com:pixelass/abcq.git", |
21928
367