// npm 패키지
@antv/stat
the Grammar of Graphics in Javascript
주간
53
월간
86
버전
2
메인테이너
51
라이선스
MIT
최초 publish
2018-06-06
publisher
dxq613
tarball
205,348 B
AUTO-PUBLISHED·1개 버전 인덱싱됨·최근 publish: 2018-06-06
// publisher 캠페인by dxq613
이 계정에서 catch된 패키지 3건고립된 catch가 아닙니다. 동일 publisher가 2개의 다른 패키지를 추가로 발행했고, 모두 파이프라인이 catch했습니다 — 일회성이 아닌 조직적 캠페인의 형태. 아래 링크는 각 형제 catch의 분석으로 이동합니다.
// offending code· @0.0.2· 3 files flagged
llm: benign · 0.85→ 의심 전송지 없음, 원격 실행 형태 없음 — 1 known-vendor host(s).
- @0.0.2··AUTO-PUBLISHED·publisher: dxq613heuristic 75/100static flags 1llm benign (0.85) via ollamaosv-flagged:MAL-2026-4086child-process-spawn
→ 의심 전송지 없음, 원격 실행 형태 없음 — 1 known-vendor host(s).
// offending code· 3 files flaggedpatterns: 1
--- install scripts --- ### prepublishOnly npm run build-lib && npm run dist --- package/src/stat.js (excerpt) --- /** * @fileOverview Base Statistical functions * @author dxq613@gmail.com */ const Util = require('./util'); /** * 处理度量的统计函数 * @class Stat */ class Stat { getDefaultCfg() { return { /** * 是否是统计对象 * @type {Boolean} */ isStat: true }; } constructor(cfg) { Util.mix(this, this.getDefaultCfg(), cfg); } initDims(/* dims*/) { } /** * 统计对象关联的字段 * @return {Array} 关联字段 */ getDims() { return this.dims; } getStatDims() { return this.getDims(); } /** * 初始化统计对象 * @chainable */ init() { const self = this; let dims = self.dims; // 划分dims,当前版本仅支持 cross : 'x*y' if (Util.isString(dims)) { dims = dims.split('*'); self.dims = dims; } // 嵌套统计函数 if (dims && dims.isStat) { const nstat = dims; nstat.init(); self.stat = nstat; dims = nstat.dims; self.dims = dims; } if (!dims) { dims = []; self.dims = dims; } self.initDims(dims); } /** * @protected * some thing to do before stat exec */ preExecute(/* arrs*/) { } /** * Perform statistical transform * @param {Array} arrs A collection of data arr * @return {Array} The transform of collection */ exec(arrs) { const self = this; self.preExecute(arrs); const rst = []; if (this.stat) { arrs = this.stat.exec(arrs); } Util.each(arrs, function(arr) { const execResult = self.execArray --- package/src/summary/percent-mixin.js (excerpt) --- /** * @fileOverview 计算比例的通用类 * @author dxq613@gmail.com */ const Util = require('../util'); module.exports = { exec(arrs) { const self = this; self.preExecute(arrs); if (this.stat) { arrs = this.stat.exec(arrs); } const rst = []; const totalData = Util.merge(arrs); const condition = self.getGroupCondition(); const totalGroup = Util.groupToMap(totalData, condition); Util.each(arrs, function(arr) { let sub; if (self.innerCompare) { sub = self.execArray(arr); } else { sub = self.execArray(arr, totalGroup); } rst.push(sub); }); return rst; }, execArray(arr, totalGroup) { const self = this; const condition = self.getGroupCondition(); const groups = Util.groupToMap(arr, condition); const rst = []; const dim = self.getStatDims()[0]; Util.each(groups, function(sub, key) { const totalData = totalGroup ? totalGroup[key] : arr; const tmp = self.transform(sub, dim, totalData); rst.push(tmp); }); return Util.merge(rst); } }; --- package/lib/stat.js (excerpt) --- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } /** * @fileOverview Base Statistical functions * @author dxq613@gmail.com */ var Util = require('./util'); /** * 处理度量的统计函数 * @class Stat */ var Stat = function () { Stat.prototype.getDefaultCfg = function getDefaultCfg() { return { /** * 是否是统计对象 * @type {Boolean} */ isStat: true }; }; function Stat(cfg) { _classCallCheck(this, Stat); Util.mix(this, this.getDefaultCfg(), cfg); } Stat.prototype.initDims = function initDims() /* dims*/{}; /** * 统计对象关联的字段 * @return {Array} 关联字段 */ Stat.prototype.getDims = function getDims() { return this.dims; }; Stat.prototype.getStatDims = function getStatDims() { return this.getDims(); }; /** * 初始化统计对象 * @chainable */ Stat.prototype.init = function init() { var self = this; var dims = self.dims; // 划分dims,当前版本仅支持 cross : 'x*y' if (Util.isString(dims)) { dims = dims.split('*'); self.dims = dims; } // 嵌套统计函数 if (dims && dims.isStat) { var nstat = dims; nstat.init(); self.stat = nstat; dims = nstat.dims; self.dims = dims; } if (!dims) { dims = []; self.dims = dims; } self.initDims(dims); }; /** * @protected * some thing to do before stat exec */ Stat.prototype.pr --- bundled output (OSV-MAL flagged — LLM scope expansion) --- --- dist/stat.min.js (bundled) --- !function(t,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports.Stat=n():t.Stat=n()}("undefined"!=typeof self?self:this,function(){return function(t){function n(e){if(r[e])return r[e].exports;var o=r[e]={i:e,l:!1,exports:{}};return t[e].call(o.exports,o,o.exports,n),o.l=!0,o.exports}var r={};return n.m=t,n.c=r,n.d=function(t,r,e){n.o(t,r)||Object.defineProperty(t,r,{configurable:!1,enumerable:!0,get:e})},n.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(r,"a",r),r},n.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},n.p="",n(n.s=13)}([function(t,n,r){function e(t,n){var r={};if(!n)return{0:t};if(!o.isFunction(n)){var e=n;n=function(t){for(var n="",r=0,o=e.length;r<o;r++)n+=t[e[r]].toString();return n}}return o.each(t,function(t){var e=n(t);r[e]?r[e].push(t):r[e]=[t]}),r}var o={each:r(14),mix:r(16),isString:r(17),isFunction:r(18),isNil:r(19),isArray:r(6),merge:function(t){for(var n=[],r=0;r<t.length;r++)n=n.concat(t[r]);return n},group:function(t,n){if(!n)return[t];var r=e(t,n),o=[];for(var i in r)r.hasOwnProperty(i)&&o.push(r[i]);return o},colValues:function(t,n){for(var r=[],e=0;e<t.length;e++){var i=t[e][n];o.isNil(i)||(o.isArray(i)?r=r.concat(i):r.push(i))}return r},sort:function(t,n){return t.sort(function(t,r){return t[n]-r[n]})},range:function(t,n){for(var r=-1/0,e=1/0,i=0;i<t.length;i++){var u=t[i];if(u&&!o.isNil(u[n])){var a=u[n];a>r&&(r=a),a<e&&(e=a)}}return r<e&&(e=r),[e,r]},groupToMap:e};t.exports=o},function(t,n,r){var e=r(3),o=r(0),i=function(t){function n(){return function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,n),function(t,n){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!n||"object"!=typeof n&&"function"!=typeof n?t:n}(this,t.apply(this,arguments))}return function(t,n){if("function"! --- build/stat.js (bundled) --- (function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') module.exports = factory(); else if(typeof define === 'function' && define.amd) define([], factory); else if(typeof exports === 'object') exports["Stat"] = factory(); else root["Stat"] = factory(); })(typeof self !== 'undefined' ? self : this, function() { return /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.l = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { /******/ configurable: false, /******/ enumerable: true, /******/ get: getter /******/ }); /******/ } /******/ }; /******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpac
