Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const getLineReader = function () {
- return require('readline').createInterface({
- input: require('fs').createReadStream('data.txt')
- });
- };
- const getSystem = function () {
- const lineReader = getLineReader();
- const services = [];
- lineReader.on('line', function (line) {
- const serviceJSON = JSON.parse(line);
- const tests = serviceJSON.tests.map(test => {
- return new ServiceTest(
- test.id,
- test.name,
- test.criticality);
- });
- const service = new NewService(new UniqueID(), serviceJSON.name, tests, new Timestamp());
- services.push(service);
- console.log(services); // prints Services { _services: [relevant data here] }
- });
- console.log(services); // prints Services { _services: [] }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement