<Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>
-
URL
<The URL Structure (path only, no root url)>
-
Method:
| // Import modules | |
| const crypto = require('crypto'); | |
| /** | |
| * Sample module showing suggested order of declaration for module members in Node.js | |
| * | |
| * Suggested order: | |
| * - Constants before Properties before Methods | |
| * - Public before Private | |
| * |
| <?php | |
| namespace Vendor\Package; | |
| // Class-based imports | |
| use AnotherVendor\AnotherPackage; | |
| use Vendor\Package\FirstTrait; | |
| use Vendor\Package\ParentPackage; | |
| use InvalidArgumentException; |
| /** | |
| * Output date in local timezone with ISO 8601 format | |
| * | |
| * @link Adapted from https://stackoverflow.com/a/17415677 | |
| * @param {Date} date | |
| * @returns {string} | |
| */ | |
| function getIsoDateLocal(date) { | |
| let tz = 0 - date.getTimezoneOffset(); | |
| let sign = (tz >= 0) ? '+' : '-'; |
| /** | |
| * Add async declaration so that caller knows explictly to use await with it. | |
| * | |
| * @link https://bluepnume.medium.com/learn-about-promises-before-you-start-using-async-await-eb148164a9c8 | |
| */ | |
| async function sendRequest() { | |
| let promise = new Promise((resolve, reject) => { | |
| // To make it easier for caller, don't use reject() which requires | |
| // caller to add catch block. Use resolve() for both successful | |
| // responses and errors, e.g. |
TIL in Swift, s in let s = optionalString will be unwrapped when used with if and guard.
var possibleString: String?
possibleString = "Hello"
/* if without unwrap */
let s = possibleString
if (s != nil) {
print(s) // Optional("Hello")