Skip to content

Instantly share code, notes, and snippets.

@FelDev
Last active October 26, 2019 21:18
Show Gist options
  • Save FelDev/dad7aa81951bb130bb597c03e417cfaa to your computer and use it in GitHub Desktop.
Save FelDev/dad7aa81951bb130bb597c03e417cfaa to your computer and use it in GitHub Desktop.
// ai.js
module.exports = function unleashAdvancedAI(pathToTextInput) {
let fs = require("fs")
return new Promise(function(resolve, reject) {
try {
let content = fs.readFileSync(pathToTextInput, 'utf8')
// Intensive Artificial Intelligence Processing
if (content.indexOf('🙂') > -1) {
resolve('This human is happy')
}
else if (content.indexOf('🙁') > -1) {
resolve('This human is sad')
}
else {
resolve('Look, AI is not magic.')
}
} catch (error) {
console.log('@error: ', error);
reject(error)
}
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment