API.md
January 11, 2022 ยท View on GitHub
Table of Contents
get
Get a fixture by name
Parameters
id(String | Number) the id of the fixture as specified in FIXTURES.md
Examples
const mvtf = require('mvt-fixtures');
const fixture = mvtf.get('001');
console.log(fixture.id); // => '001'
console.log(fixture.description); // => ...
console.log(fixture.specification_reference); // => url to Mapbox Vector Tile specification reference
console.log(fixture.buffer); // => Buffer object
console.log(fixture.json); // => json representation of the fixture
Returns Object fixture - a fixture object
each
Loops through all fixtures and provides the fixture object from get()
Parameters
fnfunctionFunction a synchronously running function to execute on each fixture
Examples
const mvtf = require('mvt-fixtures');
const assert = require('assert');
mvtf.each(function(fixture) {
assert.ok(Buffer.isBuffer(fixture.buffer), 'is a buffer');
});