aldi-wrapper
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

Aldi API Wrapper

NPM version NPM license NPM dependencies

npm installnfo

Unofficial Node.js API wrapper for the Dutch Aldi.

Installation

npm install aldi-wrapper

or

yarn add aldi-wrapper

then

import { Aldi } from 'aldi-wrapper';

Basic usage

// Creates Aldi object, set verbose to true to see all requests
const aldi = new Aldi({ verbose: true });
// Gets products by name
const products = await aldi.product().getProductsFromName('melk');

More information about the functions and parameters can be found on the wiki

Example usage

For all of these examples, please keep in mind that your function in which you request something should be async since the requests return a Promise.

Product

If I want to find all product names that match a given query:

import { Aldi } from 'aldi-wrapper';

async function findProducts(productName: string) {
    const aldi = new Aldi();
    const products = await aldi.product().getProductsFromName(productName);
    console.log(
        products.articles.map((article) => {
            return article.title;
        })
    );
}

findProducts('karnemelk');
[ 'Karnemelk ', 'Biologische karnemelk', 'Karnemelkdessert' ]

Recipe

If I want to find all recipe names that match a given query:

import { Aldi } from 'aldi-wrapper';

async function findRecipes(recipeName: string) {
    const aldi = new Aldi();
    const recipes = await aldi.recipe().getRecipesFromName(recipeName);
    console.log(
        recipes.recipes.map((recipe) => {
            return recipe.title;
        })
    );
}

findRecipes('pizza');
[
  'Pizza rolls gevuld met kip',
  'Pizza met gehakt',
  'Homemade pizza',
  'Pizza met ansjovis',
  'Gezonde Sinterklaas-snack: pizza toast met verstopte groenten',
  'Pizza van Turks brood met hummus en gefrituurde aubergine',
  'Vegetarische pizza',
  'Mini bladerdeegpizza’s met tomatensaus, kaas en basilicum',
  'Vier soorten zelfgemaakte bladerdeeghapjes '
]

Package Sidebar

Install

npm i aldi-wrapper

Weekly Downloads

25

Version

1.0.0

License

MIT

Unpacked Size

20.5 kB

Total Files

21

Last publish

Collaborators

  • rinsev