mirror of
https://github.com/neocities/neocities.git
synced 2025-07-22 02:26:07 +02:00
added monaco code to public js folder and removed cdn
This commit is contained in:
parent
165e17f844
commit
4a7483509e
1387 changed files with 1185013 additions and 24 deletions
59
public/js/monaco/esm/vs/base/common/assert.js
Normal file
59
public/js/monaco/esm/vs/base/common/assert.js
Normal file
|
@ -0,0 +1,59 @@
|
|||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
import { BugIndicatingError, onUnexpectedError } from './errors.js';
|
||||
/**
|
||||
* Throws an error with the provided message if the provided value does not evaluate to a true Javascript value.
|
||||
*
|
||||
* @deprecated Use `assert(...)` instead.
|
||||
* This method is usually used like this:
|
||||
* ```ts
|
||||
* import * as assert from 'vs/base/common/assert';
|
||||
* assert.ok(...);
|
||||
* ```
|
||||
*
|
||||
* However, `assert` in that example is a user chosen name.
|
||||
* There is no tooling for generating such an import statement.
|
||||
* Thus, the `assert(...)` function should be used instead.
|
||||
*/
|
||||
export function ok(value, message) {
|
||||
if (!value) {
|
||||
throw new Error(message ? `Assertion failed (${message})` : 'Assertion Failed');
|
||||
}
|
||||
}
|
||||
export function assertNever(value, message = 'Unreachable') {
|
||||
throw new Error(message);
|
||||
}
|
||||
/**
|
||||
* Like assert, but doesn't throw.
|
||||
*/
|
||||
export function softAssert(condition) {
|
||||
if (!condition) {
|
||||
onUnexpectedError(new BugIndicatingError('Soft Assertion Failed'));
|
||||
}
|
||||
}
|
||||
/**
|
||||
* condition must be side-effect free!
|
||||
*/
|
||||
export function assertFn(condition) {
|
||||
if (!condition()) {
|
||||
// eslint-disable-next-line no-debugger
|
||||
debugger;
|
||||
// Reevaluate `condition` again to make debugging easier
|
||||
condition();
|
||||
onUnexpectedError(new BugIndicatingError('Assertion Failed'));
|
||||
}
|
||||
}
|
||||
export function checkAdjacentItems(items, predicate) {
|
||||
let i = 0;
|
||||
while (i < items.length - 1) {
|
||||
const a = items[i];
|
||||
const b = items[i + 1];
|
||||
if (!predicate(a, b)) {
|
||||
return false;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return true;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue