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

@ -1,8 +1,13 @@
const crypto = require('crypto')
const seedrandom = require('seedrandom')
const { range } = require('lodash')
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
* 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 random = seedrandom(seed)
const radius = width / numTiles / 2
const xs = range(numTiles + 1).map(x => width * (x / numTiles))
const ys = range(numTiles + 1).map(y => width * (y / numTiles))
const xs = [...range(numTiles + 1)].map(x => width * (x / numTiles))
const ys = [...range(numTiles + 1)].map(y => width * (y / numTiles))
const startAngle = random() < 0.5 ? quarterTau : 0
return ["svg.ten-print",