Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert codebase to TypeScript (continued) #1047

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .babelrc

This file was deleted.

13 changes: 13 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"env": {
"es2021": true
},
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 12,
"sourceType": "module"
},
"plugins": ["@typescript-eslint"],
"rules": {}
}
76 changes: 0 additions & 76 deletions benchmarks/datetime.js

This file was deleted.

58 changes: 58 additions & 0 deletions benchmarks/datetime.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import { add, complete, cycle, suite } from "benny";
import DateTime from "../src/datetime";
import Settings from "../src/settings";

const dt = DateTime.now();
suite(
"DateTime",
add("DateTime.local", () => {
DateTime.now();
}),
add("DateTime.fromObject with locale", () => {
DateTime.fromObject({}, { locale: "fr" });
}),
add("DateTime.local with numbers", () => {
DateTime.local(2017, 5, 15);
}),
add("DateTime.fromISO", () => {
DateTime.fromISO("1982-05-25T09:10:11.445Z");
}),
add("DateTime.fromSQL", () => {
DateTime.fromSQL("2016-05-14 10:23:54.2346");
}),
add("DateTime.fromString", () => {
DateTime.fromString("1982/05/25 09:10:11.445", "yyyy/MM/dd HH:mm:ss.SSS");
}),
add("DateTime.fromString with zone", () => {
DateTime.fromString("1982/05/25 09:10:11.445", "yyyy/MM/dd HH:mm:ss.SSS", {
zone: "America/Los_Angeles",
});
}),
add("DateTime#setZone", () => {
dt.setZone("America/Los_Angeles");
}),
add("DateTime#toFormat", () => {
dt.toFormat("yyyy-MM-dd");
}),
add("DateTime#toFormat with macro", () => {
dt.toFormat("T");
}),
add("DateTime#toFormat with macro no cache", () => {
dt.toFormat("T");
Settings.resetCaches();
}),
add("DateTime#add", () => {
dt.plus({ milliseconds: 3434 });
}),
add("DateTime#toISO", () => {
dt.toISO();
}),
add("DateTime#toLocaleString", () => {
dt.toLocaleString();
}),
add("DateTime#toRelativeCalendar", () => {
dt.toRelativeCalendar({ base: DateTime.now() });
}),
cycle(),
complete()
);
12 changes: 0 additions & 12 deletions benchmarks/index.js

This file was deleted.

2 changes: 2 additions & 0 deletions benchmarks/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import "./datetime";
import "./info";
106 changes: 0 additions & 106 deletions benchmarks/info.js

This file was deleted.

52 changes: 52 additions & 0 deletions benchmarks/info.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import { add, complete, cycle, suite } from "benny";
import Info from "../src/info";
import Locale from "../src/impl/locale";

const locale = Locale.create(undefined, null, null);
suite(
"runWeekdays",
add("Info.weekdays with existing locale", () => {
Info.weekdays("long", { locObj: locale });
}),
add("Info.weekdays", () => {
Info.weekdays("long");
}),
cycle(),
complete()
);

suite(
"runWeekdaysFormat",
add("Info.weekdaysFormat with existing locale", () => {
Info.weekdaysFormat("long", { locObj: locale });
}),
add("Info.weekdaysFormat", () => {
Info.weekdaysFormat("long");
}),
cycle(),
complete()
);

suite(
"runMonths",
add("Info.months with existing locale", () => {
Info.months("long", { locObj: locale });
}),
add("Info.months", () => {
Info.months("long");
}),
cycle(),
complete()
);

suite(
"runMonthsFormat",
add("Info.monthsFormat with existing locale", () => {
Info.monthsFormat("long", { locObj: locale });
}),
add("Info.monthsFormat", () => {
Info.monthsFormat("long");
}),
cycle(),
complete()
);
Loading