Code Monkey home page Code Monkey logo

Comments (3)

JMPerez avatar JMPerez commented on June 20, 2024

Definitively! It would be way more resilient if instead of accessing per position it did it through the header column name. LinkedIn changes their format from time to time and they don't seem to document this publicly, which makes it hard to keep the project up to date.

I'm re-requesting my data to make the fix. If you feel like making it yourself, feel free to send a PR.

from linkedin-to-json-resume.

JMPerez avatar JMPerez commented on June 20, 2024

Fixed on c800085

from linkedin-to-json-resume.

jcalbert avatar jcalbert commented on June 20, 2024

Hm. I don't actually know javascript, but I was messing around and it looks like this works. I've only tested it with the basic Profile info though

function camelize(str) {
  return str.replace(/(?:^\w|[A-Z]|\b\w|\s+)/g, function(match, index) {
    if (+match === 0) return ""; // or if (/\s+/.test(match)) for white spaces
    return index == 0 ? match.toLowerCase() : match.toUpperCase();
  });
};

function arrToKVP(arr) {
  var rows = [];
  for (rownum = 1; rownum < arr.length - 1; ++rownum){
    var thisrow = {};
    for (colnum = 0; colnum < arr[0].length; ++colnum){
      thisrow[camelize(arr[0][colnum])] = arr[rownum][colnum];
    }
    rows.push(thisrow);
  }
  if (rows.length > 1){
    return rows;
  } else {
    return rows[0];
  }
};

it takes one of the arrays from csvtoarray and returns either an object or array of objects based on a camel-cased version of the column headers. The relevant in the getEntries function then becomes

            case (entry.filename.indexOf('Profile.csv') !== -1):
              return readEntryContents(entry).then(contents => {
                const profile = arrToKVP(csvToArray(contents));
                linkedinToJsonResume.processProfile(profile);
                return;
              });

from linkedin-to-json-resume.

Related Issues (16)

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.