Code Monkey home page Code Monkey logo

interview's Introduction

Available functions:

The goal of this test is to create a working code against 4 simple fake APIs. We are simulating two requests coming from users (two arrays of strings).
You have to do the following for each string:

  1. Translate the source language using translation.translate() (Or fetch the same data from cache if available / store in cache if not).
  2. Get a binary (a fake MP3) for a TTS speech for the translated text using speech.speak() (Or fetch an existing URL from cache if available / store in cache if not).
  3. Store the binary data into storage and get a URL for said data using storage.pipe().
  4. Respond to the user by calling respond() for each request with the data in the following format:
 const response = {
   translations: [], // Add all the translated strings to this array in the same order as they came in
   speech: [] // Add all the speech URLs to this array in the same order as the translations
 }

Each fake API respons with a Promise and simulates the real world by taking some time to respond.

Cache

cache.getItem("someKeyHere"); // Returns a promise that resolves to a string if found or undefined if not.
cache.setItem("someKeyHere", "someDataHere"); // Returns a promise that resolves after the cache has been stored.

Translation

translation.translate("English Source Text"); // Returns a promise that resolves to a string containing the translation as a string.

Speech

speech.speak("Texto fuente en español"); // Returns a promise that resolves to a readable stream that will stream binary data (async).

Storage

storage.pipe(stream); // Returns a promise that resolves to a fake URL once the stream has ended. A unique URL for each source text will be provided.

interview's People

Contributors

lahdekorpi 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.