UNPKG

nodejs-polars

Version:

Polars: Blazingly fast DataFrames in Rust, Python, Node.js, R and SQL

37 lines (36 loc) 935 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Field = void 0; class Field { name; dtype; constructor(name, dtype) { this.name = name; this.dtype = dtype; } toString() { return `Field("${this.name}", ${this.dtype})`; } toJSON() { return { name: this.name, dtype: this.dtype, }; } [Symbol.for("nodejs.util.inspect.custom")]() { return this.toJSON(); } } exports.Field = Field; (function (Field) { function from(nameOrObj, dtype) { if (typeof nameOrObj === "string" && dtype) { return new Field(nameOrObj, dtype); } if (Array.isArray(nameOrObj)) { return new Field(nameOrObj[0], nameOrObj[1]); } return new Field(nameOrObj.name, nameOrObj.dtype); } Field.from = from; })(Field || (exports.Field = Field = {}));