Skip to content

Commit

Permalink
Fixed typos, corrected some null values
Browse files Browse the repository at this point in the history
  • Loading branch information
wiazur authored Oct 5, 2019
1 parent b0b2cf8 commit 6e80f8b
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions Samples/imageSearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,17 @@ const Search = require('azure-cognitiveservices-search');
const CognitiveServicesCredentials = require('ms-rest-azure').CognitiveServicesCredentials;

// Add your Bing Search V7 subscription key to your environment variables.
let keyVar = process.env['BING_SEARCH_V7_SUBSCRIPTION_KEY']
let subscriptionKey = process.env['BING_SEARCH_V7_SUBSCRIPTION_KEY']

if (!process.env[keyVar]) {
throw new Error('please set/export the following environment variable: ' + keyVar);
if (subscriptionKey == null || subscriptionKey == "" || subscriptionKey == undefined) {
throw new Error('please set/export the following environment variable: ' + subscriptionKey);
}

let serviceKey = process.env[keyVar];


///////////////////////////////////////////
// Entrypoint for sample script //
///////////////////////////////////////////

let credentials = new CognitiveServicesCredentials(serviceKey);
let credentials = new CognitiveServicesCredentials(subscriptionKey);
let imageSearchApiClient = new Search.ImageSearchAPIClient(credentials);

function sample() {
Expand Down Expand Up @@ -258,5 +255,5 @@ function sample() {
throw (err);
});
}

sample()
exports.sample = sample;

0 comments on commit 6e80f8b

Please sign in to comment.