1.1.8 • Published 1 year ago

programming-exercise-juezlti v1.1.8

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

Programming-exercise-juezlti

A simple and efficient way to represent YAPEXIL format as JS objects

N|Solid

YAPEXIL is a JSON format in which the goal is to represent in an orthodoxy manner Programming exercises. This type of representation although efficient could sometimes lead to a complexity that can not be handled by a non-expert in this schema. Therefore this npm package focusing in:

  • Facilitate serialization and deserialization
  • Translation of YAPEXIL formatted exercises to JS object
  • ✨ And more Magics ✨

Examples

Fetching remotely exercise

For loading an exercise placed remotely on the internet do the following:

loadSchemaYAPEXIL().then(() => {
    ProgrammingExercise.loadRemoteExercise(learningObject, {
       'BASE_URL': process.env.BASE_URL,
       'EMAIL': process.env.EMAIL,
       'PASSWORD': process.env.PASSWORD,
        }).then((programmingExercise) => {
            //...stuff
        })
})

First, it is necessary to load the schema to evaluate the JSON that will be fetched. The 'loadSchemaYAPEXIL' method does not generate overhead when called multiple times as this method implements a cache. When the script knows the form of the YAPEXIL Schama it is possible to fetch an exercise in this format by doing 'ProgrammingExercise.loadRemoteExercise'. This method will then load an exercise remotely and expose the exercise as an instance of the ProgrammingExercise class.

Fetching local exercise

The ProgrammingExercise class besides making possible the fetch of remotely exercise also makes it possible to load exercise from your file system. To achieve this just do the following

loadSchemaYAPEXIL().then(() => {
    ProgrammingExercise.deserialize(path_to_zip_folder_exercise), `${learningObject}.zip`)
    .then((programmingExercise) => {
            //...stuff
    }).catch((error) => {
            //...stuff
    })
})

Persisting a remotely exercise

When bandwidth savings or other reasons are needed to persist the exercise, this can be achieved by calling the serialization method on an instance of the Programming Exercise class

programmingExercise.serialize(path_to_folder).then(() => {
    //...stuff
    }).catch((err) => {
    //...stuff
    });
})

Creating an exercise programmatically

In order to create an exercise programmatically, the user needs to have in his possession the correct values that fit the YAPEXIL schema. More information about the schema could be found at YAPEXIL Github

Installation

To install this package you just need to do

npm i programming-exercise-juezlti

License

MIT

Free Software, Hell Yeah!

1.1.8

1 year ago

1.1.7

2 years ago

1.1.6

2 years ago

1.1.5

2 years ago

1.1.4

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5-a

2 years ago

1.0.5

2 years ago

1.0.4-d

2 years ago

1.0.4-a

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago