Code Monkey home page Code Monkey logo

i_saw_it_first's Introduction

I SAW IT FIRST - Back-end Test

To get the product data from the API I used the request package as its one that I have used in the past and started manipulating the data for the tasks once the data had been received.As I had not dealt with creating csv or xlsx files before I new that research would be necessary to find the right tools for the job.

i. Generate a CSV file from the data with the following columns: ID, Title, Product Type, Vendor, Variants IDS.

To begin this task I looked for a package that could create a csv file from the JSON provided. Json2csv stood out to me and after reading some of the documentation I was able to create a reusable function for creating csv's as this would be necessary for the 4th task. A csv file would be generated given the correct fields and data.

ii. Generate an array and log it to the console contain the following info: Product Image URL, Product Image Height, Product Image Width and an overall count of total images.

Looped over the objects containing the required product information and push them to a new array I had created. I did this for the Images and image objects. This method seems to work however I believe that there is a more efficient approach.

iii. Generate an XLSX file containing the Product Titles and Descriptions

Investigated different packages for sending data to an excel file. After looking through npm and StackOverflow the package excel4node seemed like a good fit for the job and easy to work with. I began by looping through the data extracting the product titles and descriptions, pushing into arrays for each. I then looped through the arrays inserting them into the columns/rows.

iv. Generate a CSV of all the product tags combined, with duplicates removed

I began this task by looping over the tags for each product and pushing them to an array. I then joined and split the array in order to have all of the data as strings so that removing duplicates with the Set object would be possible. Using the function I had created in the first task I then used this tag data to insert into the function to create a csv file.

i_saw_it_first's People

Contributors

theollieb avatar

Watchers

James Cloos avatar

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.