mirror of
https://github.com/denoland/std.git
synced 2024-11-21 20:50:22 +00:00
parent
8b9a139472
commit
745c4a61ae
@ -8,20 +8,7 @@ import { isPlainObject } from "../_utils.ts";
|
||||
|
||||
function resolveYamlPairs(data: unknown[][]): boolean {
|
||||
if (data === null) return true;
|
||||
|
||||
const result = Array.from({ length: data.length });
|
||||
|
||||
for (const [index, pair] of data.entries()) {
|
||||
if (!isPlainObject(pair)) return false;
|
||||
|
||||
const keys = Object.keys(pair);
|
||||
|
||||
if (keys.length !== 1) return false;
|
||||
|
||||
result[index] = [keys[0], pair[keys[0] as keyof typeof pair]];
|
||||
}
|
||||
|
||||
return true;
|
||||
return data.every((it) => isPlainObject(it) && Object.keys(it).length === 1);
|
||||
}
|
||||
|
||||
export const pairs: Type<"sequence"> = {
|
||||
|
Loading…
Reference in New Issue
Block a user