This weeks challenge is to write a so called "Pattern Chaser".
JavaScript
Expose a function called bnt.patternChaser(str) to the global namespace which takes one string as a parameter and returns "yes [found pattern]" or "no null".
| let fs = require("fs-jetpack"), | |
| path = require("path"), | |
| inline = require("inline-css"); | |
| // This inlines the css of the HTML coverage output as VSTS | |
| // strips all external CSS files | |
| const CODE_COVERAGE_DIRECTORY = "./coverage"; | |
| const files = fs.find(CODE_COVERAGE_DIRECTORY, { matching: "*.html" }); |
| var win = window; | |
| a(); | |
| function a(exports) { | |
| console.log('Loading'); | |
| exports = win; | |
| console.log('exports',exports); | |
| // | |
| // Array utilities | |
| // |
| // Welcome! require() some modules from npm (like you were using browserify) | |
| // and then hit Run Code to run your code on the right side. | |
| // Modules get downloaded from browserify-cdn and bundled in your browser. | |
| var ko = require('knockout'), | |
| knockoutSecureBinding = require('knockout-secure-binding'); | |
| var options = { | |
| attribute: "data-bind", // default "data-sbind" | |
| globals: window, // default {} | |
| bindings: ko.bindingHandlers, // default ko.bindingHandlers |
| var Mysql = module.exports = function (conf) { | |
| var poolConfig = { | |
| name: 'mysql', | |
| create: this._createConnection.bind(this), | |
| destroy: this._destroyConnection, | |
| max: 10 | |
| }; | |
| this._conf = conf; | |
| this._pool = pool.Pool(poolConfig); |
| SendGridClient.prototype.send = function (message, parameters) { | |
| var deferred = when.defer(); | |
| when(parameters, | |
| this._sendEmail.bind(this, deferred, message), | |
| function (error) { | |
| deferred.reject(error); | |
| } | |
| ); |
| SendGridClient.prototype.send = function (message, parameters) { | |
| var deferred = when.defer(), | |
| guid = this.guidGen(), | |
| sendGrid = this._sendGrid; | |
| when(parameters, | |
| function (parameters) { | |
| var email = new SendGridEmail(parameters); | |
| if (message.get("categories")) { |