asd-xiv / m Goto Github PK
View Code? Open in Web Editor NEWPoint free style, functional library for Javascript with focus on object arrays.
Home Page: https://asd-xiv.github.io/m/
License: MIT License
Point free style, functional library for Javascript with focus on object arrays.
Home Page: https://asd-xiv.github.io/m/
License: MIT License
Hi!
I upgraded to v7, ESM one, and I am fighting the upgrade.
I was under the wrong impression that changing const {x} = require("@asd14/m")
to import {x} from "@asd14/m"
would be enough, but I keep getting an require() of ES Module
error importing the module. It seems that our Babel is taking that import and transforming it again to require, or something ...
... so my question would be if it makes sense to add upgrade instructions to the README, maybe considering this case.
Thanks!
Hi! I was considering how to randomly pick one element from an array. Other langs have that direct method or an easy explicit combination, ie Ruby: array.shuffle.pop
I implemented this little one:
const pickRandom = items => items[Math.trunc(items.length * Math.random())]
Any alternative already here I did not find? Are you interested in a PR?
I was wondering how to use sort
/ sortBy
to sort by dates, which I believe is a common use case. I was about to open a PR but wanted to check your opinion first.
This is what I have, for sorting objects by a given field:
const sortByDate = field =>
sort((a, b) => {
if (isEmpty(b[field])) {
return -1
}
if (isEmpty(a[field])) {
return 1
}
return new Date(b[field]).getTime() - new Date(a[field]).getTime()
})
which in turn takes me to consider other sorting behaviors (alphabetical?) and also if you'd add a new file for each sorting, or maybe generalize the criterium ...
I was playing with intersection
to see if that would allow us to find the elements in common in two arrays, but I am confused to see it does the opposite: it merges the two collections by applying a union function ... so my questions / comments:
union
or join, not an intersection, in Venn's terms. If I'm not mistaken, I'd suggest a rename ... although that'd be a breaking change. Moreover when I'd suggest to add a different intersection function ...intersection
or other function in m
be use to obtain that the elements in common in two lists? Would you accept a PR for that? What name would you give it?A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.