Skip to content
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
36 changes: 36 additions & 0 deletions .github/workflows/bump-alpha.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: "Bump Alpha"

on:
push:
branches:
- "master-4"
jobs:
bump-version:
name: "Bump alpha version"
timeout-minutes: 60
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'ci: version bump to ')"

steps:
- name: "Checkout source code"
uses: "actions/checkout@v3"
with:
token: ${{ secrets.ADMIN_TOKEN }}
- name: "Setup Node"
uses: "actions/setup-node@v3"
with:
node-version: current
cache: "npm"
- name: Update NPM
run: npm install -g npm
- name: "Version Bump"
id: version-bump
uses: "phips28/gh-action-bump-version@master"
with:
default: prerelease
version-type: "prerelease"
preid: alpha
rc-wording: ""
tag-prefix: "release-"
env:
GITHUB_TOKEN: ${{ secrets.ADMIN_TOKEN }}
5 changes: 3 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"isly",
"isoly",
"langly",
"måndag",
"paramly",
"persistly",
"selectivly",
Expand All @@ -58,10 +59,10 @@
"smoothly",
"tidily",
"transactly",
"transcoders",
"typedly",
"uply",
"måndag",
"transcoders"
"Utily"
],
"typescript.tsdk": "node_modules/typescript/lib"
}
24 changes: 12 additions & 12 deletions Address/GB.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@ export type GB = {
}

export namespace GB {
export const type = isly.object<GB>(
{
countryCode: isly.string<"GB">("GB"),
street: isly.string(),
building: isly.string(),
zipCode: isly.string(),
city: isly.string(),
},
"isoly.Address.GB"
)
export const is = type.is
export const flaw = type.flaw
export const { type, is, flawed } = isly
.object<GB>(
{
countryCode: isly.string("value", "GB"),
street: isly.string(),
building: isly.string(),
zipCode: isly.string(),
city: isly.string(),
},
"isoly.Address.GB"
)
.bind()
}
26 changes: 13 additions & 13 deletions Address/Generic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@ export type Generic = {
}

export namespace Generic {
export const type = isly.object<Generic>(
{
countryCode: CountryCode.Alpha2.type,
street: isly.string(),
zipCode: isly.string(),
city: isly.string(),
county: isly.string().optional(),
state: isly.string().optional(),
},
"isoly.Address.Generic"
)
export const is = type.is
export const flaw = type.flaw
export const { type, is, flawed } = isly
.object<Generic>(
{
countryCode: CountryCode.Alpha2.type,
street: isly.string(),
zipCode: isly.string(),
city: isly.string(),
county: isly.string().optional(),
state: isly.string().optional(),
},
"isoly.Address.Generic"
)
.bind()
}
22 changes: 11 additions & 11 deletions Address/SE.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ export type SE = {
}

