diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000..741df19 --- /dev/null +++ b/.eslintignore @@ -0,0 +1 @@ +test/runkit.js \ No newline at end of file diff --git a/.neutrinorc.js b/.neutrinorc.js index 8e3646d..ee07259 100644 --- a/.neutrinorc.js +++ b/.neutrinorc.js @@ -6,22 +6,9 @@ const libName = require('./package.json').name; module.exports = { use: [ - airbnbBase({ - eslint: { - baseConfig: { - rules: { - 'jest/no-try-expect': 'off', - }, - }, - }, - }), + airbnbBase(), library({ name: libName, - babel: { - plugins: [ - '@babel/plugin-proposal-class-properties', - ], - }, }), jest(), (neutrino) => { diff --git a/package.json b/package.json index bbc0766..b976e9d 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,6 @@ "deploy": "yarn build && yarn dist:update && yarn test && yarn dist:commit && yarn publish" }, "devDependencies": { - "@babel/plugin-proposal-class-properties": "^7.8.3", "@neutrinojs/airbnb-base": "^9.1.0", "@neutrinojs/jest": "^9.1.0", "@neutrinojs/library": "^9.1.0", diff --git a/src/index.js b/src/index.js index 916ce97..f631735 100644 --- a/src/index.js +++ b/src/index.js @@ -9,14 +9,8 @@ const DICT_RANGES = { }; class ShortUniqueId { - counter = 0; - - debug; - - dict = []; - /* eslint-disable consistent-return */ - log = (...args) => { + log(...args) { const finalArgs = [...args]; finalArgs[0] = `[short-unique-id] ${args[0]}`; /* eslint-disable no-console */ @@ -26,10 +20,15 @@ class ShortUniqueId { } } /* eslint-enable no-console */ - }; + } /* eslint-enable consistent-return */ constructor(options = {}) { + this.counter = 0; + this.debug = false; + this.dict = []; + this.version = version; + const { dictionary: userDict, skipShuffle, @@ -71,12 +70,14 @@ class ShortUniqueId { this.log((`Generator instantiated with Dictionary Size ${this.dictLength}`)); } - getDict = () => this.dict; + getDict() { + return this.dict; + } /** * Generates UUID based on internal counter that's incremented after each ID generation. */ - sequentialUUID = () => { + sequentialUUID() { let counterDiv; let counterRem; let id; @@ -94,13 +95,13 @@ class ShortUniqueId { /* eslint-enable no-constant-condition */ this.counter += 1; return id; - }; + } /** * Generates UUID by creating each part randomly. * @param {Integer} uuidLength Desired UUID length. */ - randomUUID = (uuidLength = DEFAULT_RANDOM_ID_LEN) => { + randomUUID(uuidLength = DEFAULT_RANDOM_ID_LEN) { let id; let randomPartIdx; let j; @@ -128,9 +129,11 @@ class ShortUniqueId { // Return random generated ID. return id; - }; + } - getVersion = () => version; + getVersion() { + return this.version; + } } export default ShortUniqueId; diff --git a/yarn.lock b/yarn.lock index 40ea124..57061ab 100644 --- a/yarn.lock +++ b/yarn.lock @@ -84,18 +84,6 @@ levenary "^1.1.1" semver "^5.5.0" -"@babel/helper-create-class-features-plugin@^7.8.3": - version "7.8.6" - resolved "https://registry.yarnpkg.com/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.8.6.tgz#243a5b46e2f8f0f674dc1387631eb6b28b851de0" - integrity sha512-klTBDdsr+VFFqaDHm5rR69OpEQtO2Qv8ECxHS1mNhJJvaHArR6a1xTf5K/eZW7eZpJbhCx3NW1Yt/sKsLXLblg== - dependencies: - "@babel/helper-function-name" "^7.8.3" - "@babel/helper-member-expression-to-functions" "^7.8.3" - "@babel/helper-optimise-call-expression" "^7.8.3" - "@babel/helper-plugin-utils" "^7.8.3" - "@babel/helper-replace-supers" "^7.8.6" - "@babel/helper-split-export-declaration" "^7.8.3" - "@babel/helper-create-regexp-features-plugin@^7.8.3": version "7.8.6" resolved "https://registry.yarnpkg.com/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.8.6.tgz#7fa040c97fb8aebe1247a5c645330c32d083066b" @@ -269,14 +257,6 @@ "@babel/helper-remap-async-to-generator" "^7.8.3" "@babel/plugin-syntax-async-generators" "^7.8.0" -"@babel/plugin-proposal-class-properties@^7.8.3": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.8.3.tgz#5e06654af5cd04b608915aada9b2a6788004464e" - integrity sha512-EqFhbo7IosdgPgZggHaNObkmO1kNUe3slaKu54d5OWvy+p9QIKOzK1GAEpAIsZtWVtPXUHSMcT4smvDrCfY4AA== - dependencies: - "@babel/helper-create-class-features-plugin" "^7.8.3" - "@babel/helper-plugin-utils" "^7.8.3" - "@babel/plugin-proposal-dynamic-import@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-dynamic-import/-/plugin-proposal-dynamic-import-7.8.3.tgz#38c4fe555744826e97e2ae930b0fb4cc07e66054"