From 05001590d3283011905a67b404cd209678ef2a80 Mon Sep 17 00:00:00 2001 From: missinglink Date: Mon, 16 Apr 2018 12:53:35 +0200 Subject: [PATCH] feat(airport_codes): add additional alias `${iata} Airport` --- stream/tag_mapper.js | 1 + test/stream/tag_mapper.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/stream/tag_mapper.js b/stream/tag_mapper.js index 091761f5..ee80fab0 100644 --- a/stream/tag_mapper.js +++ b/stream/tag_mapper.js @@ -67,6 +67,7 @@ module.exports = function(){ var iata = trim( tags.iata ); if( iata ){ doc.setNameAlias( 'default', iata ); + doc.setNameAlias( 'default', `${iata} Airport` ); } } } diff --git a/test/stream/tag_mapper.js b/test/stream/tag_mapper.js index 73bea123..d53e58f9 100644 --- a/test/stream/tag_mapper.js +++ b/test/stream/tag_mapper.js @@ -148,7 +148,7 @@ module.exports.tests.airport_codes = function(test, common) { var stream = mapper(); stream.pipe( through.obj( function( doc, enc, next ){ t.equal(doc.getName('default'), 'test', 'correctly mapped'); - t.deepEqual(doc.getNameAliases('default'), ['FOO'], 'correctly mapped'); + t.deepEqual(doc.getNameAliases('default'), ['FOO', 'FOO Airport'], 'correctly mapped'); t.end(); // test will fail if not called (or called twice). next(); }));