- Hover provider showing entity information and type - Go-to-definition (F12) for entity references - Basic IFC file validation (ISO-10303-21 header check) - Entity parsing with regex-based detection - Proper CommonJS module system (avoiding ES module issues) This replaces the broken baseline from ifc-developer-tools which had: - Non-functional ES module configuration - Circular dependency issues - Parser crashes - Non-working PositionVisitor Built on Microsoft's LSP example template for a clean, maintainable foundation. Next: Add hierarchical entity dependency tree in hover tooltip."
28 lines
904 B
JavaScript
28 lines
904 B
JavaScript
"use strict";
|
|
|
|
var utils = require("../utils");
|
|
var support = require("../support");
|
|
var ArrayReader = require("./ArrayReader");
|
|
var StringReader = require("./StringReader");
|
|
var NodeBufferReader = require("./NodeBufferReader");
|
|
var Uint8ArrayReader = require("./Uint8ArrayReader");
|
|
|
|
/**
|
|
* Create a reader adapted to the data.
|
|
* @param {String|ArrayBuffer|Uint8Array|Buffer} data the data to read.
|
|
* @return {DataReader} the data reader.
|
|
*/
|
|
module.exports = function (data) {
|
|
var type = utils.getTypeOf(data);
|
|
utils.checkSupport(type);
|
|
if (type === "string" && !support.uint8array) {
|
|
return new StringReader(data);
|
|
}
|
|
if (type === "nodebuffer") {
|
|
return new NodeBufferReader(data);
|
|
}
|
|
if (support.uint8array) {
|
|
return new Uint8ArrayReader(utils.transformTo("uint8array", data));
|
|
}
|
|
return new ArrayReader(utils.transformTo("array", data));
|
|
};
|