Comments (8)
Thus I'd recommend you adjust your test cases to reflect this new, arguably more correct behavior. I had a brief look at the PR linked above, but lack sufficient context to assess the impact for your application - please let me know if that works for you.
That makes sense, I'll update our code.
from base62.js.
Thanks for the test cases, that's helpful.
So to summarize: For invalid inputs, v1.2.8 returns a number whereas v2.0.0 returns NaN
. It seems to me that v1.2.8's behavior is misleading and thus a bug, so I'm hesitant to change the behavior in v2.x.
Thus I'd recommend you adjust your test cases to reflect this new, arguably more correct behavior. I had a brief look at the PR linked above, but lack sufficient context to assess the impact for your application - please let me know if that works for you.
(FWIW, if we ever get around to it, v3.0 will probably be more strict, validating inputs to avoid such confusion - see #57.)
from base62.js.
@FND could you maybe document this behavior?
from base62.js.
I'm afraid it appears that behavior for invalid inputs is inconsistent:
master...FND:invalid-inputs
So documenting this isn't straightforward - that's unfortunate, of course, but I'd rather expend energy on fixing the underlying issues for v3.0 (see above).
from base62.js.
So documenting this isn't straightforward - that's unfortunate, of course, but I'd rather expend energy on fixing the underlying issues for v3.0 (see above).
ah, oops. Ok, then hopefully everything will be ok and people will find more info in the issue tracker.
Thanks a lot for your work on this lib!
from base62.js.
I'm glad it's proving useful. (For my part, I was mostly moving existing code around, building on Andrew's original work.)
Since you're one of the few vocal users: Would migrating to the/a new API with strict input validation be a realistic option for you? From my perspective, that should be pretty straightforward and quick, but I don't wanna presume...
(No promises though; I still don't have the headspace to return to the aforementioned v3.0 efforts.)
from base62.js.
Since you're one of the few vocal users: Would migrating to the/a new API with strict input validation be a realistic option for you? From my perspective, that should be pretty straightforward and quick, but I don't wanna presume...
(No promises though; I still don't have the headspace to return to the aforementioned v3.0 efforts.)
I don't have a strong opinion on this, of course we'd like to keep the current API (or actually the legacy one) because it works well for us. That being said, if there is a new API and some upgrade instructions, then no problem. I did not switch to the new API yet because it requires us to pass the character set to encode
or decode
. The legacy API had a helper function to set this character set globally. If I had to switch to the current/new API right now, I'd probably mimic this legacy API:
import base62 from 'base62/lib/custom';
const charset = base62.indexCharset(
'~9876543210ABCDEFGHIJKLMNOPQRSTU$#@%!abcdefghijklmnopqrstuvw-='
);
return {
decode: (data) => base62.decode(data, charset),
encode: (data) => base62.encode(data, charset),
};
We use this lib to encode/decode auth tokens with a Django backend (hence the need for a custom character set).
from base62.js.
That's helpful feedback, thank you!
from base62.js.
Related Issues (20)
- Upgrade mocha to version 4.0.0
- Upgrade growl to version 1.10.3
- Upgrade mocha to version 4.0.1
- Upgrade diff to version 3.4.0
- Upgrade supports-color to version 4.5.0
- ISSUE: If the input string starts with 0 then that 0 is lost during encoding. HOT 12
- Upgrade growl to version 1.10.4
- Upgrade commander to version 2.14.0
- Upgrade commander to version 2.14.1
- Install problem HOT 1
- `TID` is not recognized command. HOT 2
- Upgrade brace-expansion to version 1.1.10
- Upgrade brace-expansion to version 1.1.11
- Is it possible to disable install-stats.js? HOT 3
- Base16 to Base64
- modular ES6 variant HOT 2
- Where is the tag for 1.2.8? HOT 11
- BigInt version HOT 5
- Add length feature to get encoded string of specific length.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from base62.js.