Skip to content

Commit

Permalink
es6
Browse files Browse the repository at this point in the history
  • Loading branch information
4kimov committed Jul 10, 2016
1 parent cd5fff5 commit 9684f99
Show file tree
Hide file tree
Showing 29 changed files with 1,351 additions and 655 deletions.
10 changes: 10 additions & 0 deletions .babelrc
@@ -0,0 +1,10 @@
{
"presets": ["es2015"],
"plugins": [
"add-module-exports",
"transform-es2015-modules-umd",
["rename-umd-globals", {
"hashids": "Hashids"
}]
]
}
14 changes: 14 additions & 0 deletions .editorconfig
@@ -0,0 +1,14 @@
# editorconfig.org
root = true

[*]
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
indent_style = tab
indent_size = 4

[{package.json,.babelrc}]
indent_style = space
indent_size = 2
22 changes: 22 additions & 0 deletions .eslintrc
@@ -0,0 +1,22 @@
{
"env": {
"browser": true,
"node": true,
"mocha": true,
"es6": true
},
"extends": "eslint:recommended",
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module"
},
"rules": {
"eqeqeq": 2,
"indent": ["error", "tab"],
"no-var": 2,
"prefer-const": 2,
"no-unused-vars": [2, {"vars": "all", "args": "none", "varsIgnorePattern": "[iI]gnored"}],
"no-alert": 2,
"no-trailing-spaces": 2
}
}
5 changes: 4 additions & 1 deletion .gitignore
@@ -1,2 +1,5 @@
node_modules
.DS_Store
Hashids.tmproj
npm-debug.log
.nyc_output
coverage
9 changes: 9 additions & 0 deletions .travis.yml
@@ -0,0 +1,9 @@
language: node_js

node_js:
- "0.10"
- "0.12"
- "4"
- "6"

sudo: false
83 changes: 83 additions & 0 deletions CHANGELOG.md
@@ -0,0 +1,83 @@

# CHANGELOG

**1.1.0**:

- ES6 source (lib itself is minified ES5)
- UMD support ([Node.js repo](https://github.com/ivanakimov/hashids.node.js) is merging into this one)
- Added Eslint (npm run lint)
- Added Mocha (npm run test)
- Added Coveralls (npm run coveralls)
- Added build script (npm run build)
- Moved CHANGELOG out of `README.md`
- `README.md` completely updated
- `examples/` folder removed; all examples are now in the README

**1.0.2**:

- Support for older browsers (using `charAt`) by [@tauanz](https://github.com/tauanz): <https://github.com/ivanakimov/hashids.js/pull/15>

**1.0.1**:

- *require.js* support by [@nleclerc](https://github.com/nleclerc): <https://github.com/ivanakimov/hashids.js/pull/12>

**1.0.0**:

- Several public functions are renamed to be more appropriate:
- Function `encrypt()` changed to `encode()`
- Function `decrypt()` changed to `decode()`
- Function `encryptHex()` changed to `encodeHex()`
- Function `decryptHex()` changed to `decodeHex()`

Hashids was designed to encode integers, primary ids at most. We've had several requests to encrypt sensitive data with Hashids and this is the wrong algorithm for that. So to encourage more appropriate use, `encrypt/decrypt` is being "downgraded" to `encode/decode`.

- Version tag added: `1.0`
- `README.md` updated

**0.3.0**:

**PRODUCED HASHES IN THIS VERSION ARE DIFFERENT THAN IN 0.1.4, DO NOT UPDATE IF YOU NEED THEM TO KEEP WORKING:**

- Same algorithm as [PHP](https://github.com/ivanakimov/hashids.php) and [Node.js](https://github.com/ivanakimov/hashids.node.js) versions now
- Overall approximately **4x** faster
- Consistent shuffle function uses slightly modified version of [Fisher–Yates algorithm](http://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle#The_modern_algorithm)
- Generate large hash strings faster (where _minHashLength_ is more than 1000 chars)
- When using _minHashLength_, hash character disorder has been improved
- Basic English curse words will now be avoided even with custom alphabet
- _encrypt_ function now also accepts array of integers as input
- Passing JSLint now
- Support for [Bower](http://bower.io/) package manager

**0.1.4**:

- Global var leak for hashSplit (thanks to [@BryanDonovan](https://github.com/BryanDonovan))
- Class capitalization (thanks to [@BryanDonovan](https://github.com/BryanDonovan))

**0.1.3**:

Warning: If you are using 0.1.2 or below, updating to this version will change your hashes.

- Updated default alphabet (thanks to [@speps](https://github.com/speps))
- Constructor removes duplicate characters for default alphabet as well (thanks to [@speps](https://github.com/speps))

**0.1.2**:

Warning: If you are using 0.1.1 or below, updating to this version will change your hashes.

- Minimum hash length can now be specified
- Added more randomness to hashes
- Added unit tests
- Added example files
- Changed warnings that can be thrown
- Renamed `encode/decode` to `encrypt/decrypt`
- Consistent shuffle does not depend on md5 anymore
- Speed improvements

**0.1.1**:

- Speed improvements
- Bug fixes

**0.1.0**:

- First commit
35 changes: 16 additions & 19 deletions LICENSE
@@ -1,22 +1,19 @@
Copyright (c) 2012 Ivan Akimov
Copyright (c) 2012-2016 Ivan Akimov

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

0 comments on commit 9684f99

Please sign in to comment.