// npm 패키지
@antv/x6-common
Basic toolkit for X6
주간
12,062
월간
51,090
버전
32
메인테이너
51
라이선스
MIT
최초 publish
2022-03-25
publisher
newbyvector
tarball
2,020,825 B
AUTO-PUBLISHED·1개 버전 인덱싱됨·최근 publish: 2024-01-10
// publisher 캠페인by newbyvector
이 계정에서 catch된 패키지 9건고립된 catch가 아닙니다. 동일 publisher가 8개의 다른 패키지를 추가로 발행했고, 모두 파이프라인이 catch했습니다 — 일회성이 아닌 조직적 캠페인의 형태. 아래 링크는 각 형제 catch의 분석으로 이동합니다.
// offending code· @2.0.17· 3 files flagged
llm: benign · 0.85→ 의심 전송지 없음, 원격 실행 형태 없음 — 1 known-vendor host(s).
- @2.0.17··AUTO-PUBLISHED·publisher: newbyvectorheuristic 75/100static flags 3llm benign (0.85) via ollamapopularity:very-highmature-packageosv-flagged:MAL-2026-4099public-github-pushchild-process-spawnbase64-decode
→ 의심 전송지 없음, 원격 실행 형태 없음 — 1 known-vendor host(s).
// offending code· 3 files flaggedpatterns: 3
--- package/package.json (excerpt) --- { "name": "@antv/x6-common", "version": "2.0.17", "description": "Basic toolkit for X6", "main": "lib/index.js", "module": "es/index.js", "unpkg": "dist/index.js", "jsdelivr": "dist/index.js", "types": "lib/index.d.ts", "files": [ "dist", "es", "lib", "src" ], "keywords": [ "util", "toolkit", "x6", "antv" ], "dependencies": { "lodash-es": "^4.17.15", "utility-types": "^3.10.0" }, "devDependencies": { "@types/lodash-es": "^4.17.4" }, "author": { "name": "newbyvector", "email": "vectorse@126.com" }, "license": "MIT", "homepage": "https://x6.antv.antgroup.com", "bugs": { "url": "https://github.com/antvis/x6/issues" }, "repository": { "type": "git", "url": "https://github.com/antvis/x6.git", "directory": "packages/x6-common" }, "publishConfig": { "access": "public", "registry": "https://registry.npmjs.org" }, "scripts": { "clean:turbo": "rss", "clean:build": "rss", "clean:coverage": "rss", "clean": "rss", "build:esm": "rss", "build:cjs": "rss", "build:umd": "rss", "build:dev": "rss", "build:watch": "rss", "build:watch:esm": "rss", "build:watch:cjs": "rss", "build": "rss", "prebuild": "rss", "test": "rss", "coveralls": "rss", "pretest": "rss" } } --- package/src/number/number.ts (excerpt) --- export { isNumber, clamp } from 'lodash-es' /** * Returns the remainder of division of `n` by `m`. You should use this * instead of the built-in operation as the built-in operation does not * properly handle negative numbers. */ export function mod(n: number, m: number) { return ((n % m) + m) % m } export function random(lower: number, upper: number) { if (upper == null) { upper = lower == null ? 1 : lower // eslint-disable-line lower = 0 // eslint-disable-line } else if (upper < lower) { const tmp = lower lower = upper // eslint-disable-line upper = tmp // eslint-disable-line } return Math.floor(Math.random() * (upper - lower + 1) + lower) } export function isPercentage(val: any): val is string { return typeof val === 'string' && val.slice(-1) === '%' } export function normalizePercentage( num: number | string | null | undefined, ref: number, ) { if (num == null) { return 0 } let raw: number if (typeof num === 'string') { raw = parseFloat(num) if (isPercentage(num)) { raw /= 100 if (Number.isFinite(raw)) { return raw * ref } } } else { raw = num } if (!Number.isFinite(raw)) { return 0 } if (raw > 0 && raw < 1) { return raw * ref } return raw } export function parseCssNumeric(val: string, units?: string | string[]) { function getUnit(regexp: string) { const matches = new RegExp(`(?:\\d+(?:\\.\\d+)*)(${regexp})$`).exec(val) if (!matches) { --- package/src/dom/event/util.ts (excerpt) --- import { Store } from './store' import { EventObject } from './object' export namespace Util { export const returnTrue = () => true export const returnFalse = () => false export function stopPropagationCallback(e: Event) { e.stopPropagation() } export function addEventListener<TElement extends Element>( elem: TElement, type: string, handler: EventListener, ) { if (elem.addEventListener != null) { elem.addEventListener(type, handler as any) } } export function removeEventListener<TElement extends Element>( elem: TElement, type: string, handler: EventListener, ) { if (elem.removeEventListener != null) { elem.removeEventListener(type, handler as any) } } } export namespace Util { const rNotHTMLWhite = /[^\x20\t\r\n\f]+/g const rNamespace = /^([^.]*)(?:\.(.+)|)/ export function splitType(types: string) { return (types || '').match(rNotHTMLWhite) || [''] } export function normalizeType(type: string) { const parts = rNamespace.exec(type) || [] return { originType: parts[1] ? parts[1].trim() : parts[1], namespaces: parts[2] ? parts[2] .split('.') .map((ns) => ns.trim()) .sort() : [], } } export function isValidTarget(target: Element | Record<string, any>) { // Accepts only: // - Node // - Node.ELEMENT_NODE // - Node.DOCUMENT_NODE // - Object // - Any return target.nodeTy
