2.1.0 • Published 4 years ago

springboard-pagination-tool v2.1.0

Weekly downloads
-
License
ISC
Repository
-
Last release
4 years ago

springboard-pagination-tool

Iterate over Springboard Retail paginated collections.

Example

const { iterate, getAll } = require('./index'); // You would write: springboard-pagination-tool

const springboard = {
    subDomain: 'examplestore123',
    token: '123456789'
};

// Iterate over a collection. 
// Useful for larger collections.
iterate(springboard, 'items', (item, cancel) => {
    // Do something for every item.
    
    // Optionally, you can stop the iteration prematurely...
    // Just invoke: cancel();
});

// Save a collection to array.
// Only use on small collections.
(async () => {
    const vendors = await getAll(springboard, 'purchasing/vendors');
    
    for (const vendor of vendors) {
        // Do something for every vendor.
    }

})();