UNPKG

node-djiparsetxt

Version:

command-line application that reads a DJI '.txt' file and outputs a json.

43 lines 1.85 kB
"use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); exports.Records2JsonCommand = void 0; var ServiceManager_1 = require("../common/ServiceManager"); var Command_1 = require("./Command"); var Records2JsonCommand = /** @class */ (function (_super) { __extends(Records2JsonCommand, _super); function Records2JsonCommand() { return _super !== null && _super.apply(this, arguments) || this; } Records2JsonCommand.prototype.exec = function (options) { var serviceMan = this.serviceMan; var cacheTransService = serviceMan.get_service(ServiceManager_1.ServiceTypes.CacheTransform); var recordsCache = options.records; cacheTransService.unscramble(recordsCache); var unscrambledRows = cacheTransService.cache_as_rows(recordsCache); var parsedRows = cacheTransService.rows_to_json(unscrambledRows); var output; if (options.prettyPrint) { output = JSON.stringify(parsedRows, null, 2); } else { output = JSON.stringify(parsedRows); } return output; }; return Records2JsonCommand; }(Command_1.Command)); exports.Records2JsonCommand = Records2JsonCommand; //# sourceMappingURL=Records2JsonCommand.js.map