UNPKG

@eagleoutice/flowr-dev

Version:

Static Dataflow Analyzer and Program Slicer for the R Programming Language

38 lines 1.69 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.FlowrAnalyzerRdaFilePlugin = void 0; const flowr_analyzer_file_plugin_1 = require("./flowr-analyzer-file-plugin"); const semver_1 = require("semver"); const flowr_file_1 = require("../../context/flowr-file"); const built_in_source_1 = require("../../../dataflow/internal/process/functions/call/built-in/built-in-source"); const flowr_rda_file_1 = require("./files/flowr-rda-file"); const RdaFilePattern = /\.(rda|rdata)$/i; /** * This plugin provides support for R workspace files (`.rda`/`.RData`), exposing their top-level objects. * @see https://rdrr.io/r/base/load.html */ class FlowrAnalyzerRdaFilePlugin extends flowr_analyzer_file_plugin_1.FlowrAnalyzerFilePlugin { name = 'flowr-analyzer-rda-file-plugin'; description = 'Reads RDA/RData workspace files into their contained R objects.'; version = new semver_1.SemVer('0.1.0'); pattern; /** * Creates a new instance of the RDA file plugin. * @param filePattern - The pattern to identify RDA files, see {@link RdaFilePattern} for the default pattern. */ constructor(filePattern = RdaFilePattern) { super(); this.pattern = filePattern; } applies(file) { return this.pattern.test((0, built_in_source_1.platformBasename)(file.toString())); } /** * Processes the given file, assigning it the {@link FileRole.Data} role. */ process(_ctx, file) { return flowr_rda_file_1.FlowrRDAFile.from(file, flowr_file_1.FileRole.Data); } } exports.FlowrAnalyzerRdaFilePlugin = FlowrAnalyzerRdaFilePlugin; //# sourceMappingURL=flowr-analyzer-rda-file-plugin.js.map