summaryrefslogtreecommitdiff
path: root/std/encoding/_yaml/utils.ts
diff options
context:
space:
mode:
authorCasper Beyer <caspervonb@pm.me>2021-02-02 19:05:46 +0800
committerGitHub <noreply@github.com>2021-02-02 12:05:46 +0100
commit6abf126c2a7a451cded8c6b5e6ddf1b69c84055d (patch)
treefd94c013a19fcb38954844085821ec1601c20e18 /std/encoding/_yaml/utils.ts
parenta2b5d44f1aa9d64f448a2a3cc2001272e2f60b98 (diff)
chore: remove std directory (#9361)
This removes the std folder from the tree. Various parts of the tests are pretty tightly dependent on std (47 direct imports and 75 indirect imports, not counting the cli tests that use them as fixtures) so I've added std as a submodule for now.
Diffstat (limited to 'std/encoding/_yaml/utils.ts')
-rw-r--r--std/encoding/_yaml/utils.ts80
1 files changed, 0 insertions, 80 deletions
diff --git a/std/encoding/_yaml/utils.ts b/std/encoding/_yaml/utils.ts
deleted file mode 100644
index cf18760de..000000000
--- a/std/encoding/_yaml/utils.ts
+++ /dev/null
@@ -1,80 +0,0 @@
-// Ported from js-yaml v3.13.1:
-// https://github.com/nodeca/js-yaml/commit/665aadda42349dcae869f12040d9b10ef18d12da
-// Copyright 2011-2015 by Vitaly Puzrin. All rights reserved. MIT license.
-// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
-
-// deno-lint-ignore no-explicit-any
-export type Any = any;
-
-export function isNothing(subject: unknown): subject is never {
- return typeof subject === "undefined" || subject === null;
-}
-
-export function isArray(value: unknown): value is Any[] {
- return Array.isArray(value);
-}
-
-export function isBoolean(value: unknown): value is boolean {
- return typeof value === "boolean" || value instanceof Boolean;
-}
-
-export function isNull(value: unknown): value is null {
- return value === null;
-}
-
-export function isNumber(value: unknown): value is number {
- return typeof value === "number" || value instanceof Number;
-}
-
-export function isString(value: unknown): value is string {
- return typeof value === "string" || value instanceof String;
-}
-
-export function isSymbol(value: unknown): value is symbol {
- return typeof value === "symbol";
-}
-
-export function isUndefined(value: unknown): value is undefined {
- return value === undefined;
-}
-
-export function isObject(value: unknown): value is Record<string, unknown> {
- return value !== null && typeof value === "object";
-}
-
-export function isError(e: unknown): boolean {
- return e instanceof Error;
-}
-
-export function isFunction(value: unknown): value is () => void {
- return typeof value === "function";
-}
-
-export function isRegExp(value: unknown): value is RegExp {
- return value instanceof RegExp;
-}
-
-export function toArray<T>(sequence: T): T | [] | [T] {
- if (isArray(sequence)) return sequence;
- if (isNothing(sequence)) return [];
-
- return [sequence];
-}
-
-export function repeat(str: string, count: number): string {
- let result = "";
-
- for (let cycle = 0; cycle < count; cycle++) {
- result += str;
- }
-
- return result;
-}
-
-export function isNegativeZero(i: number): boolean {
- return i === 0 && Number.NEGATIVE_INFINITY === 1 / i;
-}
-
-export interface ArrayObject<T = Any> {
- [P: string]: T;
-}