From a86b07f2df20b6436291d77d9636061ede0b6c8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20=C5=BD=C3=A1ra?= Date: Tue, 31 Mar 2020 12:34:13 +0200 Subject: used native padStart/End where possible (#4537) --- std/encoding/toml.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'std/encoding') diff --git a/std/encoding/toml.ts b/std/encoding/toml.ts index 53b907fbf..ce4519572 100644 --- a/std/encoding/toml.ts +++ b/std/encoding/toml.ts @@ -1,6 +1,5 @@ // Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. import { deepAssign } from "../util/deep_assign.ts"; -import { pad } from "../strings/pad.ts"; import { assert } from "../testing/asserts.ts"; class KeyValuePair { @@ -514,7 +513,7 @@ class Dumper { } _dateDeclaration(keys: string[], value: Date): string { function dtPad(v: string, lPad = 2): string { - return pad(v, lPad, { char: "0" }); + return v.padStart(lPad, "0"); } const m = dtPad((value.getUTCMonth() + 1).toString()); const d = dtPad(value.getUTCDate().toString()); @@ -542,7 +541,7 @@ class Dumper { } else { const m = rDeclaration.exec(l); if (m) { - out.push(l.replace(m[1], pad(m[1], this.maxPad, { side: "right" }))); + out.push(l.replace(m[1], m[1].padEnd(this.maxPad))); } else { out.push(l); } -- cgit v1.2.3