Giter VIP home page Giter VIP logo

text2json's People

Contributors

nilobarp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

text2json's Issues

`end` event not triggered

Input file

There is an empty line at the end

U+2B695 shī
U+2B699 pū
U+2B6DB zhī
U+2B6DE jué
U+2B6E2 níng
U+2B6F6 chì
U+2B6F8 tí

Test

import fs from "fs";
import test from "ava";
import jsonfile from "jsonfile";
import dataminer from "../src/dataminer";

test("extractPronunciation()", t => {
  const filepath = "src/codepoint-ruby.tsv";

  const data = dataminer.convertToJson(filepath, { separator: " " });

  t.is(data > 0);
});

Code

import jsonfile from "jsonfile";
import text2json from "text2json";

export default {
  convertToJson: (filepath, options) => {
    const data = [];
    const parse = new text2json.Parser({ ...options, hasHeader: true });

    parse
      .text2json(filepath)
      .on("row", row => {
        data.push(row);
      })
      .on("end", () => {
        console.log("Done >>>>>");
        return data;
      });
  },
};

Question

I see not trace of the end event being triggered, and the convertToJson() return nothing so my test fail, am I missing something?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.