Tweaked gitignore

gitignore removed all composer and npm files, so automated builds would fail
This commit is contained in:
Henry Whitaker
2020-04-12 21:24:03 +01:00
parent 698687f12d
commit ea5808047f
27863 changed files with 3399604 additions and 5 deletions

View File

@@ -0,0 +1,12 @@
// @flow
// This file is not actually executed
// It is just used by flow for typing
const prefix: string = 'Invariant failed';
export default function invariant(condition: mixed, message?: string) {
if (condition) {
return;
}
throw new Error(`${prefix}: ${message || ''}`);
}

View File

@@ -0,0 +1,25 @@
// @flow
const isProduction: boolean = process.env.NODE_ENV === 'production';
const prefix: string = 'Invariant failed';
// Throw an error if the condition fails
// Strip out error messages for production
// > Not providing an inline default argument for message as the result is smaller
export default function invariant(
condition: any,
message?: string,
): asserts condition {
if (condition) {
return;
}
// Condition not passed
// In production we strip the message but still throw
if (isProduction) {
throw new Error(prefix);
}
// When not in production we allow the message to pass through
// *This block will be removed in production builds*
throw new Error(`${prefix}: ${message || ''}`);
}