This has been moved to https://github.com/jamiebuilds/proposal-object-has
// Destructuring works on arrays, sets, object, but not maps. | |
// | |
// Today [array, destructuring] works on sets because it | |
// uses [Symbol.iterator] | |
// | |
// But {object, destructuring} *can't* call and iterator | |
// because it doesn't have an order to work with. | |
// | |
// But this difference can lead to confusion for beginners, | |
// and makes maps less usable for everyone. |
// Synchronously check if a promise has already been fulfilled | |
Promise.isFulfilled(promise) | |
// >> true | false | |
// This allow you to make decisions synchronously | |
if (Promise.isFulfilled(promise)) { | |
// We know we're not taking a "risk" awaiting this promise | |
await promise | |
} else { | |
// i.e. Avoid "flash of loading spinner" |
// Syntax proposal: | |
spawn { | |
await somethingAsync() | |
} | |
// `spawn` would be available wherever `await` is available | |
async function fn() { | |
await somethingAsync() | |
spawn { /* ... */ } | |
} |
declare interface CSS { | |
layoutWorklet: Worklet // eslint-disable-line no-undef | |
paintWorklet: Worklet // eslint-disable-line no-undef | |
animationWorklet: Worklet // eslint-disable-line no-undef | |
} | |
declare type ChildDisplay = "block" | "normal" | |
declare type LayoutSizingMode = "block-like" | "manual" | |
declare interface LayoutOptions { |
async function validatePassword(password: string): string[] { | |
let errors = [] | |
// 1. Don't regex for things you can trivially express in code | |
// ----------------------------------------------------------- | |
// For example, we could have written this as `/^.{0,7}$/` but that's not | |
// nearly as clear as checking the length of the string. | |
if (password.length < 8) { | |
errors.push("Password must be at least 8 characters long") |
// Builds array of everything ahead of time | |
function collectAllItems() { | |
return [calculateFirst(), calculateSecond(), ...] | |
} | |
// This loop will end as soon as `isMatch(item)` is truthy. | |
// If the very first item in the array is a match, then we | |
// wasted all this time building the array in the first place. | |
for (let item of collectAllItems()) { | |
if (isMatch(item)) { |
Today is the start of Pride Month. I know this is not how many of you wanted to spend this month. But it's important that we remember that Black people have been an inseparable part of Pride since the very beginning. And now is the time for solidarity.
In recent years, Pride has seen a lot of gentrification. Pride has become whiter, straighter, more corporate, and importantly: more policed. In effort to make some people more comfortable, the enormous presence of cops at Pride has made many others feel unwelcome and unsafe. Disproportionately affecting the Black members of our community.
For the white members of Pride: Solidarity means making yourself uncomfortable. White Guilt and White Fragility often mean we as white people defer to authority figures to fix the problems Black people face. But many of the problems are in those authority figures, and they have shown they will not fix themselves.
This Pride we are proud of the Black history of Pride. We are proud of the Black members of our community.
Blac