// npm package
@beabee/beabee-common
Shared code between Beabee projects
weekly
84
monthly
743
versions
139
maintainers
2
license
AGPL-3.0
first publish
2022-10-17
publisher
jumplink
tarball
1,182,270 B
AUTO-PUBLISHED·1 version indexed·latest published 2026-05-21
// offending code· @0.44.2· 2 files flagged
llm: benign · 0.85→ No suspicious destination, no remote-exec shape — 1 known-vendor host(s).
- @0.44.2··AUTO-PUBLISHED·publisher: jumplinkheuristic 99/100static flags 2llm benign (0.85) via ollamanew-publisher:3drecent-owner-changemature-packagepublisher-multi-name-burst:104publisher-version-pump:273dormant-takeover:prev=wpf500@0.21.1-alpha.2public-github-pushchild-process-spawn
→ No suspicious destination, no remote-exec shape — 1 known-vendor host(s).
// offending code· 2 files flaggedpatterns: 2
--- install scripts --- ### prepublishOnly yarn clear && yarn build --- package/package.json (excerpt) --- { "name": "@beabee/beabee-common", "version": "0.44.2", "description": "Shared code between Beabee projects", "type": "module", "main": "./dist/index.js", "types": "./src/index.ts", "files": [ "dist/", "src/" ], "exports": { ".": { "types": "./src/index.ts", "module": "./src/index.ts", "default": "./dist/index.js" }, "./package.json": "./package.json" }, "scripts": { "clear": "rm -rf dist", "build": "tsc -p ./tsconfig.build.json", "watch": "tsc -p ./tsconfig.build.json --watch --preserveWatchOutput", "dev": "yarn watch", "prepublishOnly": "yarn clear && yarn build", "test": "yarn test:types && yarn test:esm && yarn test:vitest", "test:types": "tsc --noEmit", "test:esm": "node test/node/module-type/import.mjs", "test:vitest": "vitest run", "test:vitest:watch": "vitest", "generate:index": "yarn workspace @beabee/dev-cli start generate-index --extension js --baseDir $(pwd) -p ./src/data ./src/error ./src/search ./src/types ./src/utils ./src/validators", "format": "prettier --write .", "check": "yarn check:tsc && yarn check:prettier", "check:tsc": "tsc --project ./tsconfig.build.json --noEmit", "check:prettier": "prettier -c ." }, "repository": { "type": "git", "url": "git+https://github.com/beabee-communityrm/monorepo.git" }, "author": "", "license": "AGPL-3.0", "bugs": { "url": "https://github.com/beabee-communityrm/monorepo/issues" } --- package/src/utils/date.ts (excerpt) --- import { add, isValid, parseISO, startOfDay, startOfHour, startOfMinute, startOfMonth, startOfSecond, startOfYear, } from 'date-fns'; import type { DateUnit, Duration, UnitMatches } from '../types/index.js'; // Must be ordered from highest resolution to lowest (seconds to years) export const dateUnits = ['s', 'm', 'h', 'd', 'M', 'y'] as const; export const dateUnitMap: Record<DateUnit, keyof Duration> = { y: 'years', M: 'months', d: 'days', h: 'hours', m: 'minutes', s: 'seconds', }; const startOf: Record<DateUnit, (d: Date) => Date> = { y: startOfYear, M: startOfMonth, d: startOfDay, h: startOfHour, m: startOfMinute, s: startOfSecond, }; const relativeDate = /^\$now(?<units>\(((y|M|d|h|m|s):(-?\d+),?)+\))?$/; const relativeUnit = /(y|M|d|h|m|s):(-?\d+)/g; // Matches the different parts of an ISO 8601 date. Note we don't validate the // pattern properly as that is handled by parseISO, we just want to know which // parts of the date were specified const absoluteDate = /^(?<y>\d{4,})(-(?<M>\d\d)(-(?<d>\d\d)([T ](?<h>\d\d)(:(?<m>\d\d)(:(?<s>\d\d))?)?)?)?)?/; // Convert relative dates and returns the minimum date unit specified export function parseDate( value: string, now: Date = new Date() ): [Date, DateUnit] { let date: Date; let units: DateUnit[]; const relativeMatch = relativeDate.exec(value); if (relativeMatch) { date = now; const unitsGroup = relativeMatch.groups?.units; if (unitsGroup) { cons
