@bigfootds/bigfootds-shared-data
v1.0.16
Published
Shared data used by more than one service in the BigfootDS system.
Downloads
11
Readme
BigfootDS Shared Microservice Data
This package contains data used across multiple services, handled here in an effort to adhere to "D.R.Y" coding principles.
Links
This package is published to these places:
Installation
This is a scoped package, so its install command looks a little longer than normal. But it means you can guarantee that you'll be getting the package from BigfootDS!
npm install @bigfootds/bigfootds-shared-data
Basic Usage
Import the package and use it as an object:
const bdsSharedData = require('@bigfootds/bigfootds-shared-data');
console.log("Top-level items in the package are:")
console.log(Object.keys(bdsSharedData));
console.log("Items within the WordBlacklists object are:")
console.log(Object.keys(bdsSharedData.WordBlacklists))
Output:
Top-level items in the package are:
[ 'WordBlacklists' ]
Items within the WordBlacklists object are:
[ 'ProfanityWords', 'DeveloperReserved' ]
Use the data appropriately!
let profaneWord = "fuck";
if (bdsSharedData.WordBlacklists.ProfanityWords.includes(profaneWord)){
console.log("Profanity detected: " + profaneWord);
}
Output:
Profanity detected: fuck
Object destructuring syntax is fine to use, too.
const {WordBlacklists} = require('@bigfootds/bigfootds-shared-data');
console.log("Items within the WordBlacklists object are:")
console.log(Object.keys(WordBlacklists))
let profaneWord = "fuck";
if (WordBlacklists.ProfanityWords.includes(profaneWord)){
console.log("Profanity detected: " + profaneWord);
}
Output:
Items within the WordBlacklists object are:
[ 'ProfanityWords', 'DeveloperReserved' ]
Profanity detected: fuck