// npm 패키지
@antv/color-util
A common util collection for antv projects
버전
6
메인테이너
51
라이선스
ISC
최초 publish
2019-04-09
publisher
atool
tarball
24,730 B
AUTO-PUBLISHED·1개 버전 인덱싱됨·최근 publish: 2020-12-21
// publisher 캠페인by atool
이 계정에서 catch된 패키지 9건고립된 catch가 아닙니다. 동일 publisher가 8개의 다른 패키지를 추가로 발행했고, 모두 파이프라인이 catch했습니다 — 일회성이 아닌 조직적 캠페인의 형태. 아래 링크는 각 형제 catch의 분석으로 이동합니다.
// offending code· @2.0.6· 3 files flagged
llm: benign · 0.85→ 의심 전송지 없음, 원격 실행 형태 없음 — 1 known-vendor host(s).
- @2.0.6··AUTO-PUBLISHED·publisher: atoolheuristic 75/100static flags 2llm benign (0.85) via ollamaosv-flagged:MAL-2026-3862public-github-pushchild-process-spawn
→ 의심 전송지 없음, 원격 실행 형태 없음 — 1 known-vendor host(s).
// offending code· 3 files flaggedpatterns: 2
--- install scripts --- ### prepublishOnly npm-run-all --parallel test build --- package/package.json (excerpt) --- { "name": "@antv/color-util", "version": "2.0.6", "description": "A common util collection for antv projects", "main": "lib/index.js", "types": "lib/index.d.ts", "module": "esm/index.js", "files": [ "src", "package.json", "esm", "lib", "README.md" ], "scripts": { "build": "npm run clean && run-p build:*", "build:esm": "tsc -p tsconfig.json --target ES5 --module ESNext --outDir esm", "build:cjs": "tsc -p tsconfig.json --target ES5 --module commonjs --outDir lib", "clean": "rm -rf lib && rm -rf esm", "coverage": "npm run coverage-generator && npm run coverage-viewer", "coverage-generator": "torch --coverage --compile --source-pattern src/*.js,src/**/*.js --opts __tests__/mocha.opts", "coverage-viewer": "torch-coverage", "test": "torch --renderer --compile --opts __tests__/mocha.opts", "test-live": "torch --compile --interactive --opts __tests__/mocha.opts", "tsc": "tsc --noEmit", "typecheck": "tsc --noEmit", "prepublishOnly": "npm-run-all --parallel test build" }, "repository": { "type": "git", "url": "git+https://github.com/antvis/util.git" }, "keywords": [ "util", "antv", "g" ], "author": "https://github.com/orgs/antvis/people", "license": "ISC", "bugs": { "url": "https://github.com/antvis/util/issues" }, "devDependencies": { "@antv/torch": "^1.0.0", "less": "^3.9.0", "npm-run-all": "^4.1.5" }, "homepage": "https://github.com/antvis --- package/src/index.ts (excerpt) --- import { map, memoize, isString, each } from '@antv/util'; const RGB_REG = /rgba?\(([\s.,0-9]+)\)/; const regexLG = /^l\s*\(\s*([\d.]+)\s*\)\s*(.*)/i; const regexRG = /^r\s*\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)\s*(.*)/i; const regexColorStop = /[\d.]+:(#[^\s]+|[^\)]+\))/gi; const isGradientColor = (val) => /^[r,R,L,l]{1}[\s]*\(/.test(val); // 创建辅助 tag 取颜色 const createTmp = (): HTMLElement => { const i = document.createElement('i'); i.title = 'Web Colour Picker'; i.style.display = 'none'; document.body.appendChild(i); return i; }; // 获取颜色之间的插值 const getValue = (start: number[], end: number[], percent: number, index: number): number => { return start[index] + (end[index] - start[index]) * percent; }; // 数组转换成颜色 function arr2rgb(arr: number[]): string { return `#${toHex(arr[0])}${toHex(arr[1])}${toHex(arr[2])}`; } // rgb 颜色转换成数组 const rgb2arr = (str: string): number[] => { return [ parseInt(str.substr(1, 2), 16), parseInt(str.substr(3, 2), 16), parseInt(str.substr(5, 2), 16), ]; }; // 将数值从 0-255 转换成16进制字符串 const toHex = (value: number): string => { const x16Value = Math.round(value).toString(16); return x16Value.length === 1 ? `0${x16Value}` : x16Value; }; // 计算颜色 const calColor = (points: number[][], percent: number) => { const fixedPercent = isNaN(Number(percent)) || percent < 0 ? 0 : percent > 1 ? 1 : Number(percent); const steps = points.length - 1; const step = Math.floor(steps * fixedPercent); const --- package/lib/index.js (excerpt) --- "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var util_1 = require("@antv/util"); var RGB_REG = /rgba?\(([\s.,0-9]+)\)/; var regexLG = /^l\s*\(\s*([\d.]+)\s*\)\s*(.*)/i; var regexRG = /^r\s*\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)\s*(.*)/i; var regexColorStop = /[\d.]+:(#[^\s]+|[^\)]+\))/gi; var isGradientColor = function (val) { return /^[r,R,L,l]{1}[\s]*\(/.test(val); }; // 创建辅助 tag 取颜色 var createTmp = function () { var i = document.createElement('i'); i.title = 'Web Colour Picker'; i.style.display = 'none'; document.body.appendChild(i); return i; }; // 获取颜色之间的插值 var getValue = function (start, end, percent, index) { return start[index] + (end[index] - start[index]) * percent; }; // 数组转换成颜色 function arr2rgb(arr) { return "#" + toHex(arr[0]) + toHex(arr[1]) + toHex(arr[2]); } // rgb 颜色转换成数组 var rgb2arr = function (str) { return [ parseInt(str.substr(1, 2), 16), parseInt(str.substr(3, 2), 16), parseInt(str.substr(5, 2), 16), ]; }; // 将数值从 0-255 转换成16进制字符串 var toHex = function (value) { var x16Value = Math.round(value).toString(16); return x16Value.length === 1 ? "0" + x16Value : x16Value; }; // 计算颜色 var calColor = function (points, percent) { var fixedPercent = isNaN(Number(percent)) || percent < 0 ? 0 : percent > 1 ? 1 : Number(percent); var steps = points.length - 1; var step = Math.floor(steps * fixedPercent); var left = steps * fix
