This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var textToBeModified = "lolfoo123456789"; | |
| var replaceRule = new ReplaceRule | |
| { | |
| RegexPattern = @"(?<=foo)\d{3}", | |
| ReplacementText = "bar" | |
| }; | |
| var replaceRule2 = new ReplaceRule | |
| { | |
| RegexPattern = @"(?<=foo\d{3})\d+", | |
| ReplacementText = "000" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var textToBeModified = "lolfoo123456789"; | |
| var replaceRule = new ReplaceRule | |
| { | |
| RegexPattern = @"(?<=foo)\d{3}", | |
| ReplacementText = "bar" | |
| }; | |
| var replaceRule2 = new ReplaceRule | |
| { | |
| RegexPattern = @"(?<=foo\d{3})\d+", | |
| ReplacementText = "000" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var textToBeModified = "lolfoo123456789"; | |
| var replaceRule = new ReplaceRule | |
| { | |
| RegexPattern = @"(?<=foo)\d{3}", | |
| ReplacementText = "bar" | |
| }; | |
| var replaceResult = Regex.Replace(textToBeModified, replaceRule.RegexPattern, replaceRule.ReplacementText, RegexOptions.None); | |
| Console.WriteLine(replaceResult); // lolfoobar45679 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var reqp = require('../request-promise'); | |
| describe('sample tests:', function() { | |
| it('promise correct', function() { | |
| return reqp.get('http://www.example.com/404').then(function(res) { | |
| assert.equal(200, res.statusCode); | |
| }) | |
| }); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var reqp = require('../request-promise'); | |
| describe('sample tests:', function() { | |
| it('promise', function(done) { | |
| reqp.get('http://www.example.com/').then(function(res) { | |
| assert.equal(200, res.statusCode); | |
| done(); | |
| }) | |
| }); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var http = require('http'); | |
| var httpRequest = { | |
| get: url => { | |
| return (new Promise(function(resolve, reject) { | |
| http.get(url, res => { | |
| resolve(res); | |
| }); | |
| })); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| describe('sample tests:', function() { | |
| it('callback', function(done) { | |
| http.get('http://www.example.com', function(res) { | |
| assert.equal(200, res.statusCode); | |
| done(); | |
| }); | |
| }); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Foo { | |
| constructor() { | |
| this.baz = "baz"; | |
| this.doStuff = this.doStuff.bind(this); | |
| } | |
| doStuff() { | |
| console.log(this.baz); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let foo = new Foo(); | |
| setTimeout(foo.doStuff, 500) // Logs undefined |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let foo = new Foo(); | |
| foo.doStuff() // Logs "baz" as expected. |