Socket
Socket
Sign inDemoInstall

@mapbox/mvt-fixtures

Package Overview
Dependencies
Maintainers
14
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mapbox/mvt-fixtures - npm Package Compare versions

Comparing version 3.8.0 to 3.9.0

test/create.test.js

4

CHANGELOG.md

@@ -0,1 +1,5 @@

## 3.9.0
* Add `create` method to module, allowing inline fixtures to be created for faster iteration in downstream libraries.
## 3.8.0

@@ -2,0 +6,0 @@

@@ -91,5 +91,19 @@ 'use strict';

/**
* Create a tile buffer inline without referencing a pre-existing fixture
*
* @param {Object} definition - the JSON-style protocol buffer instructions
* @param {Object} [options]
* @param {string} [options.proto="2.1"] - optional vector tile spec version
*/
function create(definition, options) {
if (!definition) throw new Error('No definition provided to mvt-fixtures#create method.');
options = options || {};
return {
buffer: generateBuffer(definition, options.proto || '2.1', options)
}
}
module.exports = {
get: get,
each: each
get, each, create
};

2

package.json
{
"name": "@mapbox/mvt-fixtures",
"version": "3.8.0",
"version": "3.9.0",
"description": "A require-able test fixture suite of valid and invalid Mapbox Vector Tiles",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -45,2 +45,32 @@ ![mvt-fixtures crew](https://c1.staticflickr.com/5/4495/24124229798_b82cd97858_o.png)

const output = decoder(mvtf.get('043').buffer);
// or you can build a fixture inline
const { buffer } = mvtf.create({
layers: [
{
version: 2,
name: 'parks',
features: [
{
id: 10,
tags: [ 0, 0 ], // name: Stanley Park
type: 1, // point
geometry: [ 9, 54, 38 ]
},
{
id: 10,
tags: [ 0, 0 ], // name: Olympic
type: 1, // point
geometry: [ 9, 2, 5 ]
}
],
keys: [ 'name' ],
values: [
{ string_value: 'Stanley Park' },
{ string_value: 'Olympic' }
],
extent: 4096
}
]
}); // ==> Buffer()
```

@@ -47,0 +77,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc