Skip to content
This repository was archived by the owner on Jul 15, 2020. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion SCHEMA.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ into this...

| key | value | description |
| ---------------- | :------ | :--------------------------------------------------------------------------------------------- |
| geometry | string | geometry type MapCSS is intended to match |
| geometry | array | geometry type MapCSS is intended to match |
| equals | object | object with key/value pair MapCSS is intended to match |
| notEqual | string | object with key/value pair MapCSS is not intended to match |
| presence | string | tag key MapCSS is intended to match |
Expand Down
2 changes: 1 addition & 1 deletion dist/classes/regexType/geometry/constants.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/classes/regexType/geometry/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion schema/primitives/feature.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ const Joi = require('joi');
const GEOMETRY = new RegExp(require('../../source/classes/regexType/geometry/constants').GEOMETRY);

module.exports = {
geometry: Joi.string().regex(GEOMETRY),
geometry: Joi.array().items(Joi.string().regex(GEOMETRY)),
tags: Joi.object()
};
2 changes: 1 addition & 1 deletion schema/primitives/geometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
const Joi = require('joi');
const GEOMETRY_SCHEMA = new RegExp(require('../../source/classes/regexType/geometry/constants').GEOMETRY_SCHEMA);

module.exports = { geometry: Joi.string().regex(GEOMETRY_SCHEMA) };
module.exports = { geometry: Joi.array().items(Joi.string().regex(GEOMETRY_SCHEMA)) };
8 changes: 5 additions & 3 deletions source/classes/regexType/geometry/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ const _NODE = 'node';
const _WAY = 'way';
const _CLOSEDWAY = ':closed';
const _CLOSEDWAY_FULL = 'closedway';
const _WILDCARD = '\\*';

exports.NODE = new RegExp(_NODE);
exports.WAY = new RegExp(_WAY);
exports.CLOSEDWAY = new RegExp(_CLOSEDWAY);
exports.CLOSEDWAY_FULL = new RegExp(_CLOSEDWAY_FULL);
exports.WILDCARD = new RegExp(_WILDCARD);

exports.GEOMETRY_GROUPS = `${_NODE}|${_WAY}|${_CLOSEDWAY}`;
exports.GEOMETRY_GROUPS = `${_NODE}|${_WAY}|${_CLOSEDWAY}|${_WILDCARD}`;

exports.GEOMETRY = new RegExp(`^${_NODE}$|^${_WAY}$|^${_CLOSEDWAY}$`, 'i');
exports.GEOMETRY_SCHEMA = new RegExp(`^${_NODE}$|^${_WAY}$|^${_CLOSEDWAY_FULL}$`, 'i');
exports.GEOMETRY = new RegExp(`^${_NODE}$|^${_WAY}$|^${_CLOSEDWAY}$|^${_WILDCARD}$`, 'i');
exports.GEOMETRY_SCHEMA = new RegExp(`^${_NODE}$|^${_WAY}$|^${_CLOSEDWAY_FULL}$|^${_WILDCARD}$`, 'i');
2 changes: 1 addition & 1 deletion source/classes/regexType/geometry/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class GeometryType extends RegexType {
return geometryTypeFromSource(super.getMatches(source)[0]);
}
getPrimitive(source) {
return { geometry: this.getMatches(source) };
return { geometry: [this.getMatches(source)] };
}
}

Expand Down
3 changes: 2 additions & 1 deletion test/classes/regexType/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ const GEOMETRY_GROUPS = require('../../../source/classes/regexType/geometry/cons
const NODE = require('../../../source/classes/regexType/geometry/constants').NODE;
const WAY = require('../../../source/classes/regexType/geometry/constants').WAY;
const CLOSEDWAY = require('../../../source/classes/regexType/geometry/constants').CLOSEDWAY;
const GEOMS = [NODE, WAY, CLOSEDWAY];
const WILDCARD = require('../../../source/classes/regexType/geometry/constants').WILDCARD;
const GEOMS = [NODE, WAY, CLOSEDWAY, WILDCARD];

const GREATER_THAN = require('../../../source/classes/regexType/selector/constants').GREATER_THAN;
const GREATER_THAN_EQUAL = require('../../../source/classes/regexType/selector/constants').GREATER_THAN_EQUAL;
Expand Down
1 change: 1 addition & 0 deletions test/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ describe('helpers', () => {
expect(helpers.geometryTypeFromSource(':closed')).to.eql('closedway');
expect(helpers.geometryTypeFromSource('node')).to.eql('node');
expect(helpers.geometryTypeFromSource('way')).to.eql('way');
expect(helpers.geometryTypeFromSource('*')).to.eql('*');
});
});
});
3 changes: 3 additions & 0 deletions testData/test.mapcss
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,7 @@ way[amenity=school]{
}
way[building][height=1] {
throwError: "..."
}
*[amenity][!name] {
throwError: "name required on any amenity"
}