Comments (5)
Just an idea. Perhaps it would be more convenient to organize the library as a npm package? So that all functions would be available without monkey patching, touching globalThis
object and expanding native prototypes such as Number
or BigInt
.
import { Numeric, Float } from 'well-named-enhanced-js-math-library'
or even
import { modPow } from 'well-named-enhanced-js-math-library/math'
It will allow users to safely use the code in their projects without fear of breaking them with a new suddenly adopted ECMAscript standard.
I would help you with package building, refactoring, and so on.
What do you think?
from esomath.js.
I realized this library wouldn't be useless even after removing everything that is not a Stage +1 proposal. I still haven't made the decision about the future of this library. I'll open a new Issue about this
from esomath.js.
For consistency, I decided that the only global values and fns that should be encapsulated/localized, should be everything but prototype
methods, because of the call
problem (infinite regress), and because using call
makes the code less "elegant". So this library will do the assumption that all prototype
s are immutable (even if they aren't)
from esomath.js.
@fitiskin I've been considering doing that. This library includes a lot of stuff that would probably never be added to the official ES spec (like Fibonacci, and inverse factorials), so it shouldn't be used as a polyfill, but rather as a standalone library. Another solution is to remove anything/everything that is not strictly and definitely included in a Stage [1, 4] proposal, ensuring there's more safety about using this as a polyfill. All of the removed functions can then be migrated to my "Useless-Math" repo, and then I would turn that into a non-polyfill standalone library distributed using NPM.
Also, IIFE polyfills ensure everything behaves exactly like built-in methods, so using ESM may not be a good idea for this. I need more info to take a better decision about it.
The problem with my "solution" to remove stuff is that the library would become useless very fast, because core-js already has better polyfills for future JS math, but I want this library to add more stuff because it makes it more unique.
Maybe I should completely abandon the polyfill library concept, and just turn this into a normal library. I could still make polyfills for future stuff, but in smaller quantities, which would make it easier to maintain and change, and I could post them as Gists instead of dedicating entire repos to them.
Thank you for your insight, I'll start thinking more about this
from esomath.js.
I've given up on JS, so I'll 🦀RIIR in the future.
I'll keep the JS commit history in a secondary branch, for archiving purposes
from esomath.js.
Related Issues (20)
- Avoid mismatch-type errors, where possible HOT 1
- Add rising and falling Factorials HOT 1
- Add PowerSet? HOT 1
- Add `modInv` and `egcd` HOT 1
- Add deterministic primality tester HOT 1
- Make `isPower` use a quasi-linear time algorithm HOT 2
- Make `IntN.factorial` even more efficient HOT 2
- Use Inverse Gamma Function in `factorial_inv`
- Add test files HOT 2
- Consider renaming radian conversions
- What should be the future of this library? HOT 6
- Add Generalized Mean HOT 1
- Test Workflow HOT 1
- Replace `IntN.parse` by `BigInt.fromString` HOT 1
- Name is not unique HOT 1
- Use decorators
- Focus on minimalism
- Move polyfills to a new repo
- add Kaprekar's routine
- add prod dig-sum & rev-dig-sum
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 esomath.js.