antfu / utils Goto Github PK
View Code? Open in Web Editor NEWCollection of common JavaScript / TypeScript utils
License: MIT License
Collection of common JavaScript / TypeScript utils
License: MIT License
Line 32 in 6cc9a99
The return type of objectMap may be Record<NK, NV>
instead of Record<K, V>
README has docs link to https://www.paka.dev/npm/@antfu/utils however when we visit the site it throws error and renders below:
n/a
n/a
The lerp
method may have accuracy problems when calculating with decimals, which may not matter in some scenarios (such as calculating pixels), but may be confusing in some situations.
// math.test.ts
import { lerp } from './math'
it('lerp', () => {
expect(lerp(0.2, 0.4, 0.5)).toMatchInlineSnapshot('0.30000000000000004')
})
https://github.com/CatsJuice/mir-antfu-utils-math-lerp-precision
System:
OS: macOS 14.0
CPU: (10) arm64 Apple M1 Pro
Memory: 67.19 MB / 16.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 18.16.0 - ~/.nvm/versions/node/v18.16.0/bin/node
Yarn: 1.22.17 - /usr/local/bin/yarn
npm: 9.5.1 - ~/.nvm/versions/node/v18.16.0/bin/npm
Browsers:
Safari: 17.0
pnpm
Hey there!
I'd like to report a security issue but cannot find contact instructions on your repository.
If not a hassle, might you kindly add a SECURITY.md
file with an email, or another contact method? GitHub recommends this best practice to ensure security issues are responsibly disclosed, and it would serve as a simple instruction for security researchers in the future.
Thank you for your consideration, and I look forward to hearing from you!
(cc @huntr-helper)
๐ค Forwarded from downstream issue
Should report to upstream repo
When using the latest version (v6.0.1), build reports an error with the following error message. It is available to use the previous v0.5.2.
sorry, Unable to provide
System:
OS: Windows 10 10.0.19043
CPU: (8) x64 AMD Ryzen 5 3550H with Radeon Vega Mobile Gfx
Memory: 5.51 GB / 14.88 GB
Binaries:
Node: 14.19.0 - D:\Programs\nodejs\node.EXE
Yarn: 1.22.17 - D:\Programs\nodejs\yarn.CMD
npm: 6.14.16 - D:\Programs\nodejs\npm.CMD
Browsers:
Edge: Spartan (44.19041.1266.0), Chromium (106.0.1370.52)
Internet Explorer: 11.0.19041.1566
pnpm
I don't know if there's something wrong with the way I'm using it, but no matter how I assign a value to concurrency
, all the Promises
are always executed at the same time.
// main.ts
import { p } from "@antfu/utils";
import { loadData, sleep } from "./utils";
/**
* Mock data loading
* @returns
*/
export async function loadData() {
await sleep(Math.random() * 1000)
return Math.round(Math.random() * 1000)
}
const concurrency = 1
let running = 0
p(
Array.from({ length: 100 }).map(async (_, i) => {
console.log(`start, running: ${running++}`)
const data = await loadData();
console.log(`end, running: ${running--}`)
return data;
}),
{ concurrency }
)
The result of the above code is that all requests are executed simultaneously and end after a random time.
https://github.com/CatsJuice/mir-antfu-utils-p-not-working
System:
OS: macOS 14.0
CPU: (10) arm64 Apple M1 Pro
Memory: 101.16 MB / 16.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 18.16.0 - ~/.nvm/versions/node/v18.16.0/bin/node
Yarn: 1.22.17 - /usr/local/bin/yarn
npm: 9.5.1 - ~/.nvm/versions/node/v18.16.0/bin/npm
Browsers:
Safari: 17.0
npm
๐ค Forwarded from downstream issue
Should report to upstream repo
Hi,
I'm currently using objectMap
to transform all empty values to null, but it's not recursive by default.
This feature request proposes a second deepObjectMap
method that would work with nested objects.
No response
No response
๐ค Forwarded from downstream issue
Should report to upstream repo
Re: https://huntr.dev/bounties/009f1cd9-401c-49a7-bd08-be35cff6faef/
Thank you for all your hard work on fixing vulnerabilities on the utils lib.
Even after fix on 7.3, platforms such as SonaType are still flagging this package as insecure because one file wasn't updated (index.js) even though the commonJS and ESM versions are clear.
Quote:
The fix for this vulnerability was released for version 0.7.3 and onwards only on the index.mjs and index.cjs files. However the index.js file remains vulnerable.
index.js should also include the Prototype Pollution fix
No response
No response
๐ค Forwarded from downstream issue
Forwarded from downstream issue
null
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.