Comments (5)
While it would be nice being able to do so, toString is a relatively expensive operation. One could see the absence of such a feature as a hint that one shouldn't implicitly and repetitively convert longs to strings without being aware of its cost. protobuf.js for example expects this behavior.
from long.js.
Can you explain why toString
is experience? I have to use it too much . I want know more about it . may be I change my approach
For example how can I save a Long id in a pouchdb database and run a query sort by id?? Is it possible without toString??
from long.js.
That's because toString
uses div
(ref). One way for storage could be to generate an 8 byte binary string using the first 4 bytes for the high and the second 4 bytes for the low bits - that is if the database supports ASCII or another properly sortable column type (won't work with utf8, doesn't work well with signage). Alternatively, the result of toString
could be reused where applicable instead of calling it multiple times on the same instance.
from long.js.
What about fromString
, is fromString
experience? and fromBits
?
from long.js.
Closing this issue for now as it hasn't received any replies recently. Feel free to reopen it if necessary!
from long.js.
Related Issues (20)
- Migrate to ESM HOT 1
- Using symbol for isLong HOT 2
- Add default value of unsigned in Long.fromInt to docs
- How to return a uint64? HOT 4
- isPositive returns true for zero
- Is the heigh argument in Long constructor required? HOT 2
- Switch to ESM breaks 3rd party libraries HOT 8
- [BUG] this.isZero is not function
- WASM check causes Node 16.1+ crash on ARMv6 HOT 3
- Unable import in TypeScript since v5+ HOT 10
- Add copyright line to licence
- protobuf fromNumber encoding error HOT 2
- Cannot import package using ES modules HOT 1
- Please available on module commonjs
- fromString with a string that isn't an integer behaves weird
- TypeScript errors with moduleResolution nodenext HOT 16
- "./package.json" is not defined by "exports" warning in React Native HOT 2
- For packaging for debian => need source information HOT 6
- Issue when running build on a NodeJS app HOT 4
- Patch
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 long.js.