Skip to content

Commit

Permalink
extract ts-core
Browse files Browse the repository at this point in the history
  • Loading branch information
Magiczne committed Dec 2, 2024
1 parent 6f98054 commit 37dd8f1
Show file tree
Hide file tree
Showing 12 changed files with 27 additions and 30 deletions.
3 changes: 2 additions & 1 deletion 2022/03/solution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import { readFileSync } from 'node:fs'
import { resolve } from 'node:path'
import { fileURLToPath } from 'node:url'
import { cluster, unique } from 'radash'
import { intersection, isUpperCase, solutionExample, solutionPart1, solutionPart2 } from '../util'
import { intersection, solutionExample, solutionPart1, solutionPart2 } from '../util'
import { isUpperCase } from '@magiczne/advent-of-code-ts-core/string'

type Rucksack = [Array<string>, Array<string>]

Expand Down
3 changes: 2 additions & 1 deletion 2022/05/solution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import { resolve } from 'node:path'
import { fileURLToPath } from 'node:url'
import { cluster, last } from 'radash'
import { transpose } from 'ramda'
import { isUpperCaseLetter, solutionExample, solutionPart1, solutionPart2 } from '../util'
import { solutionExample, solutionPart1, solutionPart2 } from '../util'
import { isUpperCaseLetter } from '@magiczne/advent-of-code-ts-core/string'

type Stack = Array<Uppercase<string>>
type Stacks = Record<number, Stack>
Expand Down
3 changes: 1 addition & 2 deletions 2022/util/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
export * from './array'
export * from './linked-list'
export * from './output'
export * from './string'
export * from './output'
9 changes: 0 additions & 9 deletions 2022/util/string.ts

This file was deleted.

3 changes: 2 additions & 1 deletion 2023/01/solution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import { readFileSync } from 'node:fs'
import { resolve } from 'node:path'
import { fileURLToPath } from 'node:url'
import { first, last } from 'radash'
import { isNumeric, solutionExample, solutionPart1, solutionPart2 } from '../util/index.ts'
import { solutionExample, solutionPart1, solutionPart2 } from '../util/index.ts'
import { isNumeric } from '@magiczne/advent-of-code-ts-core/string'

const __dirname = fileURLToPath(new URL('.', import.meta.url))

Expand Down
2 changes: 1 addition & 1 deletion 2023/03/schematic.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { range } from 'radash'
import { isNumeric } from '../util/index.ts'
import { isNumeric } from '@magiczne/advent-of-code-ts-core/string'

interface Point {
x: number
Expand Down
1 change: 0 additions & 1 deletion 2023/util/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
export * from './array.ts'
export * from './linked-list.ts'
export * from './output.ts'
export * from './string.ts'
14 changes: 0 additions & 14 deletions 2023/util/string.ts

This file was deleted.

3 changes: 3 additions & 0 deletions ts-core/string/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export * from './is-numeric'
export * from './is-upper-case'
export * from './is-upper-case-letter'
6 changes: 6 additions & 0 deletions ts-core/string/is-numeric.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
const isNumeric = (value: any): value is number => {
// Love JS
return !isNaN(value)
}

export { isNumeric }
5 changes: 5 additions & 0 deletions ts-core/string/is-upper-case-letter.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const isUpperCaseLetter = (value: string): boolean => {
return value === value.toUpperCase() && value !== value.toLowerCase()
}

export { isUpperCaseLetter }
5 changes: 5 additions & 0 deletions ts-core/string/is-upper-case.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const isUpperCase = (value: string): boolean => {
return value === value.toUpperCase()
}

export { isUpperCase }

0 comments on commit 37dd8f1

Please sign in to comment.