export namespace SE {
export const type = isly.object<SE>(
{
countryCode: isly.string<"SE">("SE"),
street: isly.string(),
zipCode: isly.string(),
city: isly.string(),
},
"isoly.Address.SE"
)
export const is = type.is
export const flaw = type.flaw
export const { type, is, flawed } = isly
.object<SE>(
{
countryCode: isly.string<"SE">("value", "SE"),
street: isly.string(),
zipCode: isly.string(),
city: isly.string(),
},
"isoly.Address.SE"
)
.bind()
}
2 changes: 1 addition & 1 deletion Address/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ export namespace Address {
export import Generic = AddressGeneric
export import GB = AddressGB
export import SE = AddressSE
export const type = isly.named("isoly.Address", isly.union<Address>(Generic.type, GB.type, SE.type))
export const { type, is, flawed } = isly.union<Address>(Generic.type, GB.type, SE.type).rename("isoly.Address").bind()
}
7 changes: 4 additions & 3 deletions CallingCode/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,9 +248,10 @@ export namespace CallingCode {
"+260",
"+263",
] as const
export const type = isly.named("isoly.CallingCode", isly.string<CallingCode>(values))
export const is = type.is
export const flaw = type.flaw
export const { type, is, flawed } = isly
.string<CallingCode>("value", ...values)
.rename("isoly.CallingCode")
.bind()
export function from(country: CountryCode.Alpha2): CallingCode | undefined {
return alpha2toCallingCode[country]
}
Expand Down
6 changes: 3 additions & 3 deletions CountryCode/Alpha2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,9 +257,9 @@ export namespace Alpha2 {
"ZM",
"ZW",
] as const
export const type = isly.named("isoly.CountryCode.Alpha2", isly.string<Alpha2>(values))
export const is = type.is
export const flaw = type.flaw
export const { type, is, flawed } = isly.string<Alpha2>("value", ...values)
.rename("isoly.CountryCode.Alpha2")
.bind()
export function from(country: Numeric | Alpha3): Alpha2
export function from(country: Numeric | number | Alpha3 | string): Alpha2 | undefined
export function from(country: Numeric | number | Alpha3 | string): Alpha2 | undefined {
Expand Down
7 changes: 4 additions & 3 deletions CountryCode/Alpha3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,9 +257,10 @@ export namespace Alpha3 {
"ZMB",
"ZWE",
] as const
export const type = isly.named("isoly.CountryCode.Alpha3", isly.string<Alpha3>(values))
export const is = type.is
export const flaw = type.flaw
export const { type, is, flawed } = isly
.string<Alpha3>("value", ...values)
.rename("isoly.CountryCode.Alpha3")
.bind()
export function from(country: Alpha2 | Numeric): Alpha3 {
return typeof country == "number" ? from(Alpha2.from(country)) : alpha2ToAlpha3[country]
}
Expand Down
7 changes: 4 additions & 3 deletions CountryCode/Numeric.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ export namespace Numeric {
740, 744, 748, 752, 756, 760, 762, 764, 768, 772, 776, 780, 784, 788, 792, 795, 796, 798, 800, 804, 807, 818, 826,
831, 832, 833, 834, 840, 850, 854, 858, 860, 862, 876, 882, 887, 894, 926,
] as const
export const type = isly.named("isoly.CountryCode.Numeric", isly.number<Numeric>(values))
export const is = type.is
export const flaw = type.flaw
export const { type, is, flawed } = isly
.number<Numeric>("value", ...values)
.rename("isoly.CountryCode.Numeric")
.bind()
export function from(country: Alpha2 | Alpha3): Numeric {
return Alpha2.is(country) ? alpha2ToNumeric[country] : from(Alpha2.from(country))
}
Expand Down
7 changes: 4 additions & 3 deletions CountryCode/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ export namespace CountryCode {
export import Alpha3 = CountryCodeAlpha3
export import Name = CountryCodeName
export import Numeric = CountryCodeNumeric
export const type = isly.union<CountryCode>(Alpha2.type, Alpha3.type, Numeric.type)
export const is = type.is
export const flaw = type.flaw
export const { type, is, flawed } = isly
.union<CountryCode>(Alpha2.type, Alpha3.type, Numeric.type)
.rename("isoly.CountryCode")
.bind()
}
7 changes: 4 additions & 3 deletions Currency/Code.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,10 @@ export namespace Code {
"997",
"999",
] as const
export const type = isly.named("isoly.CurrencyCode", isly.string<Code>(values))
export const is = type.is
export const flaw = type.flaw
export const { type, is, flawed } = isly
.string<Code>("value", ...values)
.rename("isoly.CurrencyCode")
.bind()
export function from(currency: Currency): Code {
return {
ALL: "008",
Expand Down
7 changes: 4 additions & 3 deletions Currency/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,10 @@ export namespace Currency {
"ZMW",
"ZWL",
] as const
export const type = isly.named("isoly.Currency", isly.string<Currency>(values))
export const is = type.is
export const flaw = type.flaw
export const { type, is, flawed } = isly
.string<Currency>("value", ...values)
.rename("isoly.Currency")
.bind()
export type Code = CurrencyCode
export const Code = CurrencyCode
export function round(value: number, currency: Currency): number {
Expand Down
7 changes: 4 additions & 3 deletions Date/Day/Numeric.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ export namespace Numeric {
export const values = [
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
] as const
export const type = isly.named("isoly.Date.Day.Numeric", isly.number<Numeric>(values))
export const is = type.is
export const flaw = type.flaw
export const { type, is, flawed } = isly
.number<Numeric>("value", ...values)
.rename("isoly.Date.Day.Numeric")
.bind()

export function parse(value: Day): Numeric
export function parse(value: string): Numeric | undefined
Expand Down
7 changes: 4 additions & 3 deletions Date/Day/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,10 @@ export namespace Day {
"30",
"31",
] as const
export const type = isly.named("isoly.Date.Day", isly.string<Day>(values))
export const is = type.is
export const flaw = type.flaw
export const { type, is, flawed } = isly
.string<Day>("value", ...values)
.rename("isoly.Date.Day")
.bind()
export function create(value: Day.Numeric): Day
export function create(value: number): Day | undefined
export function create(value: number): string | undefined {
Expand Down
7 changes: 4 additions & 3 deletions Date/Month/Numeric.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ export type Numeric = typeof Numeric.values[number]

export namespace Numeric {
export const values = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] as const
export const type = isly.named("isoly.Date.Month.Numeric", isly.number<Numeric>(values))
export const is = type.is
export const flaw = type.flaw
export const { type, is, flawed } = isly
.number<Numeric>("value", ...values)
.rename("isoly.Date.Month.Numeric")
.bind()

export function parse(value: Month): Numeric
export function parse(value: string): Numeric | undefined
Expand Down
7 changes: 4 additions & 3 deletions Date/Month/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ export type Month = typeof Month.values[number]
export namespace Month {
export import Numeric = MonthNumeric
export const values = ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"] as const
export const type = isly.named("isoly.Date.Month", isly.string<Month>(values))
export const is = type.is
export const flaw = type.flaw
export const { type, is, flawed } = isly
.string<Month>("value", ...values)
.rename("isoly.Date.Month")
.bind()
export function create(value: Numeric): Month
export function create(value: number): Month | undefined
export function create(value: number): string | undefined {
Expand Down
4 changes: 2 additions & 2 deletions Date/Numeric.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ describe("isoly.Date.Numeric", () => {
["--", {}],
["-25-50", { days: 49, months: 24 }],
[undefined, {}],
] as const)("parse(%s) == %s", (value, expected) => expect(isoly.Date.Numeric.parse(value)).toEqual(expected))
] as const)("parse(%s) == %s", (value, expected) => expect(isoly.Date.Numeric.parse(value).values).toEqual(expected))
it.each([
[{ years: 10, months: 1, days: 0 }, "1910-02-01"],
[{}, "1900-01-01"],
[{ days: 36 }, "1900-02-06"],
] as const)("format(%s) == %s", (value, expected) => expect(isoly.Date.Numeric.format(value)).toBe(expected))
] as const)("format(%s) == %s", (value, expected) => expect(isoly.Date.Numeric.create(value)).toBe(expected))
})
Loading
Loading