Use the result of a method as a parameter inside another method

I’d like to take the result of a method and use the result of that in a parameter inside another function. Example: public static async Task<string> GetToken(string User, string Pass) { //do stuff return token; } public static async Task<GraphServiceClient> Auth() { AuthenticationHeaderValue(“bearer”, GetToken()); } Obviously not a working example, but hopefully it gets the…

Details

How to mock window.location.search?

I am trying to grab params from a url, but I can’t tell if it’s working because console.log(window.location.search) on localhost:3000 gives me <empty string> as a value . I have tried mocking it like this, but it doesn’t return the same thing as window.location.search const url = ‘https://www.google.com/search?client=firefox-b-1-d&q=query+string const queryString = url.search console.log(queryString) // function…

Details

Array merge and override

I was wondering if it was possible to merge two arrays and then override the property of the original array. $originalArray = [1,2,3]; $newArray = [ ‘first’ => array_merge($originalArray, [4,5]), ‘second’ => array_merge($originalArray, [6,7]), ]; So what I want to achieve is $originalArray would be [1,2,3], then $newArray[‘first’] would be [1,2,3,4,5] and then $newArray[‘second’] would…

Details