"use strict"; const generateLookupTable = require("./"); // Thanks to https://gist.github.com/nanotaboada/6396437 for the sample data! let items = [ { name: "Eloquent JavaScript, Second Edition", tags: [ "javascript", "No Starch Press" ] }, { name: "Learning JavaScript Design Patterns", tags: [ "javascript", "O'Reilly Media" ] }, { name: "Speaking JavaScript", tags: [ "javascript", "O'Reilly Media" ] }, { name: "Programming JavaScript Applications", tags: [ "javascript", "O'Reilly Media" ] }, { name: "Understanding ECMAScript 6", tags: [ "javascript", "No Starch Press" ] }, { name: "You Don't Know JS", tags: [ "javascript", "O'Reilly Media" ] }, { name: "Git Pocket Guide", tags: [ "git", "O'Reilly Media" ] }, { name: "Designing Evolvable Web APIs with ASP.NET", tags: [ "asp.net", "O'Reilly Media" ] }, ]; let lookupTable = generateLookupTable(items, (item) => item.tags); console.log(lookupTable.get("git")); /* Output: [ { name: 'Git Pocket Guide', tags: [ 'git', 'O\'Reilly Media' ] } ] */ console.log(lookupTable.get("No Starch Press")); /* Output: [ { name: 'Eloquent JavaScript, Second Edition', tags: [ 'javascript', 'No Starch Press' ] }, { name: 'Understanding ECMAScript 6', tags: [ 'javascript', 'No Starch Press' ] } ] */