Get rid of lodash dependency

This commit is contained in:
arne 2024-01-31 19:01:32 +01:00
commit ca9e8e56be
3 changed files with 599 additions and 550 deletions

View file

@ -16,27 +16,24 @@
"keywords": [], "keywords": [],
"author": "", "author": "",
"license": "ISC", "license": "ISC",
"devDependencies": {
"@11ty/eleventy": "^2.0.1",
"@thi.ng/hiccup": "3.6.22",
"lodash": "^4.17.21",
"luxon": "^2.3.0",
"seedrandom": "^3.0.5"
},
"dependencies": { "dependencies": {
"@11ty/eleventy": "^2.0.1",
"@11ty/eleventy-fetch": "^4.0.0", "@11ty/eleventy-fetch": "^4.0.0",
"@11ty/eleventy-plugin-rss": "^1.1.2", "@11ty/eleventy-plugin-rss": "^1.2.0",
"@11ty/eleventy-plugin-syntaxhighlight": "^4.1.0", "@11ty/eleventy-plugin-syntaxhighlight": "^4.2.0",
"@junwatu/markdown-it-lazy-loading": "1.0.0-beta.4", "@junwatu/markdown-it-lazy-loading": "1.0.0-beta.4",
"@remy/webmention": "^1.4.5", "@remy/webmention": "^1.5.0",
"@thi.ng/hiccup": "3.6.22",
"@types/markdown-it": "^12.2.3", "@types/markdown-it": "^12.2.3",
"autoprefixer": "^10.4.12", "autoprefixer": "^10.4.17",
"eleventy-plugin-nesting-toc": "^1.3.0", "eleventy-plugin-nesting-toc": "^1.3.0",
"markdown-it": "^13.0.1", "luxon": "^2.5.2",
"markdown-it": "^13.0.2",
"markdown-it-abbr": "^1.0.4", "markdown-it-abbr": "^1.0.4",
"markdown-it-anchor": "^8.6.5", "markdown-it-anchor": "^8.6.7",
"markdown-it-footnote": "^3.0.3", "markdown-it-footnote": "^3.0.3",
"postcss": "^8.4.17", "postcss": "^8.4.33",
"postcss-cli": "^10.0.0" "postcss-cli": "^10.1.0",
"seedrandom": "^3.0.5"
} }
} }

1127
pnpm-lock.yaml generated

File diff suppressed because it is too large Load diff

View file

@ -1,8 +1,13 @@
const crypto = require('crypto') const crypto = require('crypto')
const seedrandom = require('seedrandom') const seedrandom = require('seedrandom')
const { range } = require('lodash')
const { serialize } = require('@thi.ng/hiccup') const { serialize } = require('@thi.ng/hiccup')
const range = function* (end) {
for (let i = 0; i < end; i++) {
yield i
}
}
/** /**
* Given a pair of coordinates representing the center, returns the cartesian * Given a pair of coordinates representing the center, returns the cartesian
* coordinate for a straight line drawn at radian angle `alpha` with * coordinate for a straight line drawn at radian angle `alpha` with
@ -53,8 +58,8 @@ const tenPrint = content => {
const seed = Number.parseInt(hash, 16) const seed = Number.parseInt(hash, 16)
const random = seedrandom(seed) const random = seedrandom(seed)
const radius = width / numTiles / 2 const radius = width / numTiles / 2
const xs = range(numTiles + 1).map(x => width * (x / numTiles)) const xs = [...range(numTiles + 1)].map(x => width * (x / numTiles))
const ys = range(numTiles + 1).map(y => width * (y / numTiles)) const ys = [...range(numTiles + 1)].map(y => width * (y / numTiles))
const startAngle = random() < 0.5 ? quarterTau : 0 const startAngle = random() < 0.5 ? quarterTau : 0
return ["svg.ten-print", return ["svg.ten-print",