Coder Social home page Coder Social logo

node-coding-exercise's Introduction

Remove Duplicates From Mock Knack Application Schema

Knack is a no-code platform that includes an online database. Knack users will at times, through unexpected API usage or an unknown bug, corrupt their application schemas. One common issue they may run into is having duplicate fields and/or objects in their application schema. These duplicates cannot be removed by the Knack UI and lead to TypeErrors and other problems.

The purpose of this coding exercise is to create a Node.js application that can programmatically remove all duplicate fields and objects from the given mock application schema and output a new sanitized version.

The "mock_application.json" file in this repository contains data which represents an actual Knack application schema including all currently existing properties. Your code should process the data, remove any duplicates, and output a new JSON file "clean_application.json" which retains all other properties of the Knack application.

Within a standard Knack application there is a versions property which has 2 collections:

  1. objects: an array of Knack "objects" which contains "fields"
  2. scenes: an array of Knack "scenes" which contains "views"

Installation

  • Make sure you are using the latest NodeJS (Currently v19.6.0)
  • Clone this repository
  • From the project directory, run either yarn or npm install
  • To build the application, run yarn build or npm run build
  • If you want to make changes to the code, you can run yarn watch or npm run watch to have the build update when you save changes

Using the application

  • To de-dupe a Knack Application Schema:
    • From the command line, run yarn dupefix ./mock_application.json ./clean_application.json or the npm equivalent
    • Optionally, you can add the --debug flag to the command to see ouput of the results during the process

Examples:

yarn dupefix ./mock_application.json ./clean_application.json OR yarn dupefix ./mock_application.json ./clean_application.json --debug OR yarn dupefix - Will output a Usage message with help on how to run the script

Testing the application

  • From the project root directory, run yarn test or npm run test
  • Tests are written using Jest

node-coding-exercise's People

Contributors

stevepeart avatar

Watchers

 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.