function exists (value) { return x != null ? Promise.resolve(value) : Promise.reject(`Invalid value: ${value}`) }