This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[macro_export] | |
macro_rules! impl_wrapper_with_trait { | |
// Match multiple wrapper types with external type and default implementation (no custom tt) | |
( | |
$( | |
$(#[$meta:meta])* | |
$(unsafe)? $($vis:vis,? )? $wrapper:ident$(<$($lifetime:lifetime),+>)?$( : $ty:ty)? => $path:path $(,)? $({ | |
$($body:block)+ | |
})? $(,)? | |
$(,)?)+ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Binds all functions and accessors of an object to a specified 'thisArg'. | |
* | |
* This has proven to be particularly useful in scenarios where you want to | |
* subclass the native `Function` API, and want to be able to call `this` from | |
* within the function body string that you pass to `super()`. This allows you | |
* to effortlessly create a callable object, which can be invoked directly as | |
* a function or also by calling the corresponding method that is aliased by | |
* the super's function body. See the example below for a real-world | |
* demonstration. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// deno-lint-ignore-file ban-types | |
import { is } from "jsr:@type/[email protected]"; | |
/** | |
* Simple abstraction using the native `Proxy` and `Proxy.revocable` APIs to | |
* create temporary, "restorable" proxies of a given target object. This is | |
* particularly well-suited for testing and mocking purposes, allowing one to | |
* create a virtually indistinguishable proxy of an object or function that is | |
* to be tested, apply custom spying / mocking logic, and still be capable of |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*! | |
* Run this script with Deno to extract all models from the Workers AI | |
* documentation site (https://developers.cloudflare.com/workers-ai/models). | |
* | |
* @example | |
* ```sh | |
* # install Deno if you do not have it already | |
* curl -fsSL https://deno.land/install.sh | sh - | |
* | |
* # run the script |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The MIT License (MIT) | |
Copyright © 2023-2024 Nicholas Berlette (https://github.com/nberlette) | |
Permission is hereby granted, free of charge, to any person obtaining a copy of | |
this software and associated documentation files (the “Software”), to deal in | |
the Software without restriction, including without limitation the rights to | |
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of | |
the Software, and to permit persons to whom the Software is furnished to do so, | |
subject to the following conditions: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* User-extensible type for encoding types that can be used with the `DataURL` | |
* class. This interface can be extended using TypeSript's declaration merging, | |
* to supplement the built-in encoding types. */ | |
// deno-lint-ignore no-empty-interface | |
export interface EncodingTypeMap { | |
"uri": "uri"; | |
"url": "uri"; | |
"uri-component": "uri"; | |
"percent": "uri"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*~----------------------------------------~*\ | |
* CHAINABLE DECORATORS UTILITY CLASS * | |
* FOR TYPESCRIPT 5.0 * | |
*~----------------------------------------~* | |
* © 2023-2024 NICHOLAS BERLETTE • MIT * | |
\*~----------------------------------------~*/ | |
// deno-lint-ignore-file no-explicit-any ban-types | |
import type { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. | |
// Copyright 2019 Allain Lalonde. All rights reserved. ISC License. | |
import { | |
type AnyConstructor, | |
type Matcher, | |
matchers, | |
type TypeNames, | |
} from "./matchers.ts"; | |
import { AssertionError, type Async, type Fn, isPromiseLike } from "./utils.ts"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Iterator } from "./iterator.ts"; | |
/** Simple numeric iterator that returns the numbers passed to the constructor. Extremely useless. */ | |
export class NumericIterator extends Iterator<number> { | |
#index = 0; | |
#numbers: number[] = []; | |
constructor(...numbers: number[]) { | |
super(); | |
this.#numbers = numbers; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const TASK_NAME_REGEXP = /^[a-z\^\$][a-z0-9\-_$:.\^]*$/i; | |
type TaskConfig = { [key: string]: string }; | |
type HooksConfig<K extends MaybeHookNames = Hook.Name> = { | |
readonly [P in K]: string | string[]; | |
}; | |
type HookNames = typeof Hook.names[number]; |
NewerOlder