Skip to content

Commit

Permalink
style: deps (sorted imports)
Browse files Browse the repository at this point in the history
  • Loading branch information
kirillgroshkov committed Jul 19, 2024
1 parent b6f9d10 commit bbe9267
Show file tree
Hide file tree
Showing 23 changed files with 394 additions and 397 deletions.
2 changes: 1 addition & 1 deletion src/datetime/dateInterval.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Inclusiveness } from '../types'
import { localDate, LocalDateInput, LocalDateUnit, LocalDate } from './localDate'
import { LocalDate, localDate, LocalDateInput, LocalDateUnit } from './localDate'

export type DateIntervalConfig = DateInterval | DateIntervalString
export type DateIntervalString = string
Expand Down
2 changes: 1 addition & 1 deletion src/datetime/localDate.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { dayjs } from '@naturalcycles/time-lib'
import { _range } from '../array/range'
import { expectWithMessage, isUTC } from '../test/test.util'
import { LocalDateFormatter, LocalDateUnit, localDate } from './localDate'
import { localDate, LocalDateFormatter, LocalDateUnit } from './localDate'

const units: LocalDateUnit[] = ['year', 'month', 'day', 'week']

Expand Down
5 changes: 3 additions & 2 deletions src/datetime/localDate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import type {
UnixTimestampMillisNumber,
UnixTimestampNumber,
} from '../types'
import { DateObject, ISODayOfWeek, localTime, LocalTime } from './localTime'
import { DateObject, ISODayOfWeek, LocalTime, localTime } from './localTime'

