// npm 패키지
@antv/data-set
data set with state management
버전
44
메인테이너
51
라이선스
MIT
최초 publish
2017-07-17
publisher
atool
tarball
5,228,389 B
AUTO-PUBLISHED·1개 버전 인덱싱됨·최근 publish: 2021-02-01
// publisher 캠페인by atool
이 계정에서 catch된 패키지 9건고립된 catch가 아닙니다. 동일 publisher가 8개의 다른 패키지를 추가로 발행했고, 모두 파이프라인이 catch했습니다 — 일회성이 아닌 조직적 캠페인의 형태. 아래 링크는 각 형제 catch의 분석으로 이동합니다.
// offending code· @0.11.8· 2 files flagged
- @0.11.8··AUTO-PUBLISHED·publisher: atoolheuristic 75/100static flags 1llm skippedmature-packageosv-flagged:MAL-2026-3868child-process-spawn
// offending code· 2 files flaggedpatterns: 1
--- install scripts --- ### prepublishOnly npm run build-lib && npm run build && npm run dist --- package/src/view.ts (excerpt) --- import EventEmitter from 'wolfy87-eventemitter'; import { assign, clone, deepMix, find, forIn, isArray, isPlainObject, isMatch, isObject, isString, keys, pick, } from '@antv/util'; import { DataSet } from './data-set'; import { StatisticsApi } from './api/statistics'; import { PartitionApi } from './api/partition'; import { HierarchyApi } from './api/hierarchy'; import { GeoApi } from './api/geo'; import { TransformsParams } from './transform-params'; import { ConnectorParams } from './connector-params'; function cloneOptions(options: any): any { const result: any = {}; forIn(options as any, (value: any, key: string) => { if (isObject(value) && (value as any).isView) { result[key] = value; } else if (isArray(value)) { result[key] = value.concat([]); } else if (isPlainObject(value)) { result[key] = clone(value); } else { result[key] = value; } }); return result; } export interface ViewOptions { watchingStates?: string[]; } type TransformOptions<T extends keyof TransformsParams = any> = { type: T } & TransformsParams[T]; type ConnectorOptions<T extends keyof ConnectorParams = any> = { type: T } & ConnectorParams[T][1]; interface CustomSource { source: any; options: any; } /** * 数据视图 * @public */ export class View extends EventEmitter { static DataSet: typeof DataSet; /** * 关联的数据集 */ dataSet: DataSet | null; /** * 是否关联了数据集 */ loose: boolean; /** * 是否是View */ --- package/lib/view.js (excerpt) --- "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.View = void 0; var tslib_1 = require("tslib"); var wolfy87_eventemitter_1 = tslib_1.__importDefault(require("wolfy87-eventemitter")); var util_1 = require("@antv/util"); function cloneOptions(options) { var result = {}; util_1.forIn(options, function (value, key) { if (util_1.isObject(value) && value.isView) { result[key] = value; } else if (util_1.isArray(value)) { result[key] = value.concat([]); } else if (util_1.isPlainObject(value)) { result[key] = util_1.clone(value); } else { result[key] = value; } }); return result; } /** * 数据视图 * @public */ var View = /** @class */ (function (_super) { tslib_1.__extends(View, _super); function View(dataSet, options) { var _this = _super.call(this) || this; /** * 是否是View */ _this.isView = true; /** * 是否是View */ _this.isDataView = true; // alias /** * */ _this.watchingStates = null; /** * 数据视图类型 */ _this.dataType = 'table'; /** * 已应用的 transform */ _this.transforms = []; /** * 原始数据 */ _this.origin = []; /** * 存储处理后的数据 */ _this.rows = []; if (dataSet && dataSet.isDataSe --- bundled output (OSV-MAL flagged — LLM scope expansion) --- --- lib/connector-params.js (bundled) --- "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); --- lib/transform-params.js (bundled) --- "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); --- lib/util/euclidean-distance.js (bundled) --- "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); /* * @reference: https://github.com/zeke/euclidean-distance */ exports.default = (function (a, b) { var sum = 0; var n; for (n = 0; n < a.length; n++) { sum += Math.pow(a[n] - b[n], 2); } return Math.sqrt(sum); }); --- lib/util/get-geo-projection.js (bundled) --- "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var tslib_1 = require("tslib"); var util_1 = require("@antv/util"); var d3Geo = tslib_1.__importStar(require("d3-geo")); var d3GeoProjection = tslib_1.__importStar(require("d3-geo-projection")); var d3CompositeProjection = tslib_1.__importStar(require("d3-composite-projections")); /* * getGeoProjection * * @param {string|function} projection projection name or projection function * @param {boolean} [exportRaw = false] - whether return the raw projection or not * */ exports.default = (function (projection, exportRaw) { if (exportRaw === void 0) { exportRaw = false; } if (util_1.isFunction(projection)) { return exportRaw ? projection : projection(); } if (util_1.isString(projection)) { // @ts-ignore if (d3Geo[projection]) { // @ts-ignore return exportRaw ? d3Geo[projection] : d3Geo[projection](); } if (d3GeoProjection[projection]) { return exportRaw ? d3GeoProjection[projection] : d3GeoProjection[projection](); } if (d3CompositeProjection[projection]) { return exportRaw ? d3CompositeProjection[projection] : d3CompositeProjection[projection](); } } return null; }); --- lib/util/get-series-values.js (bundled) --- "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var tslib_1 = require("tslib"); exports.default = (function (extent, bw) { var bandwidth = bw || 1; var _a = tslib_1.__read(extent, 2), min = _a[0], max = _a[1]; var values = []; var tmp = min; while (tmp < max) { values.push(tmp); tmp += bandwidth; } values.push(max); return values; }); --- lib/util/option-parser.js (bundled) --- "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getFields = exports.getField = void 0; var util_1 = require("@antv/util"); var INVALID_FIELD_ERR_MSG = 'Invalid field: it must be a string!'; var INVALID_FIELDS_ERR_MSG = 'Invalid fields: it must be an array!'; function getField(options, defaultField) { var field = options.field, fields = options.fields; if (util_1.isString(field)) { return field; } if (util_1.isArray(field)) { console.warn(INVALID_FIELD_ERR_MSG); return field[0]; } console.warn(INVALID_FIELD_ERR_MSG + " will try to get fields instead."); if (util_1.isString(fields)) { return fields; } if (util_1.isArray(fields) && fields.length) { return fields[0]; } if (defaultField) { return defaultField; } throw new TypeError(INVALID_FIELD_ERR_MSG); } exports.getField = getField; function getFields(options, defaultFields) { var field = options.field, fields = options.fields; if (util_1.isArray(fields)) { return fields; } if (util_1.isString(fields)) { console.warn(INVALID_FIELDS_ERR_MSG); return [fields]; } console.warn(INVALID_FIELDS_ERR_MSG + " will try to get field instead."); if (util_1.isString(field)) { console.warn(INVALID_FIELDS_ERR_MSG); return [field]; } if (util_1.isArray(field) && field.length) { console.warn(INVALID_FIELDS_ERR_MSG); return field; } if (defaultFields) { return defaultFields; } throw new TypeError(INVALID_FIELDS_ERR_MSG); } exports.getFields = getFields; --- lib/util/p-by-fraction.js (bundled) --- "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = (function (fraction) { var step = 1 / fraction; var pArr = []; for (var i = 0; i <= 1; i = i + step) { pArr.push(i); } return pArr; }); --- lib/connector/geo-graticule.js (bundled) --- "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var d3_geo_1 = require("d3-geo"); var data_set_1 = require("../data-set"); function connector(_options, dataView) { dataView.dataType = 'geo-graticule'; var data = d3_geo_1.geoGraticule().lines(); data.map(function (row, index) { row.index = "" + index; return row; }); dataView.rows = data; return data; } exports.default = connector; data_set_1.DataSet.registerConnector('geo-graticule', connector);