export type LocalDateUnit = LocalDateUnitStrict | 'week'
export type LocalDateUnitStrict = 'year' | 'month' | 'day'
Expand Down Expand Up @@ -358,8 +358,9 @@ export class LocalDate {

endOf(unit: LocalDateUnitStrict): LocalDate {
if (unit === 'day') return this
if (unit === 'month')
if (unit === 'month') {
return new LocalDate(this.year, this.month, localDate.getMonthLength(this.year, this.month))
}
// year
return new LocalDate(this.year, 12, 31)
}
Expand Down
2 changes: 1 addition & 1 deletion src/datetime/localTime.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { dayjs } from '@naturalcycles/time-lib'
import { _range } from '../array/range'
import { expectWithMessage, isUTC } from '../test/test.util'
import { LocalTimeFormatter, LocalTimeUnit, ISODayOfWeek, localTime } from './localTime'
import { ISODayOfWeek, localTime, LocalTimeFormatter, LocalTimeUnit } from './localTime'

const units: LocalTimeUnit[] = ['year', 'month', 'day', 'hour', 'minute', 'second', 'week']

Expand Down
2 changes: 1 addition & 1 deletion src/datetime/localTime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import type {
UnixTimestampMillisNumber,
UnixTimestampNumber,
} from '../types'
import { localDate, LocalDate } from './localDate'
import { LocalDate, localDate } from './localDate'
import { WallTime } from './wallTime'

export type LocalTimeUnit = 'year' | 'month' | 'week' | 'day' | 'hour' | 'minute' | 'second'
Expand Down
4 changes: 2 additions & 2 deletions src/datetime/timeInterval.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { UnixTimestampNumber, Inclusiveness } from '../types'
import { localTime, LocalTimeInput, LocalTime } from './localTime'
import type { Inclusiveness, UnixTimestampNumber } from '../types'
import { LocalTime, localTime, LocalTimeInput } from './localTime'

export type TimeIntervalConfig = TimeInterval | TimeIntervalString
export type TimeIntervalString = string
Expand Down
2 changes: 1 addition & 1 deletion src/decorators/debounce.decorator.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { pDelay, _since } from '..'
import { _since, pDelay } from '..'
import type { AnyFunction } from '../types'
import { _Debounce } from './debounce.decorator'

Expand Down
2 changes: 1 addition & 1 deletion src/decorators/debounce.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { pDelay, _since } from '..'
import { _since, pDelay } from '..'
import type { AnyFunction } from '../types'
import { _debounce } from './debounce'

Expand Down
2 changes: 1 addition & 1 deletion src/decorators/logMethod.decorator.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { CommonLogger } from '..'
import { SimpleMovingAverage, _stringify, _assert } from '..'
import { _assert, _stringify, SimpleMovingAverage } from '..'
import { _ms } from '../time/time.util'
import { _getArgsSignature, _getMethodSignature } from './decorator.util'

Expand Down
2 changes: 1 addition & 1 deletion src/define.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { _mapObject, _mapValues } from './object/object.util'
import { SKIP } from './types'
import type { AnyFunction, AnyObject } from './types'
import { SKIP } from './types'

/**
* const value = lazyValue(() => expensiveComputation())
Expand Down
14 changes: 7 additions & 7 deletions src/enum.util.test.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
import { expectTypeOf } from 'expect-type'
import {
_numberEnumAsMap,
_numberEnumAsMapReversed,
_numberEnumEntries,
_numberEnumEntriesReversed,
_numberEnumValue,
_numberEnumValueOrUndefined,
_numberEnumKey,
_numberEnumKeyOrUndefined,
_numberEnumKeys,
_numberEnumAsMap,
_numberEnumNormalize,
_numberEnumNormalizeOrUndefined,
_numberEnumAsMapReversed,
_numberEnumValue,
_numberEnumValueOrUndefined,
_numberEnumValues,
_stringEnumAsMap,
_stringEnumAsMapReversed,
_stringEnumEntries,
_stringEnumEntriesReversed,
_stringEnumKey,
_stringEnumKeyOrUndefined,
_stringEnumKeys,
_stringEnumValues,
_stringEnumEntriesReversed,
_stringEnumAsMap,
_stringEnumAsMapReversed,
} from './enum.util'

enum MyNumberEnum {
Expand Down
18 changes: 9 additions & 9 deletions src/error/error.util.test.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
import { expectResults } from '@naturalcycles/dev-lib/dist/testing'
import type { ErrorObject, BackendErrorResponseObject, HttpRequestErrorData } from '..'
import type { BackendErrorResponseObject, ErrorObject, HttpRequestErrorData } from '..'
import {
AppError,
HttpRequestError,
_errorDataAppend,
_errorLikeToErrorObject,
_omit,
_errorObjectToError,
AssertionError,
_errorDataAppend,
_isHttpRequestErrorObject,
_isErrorLike,
_errorSnippet,
_isErrorLike,
_isHttpRequestErrorObject,
_omit,
AppError,
AssertionError,
HttpRequestError,
} from '..'
import {
_anyToError,
_anyToErrorObject,
_isErrorObject,
_isBackendErrorResponseObject,
_isErrorObject,
} from './error.util'

const anyItems = [
Expand Down
6 changes: 3 additions & 3 deletions src/error/error.util.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import type {
ErrorData,
ErrorObject,
BackendErrorResponseObject,
Class,
HttpRequestErrorData,
ErrorData,
ErrorLike,
ErrorObject,
HttpRequestErrorData,
} from '..'
import { _jsonParseIfPossible, _stringify, _truncate, _truncateMiddle, isServerSide } from '..'

Expand Down
2 changes: 1 addition & 1 deletion src/http/fetcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ import type {
FetcherRetryOptions,
RequestInitNormalized,
} from './fetcher.model'
import { HTTP_METHODS } from './http.model'
import type { HttpStatusFamily } from './http.model'
import { HTTP_METHODS } from './http.model'

const acceptByResponseType: Record<FetcherResponseType, string> = {
text: 'text/plain',
Expand Down
74 changes: 37 additions & 37 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,90 +1,90 @@
export * from './abort'
export * from './array/array.util'
export * from './define'
export * from './string/url.util'
export * from './array/range'
export * from './datetime/dateInterval'
export * from './datetime/localDate'
export * from './datetime/localTime'
export * from './datetime/timeInterval'
export * from './datetime/wallTime'
export * from './decorators/asyncMemo.decorator'
export * from './decorators/createPromiseDecorator'
export * from './decorators/debounce'
export * from './decorators/debounce.decorator'
export * from './decorators/decorator.util'
export * from './decorators/logMethod.decorator'
export * from './decorators/memo.decorator'
export * from './decorators/asyncMemo.decorator'
export * from './decorators/memo.util'
export * from './decorators/memoFn'
export * from './decorators/memoFnAsync'
export * from './decorators/retry.decorator'
export * from './decorators/timeout.decorator'
export * from './error/assert'
export * from './define'
export * from './enum.util'
export * from './env'
export * from './env/buildInfo'
export * from './error/assert'
export * from './error/error.model'
export * from './error/error.util'
export * from './error/errorMode'
export * from './error/try'
export * from './error/tryCatch'
export * from './form.util'
export * from './http/fetcher'
export * from './http/fetcher.model'
export * from './http/http.model'
export * from './is.util'
export * from './iter/asyncIterable2'
export * from './iter/iterable2'
export * from './json-schema/from-data/generateJsonSchemaFromData'
export * from './json-schema/jsonSchema.cnst'
export * from './json-schema/jsonSchema.model'
export * from './json-schema/jsonSchema.util'
export * from './json-schema/jsonSchemaBuilder'
export * from './log/commonLogger'
export * from './math/math.util'
export * from './math/sma'
export * from './math/stack.util'
export * from './number/createDeterministicRandom'
export * from './number/number.util'
export * from './object/deepEquals'
export * from './object/map2'
export * from './object/object.util'
export * from './object/set2'
export * from './object/sortObject'
export * from './object/sortObjectDeep'
export * from './object/map2'
export * from './object/set2'
export * from './polyfill'
export * from './promise/abortable'
export * from './promise/pDefer'
export * from './promise/pDelay'
export * from './promise/pFilter'
export * from './promise/pHang'
export * from './promise/pMap'
export * from './promise/pProps'
export * from './promise/pQueue'
export * from './promise/pRetry'
export * from './promise/pState'
export * from './promise/pTimeout'
export * from './semver'
export * from './string/case'
export * from './string/json.util'
export * from './string/string.util'
export * from './string/readingTime'
export * from './string/escape'
export * from './string/hash.util'
export * from './string/json.util'
export * from './string/leven'
export * from './string/pupa'
export * from './string/readingTime'
export * from './string/regex'
export * from './string/safeJsonStringify'
export * from './string/string.util'
export * from './string/stringify'
export * from './string/url.util'
export * from './time/time.util'
export * from './is.util'
export * from './typeFest'
export * from './types'
export * from './unit/size.util'
export * from './log/commonLogger'
export * from './string/safeJsonStringify'
export * from './promise/pQueue'
export * from './promise/abortable'
export * from './iter/iterable2'
export * from './iter/asyncIterable2'
export * from './math/stack.util'
export * from './string/leven'
export * from './datetime/localDate'
export * from './datetime/localTime'
export * from './datetime/wallTime'
export * from './datetime/dateInterval'
export * from './datetime/timeInterval'
export * from './env'
export * from './http/http.model'
export * from './http/fetcher'
export * from './http/fetcher.model'
export * from './string/hash.util'
export * from './env/buildInfo'
export * from './form.util'
export * from './semver'
export * from './web'
export * from './abort'
export * from './polyfill'
export * from './string/regex'
export * from './zod/zod.util'
export * from './zod/zod.shared.schemas'
import { z, ZodSchema, ZodError, ZodIssue } from 'zod'
export * from './zod/zod.util'
import { z, ZodError, ZodIssue, ZodSchema } from 'zod'

export { z, ZodSchema, ZodError }
export { z, ZodError, ZodSchema }
export type { ZodIssue }
2 changes: 1 addition & 1 deletion src/json-schema/from-data/generateJsonSchemaFromData.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type {
AnyObject,
JsonSchema,
JsonSchemaArray,
JsonSchemaBoolean,
Expand All @@ -8,7 +9,6 @@ import type {
JsonSchemaOneOf,
JsonSchemaString,
StringMap,
AnyObject,
} from '../..'
import { _stringMapEntries, _uniq } from '../..'

Expand Down
4 changes: 2 additions & 2 deletions src/json-schema/jsonSchemaBuilder.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { _uniq } from '../array/array.util'
import type {
AnyObject,
BaseDBEntity,
JsonSchemaAllOf,
JsonSchemaArray,
JsonSchemaOneOf,
JsonSchemaTuple,
AnyObject,
} from '../index'
import { mergeJsonSchemaObjects, _deepCopy, _sortObject } from '../index'
import { _deepCopy, _sortObject, mergeJsonSchemaObjects } from '../index'
import { JSON_SCHEMA_ORDER } from './jsonSchema.cnst'
import type {
JsonSchema,
Expand Down
4 changes: 2 additions & 2 deletions src/log/commonLogger.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import type { CommonLogger, CommonLogWithLevelFunction } from './commonLogger'
import {
commonLoggerCreate,
commonLoggerMinLevel,
commonLoggerPipe,
commonLoggerNoop,
commonLoggerPipe,
commonLoggerPrefix,
commonLoggerCreate,
} from './commonLogger'

// This "tests" that `console` is a valid CommonLogger by itself
Expand Down
2 changes: 1 addition & 1 deletion src/object/object.util.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { _isEmpty, _isObject } from '../is.util'
import { _objectEntries, KeyValueTuple, Reviver, SKIP } from '../types'
import type { AnyObject, ObjectMapper, ObjectPredicate, ValueOf } from '../types'
import { _objectEntries, KeyValueTuple, Reviver, SKIP } from '../types'

/**
* Returns clone of `obj` with only `props` preserved.
Expand Down
2 changes: 1 addition & 1 deletion src/string/hash.util.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { hashCode, hashCode36, hashCode64, hashCode16 } from './hash.util'
import { hashCode, hashCode16, hashCode36, hashCode64 } from './hash.util'

test('hashCode', () => {
const obj = {
Expand Down
10 changes: 5 additions & 5 deletions src/types.test.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import { expectTypeOf } from 'expect-type'
import type { AppError } from '.'
import { _expectedError } from './error/try'
import type {
AnyObject,
BaseDBEntity,
MonthId,
Reviver,
Saved,
StringMap,
BaseDBEntity,
Unsaved,
UnsavedId,
AnyObject,
MonthId,
Saved,
} from './types'
import {
_noop,
Expand All @@ -23,7 +24,6 @@ import {
_stringMapValues,
_typeCast,
} from './types'
import type { AppError } from '.'

interface Item extends BaseDBEntity {
a?: number
Expand Down
2 changes: 1 addition & 1 deletion src/zod/zod.util.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ZodError, ZodSchema, ZodIssue } from 'zod'
import { ZodError, ZodIssue, ZodSchema } from 'zod'
import { _stringify } from '../string/stringify'

export interface ZodErrorResult<T> {
Expand Down
Loading

0 comments on commit bbe9267

Please sign in to comment.