npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

juny-tsutil

v1.0.5

Published

no description

Downloads

2

Readme

juny-tsutil / Modules

juny-tsutil

Table of contents

Enumerations

Functions

Functions

addDay

addDay(date, day): Date

Date 객체에 대한 날짜 더하기

Parameters

| Name | Type | Description | | :------ | :------ | :------ | | date | Date | 계산하고자 하는 Date객체 | | day | number | 추가하고자 하는 일수 |

Returns

Date

계산된 Date 객체

Defined in

date/addDay.ts:9


compareDate

compareDate(date, diff, callback?): boolean

Date 객체를 밀리초 까지의 비교로 같은 시간대인지 판단

Parameters

| Name | Type | | :------ | :------ | | date | Date | | diff | Date | | callback? | (dateTimestamp: number, diffTimestamp: number) => boolean |

Returns

boolean

Example

        expect(
           compareDate(new Date('2024-04-01'), new Date('2024-04-01'))
       ).toEqual(true);

       expect(
           compareDate(new Date('2024-04-01'), new Date('2024-04-02')
       )).toEqual(false);

       expect(
           compareDate(new Date('2024-04-01'), new Date('2024-04-02'),(date, diff) => {
               return date < diff
           })
       ).toEqual(true)

Defined in

date/compareDate.ts:27


fillWord

fillWord(str, length, word?, type?): string

글자수에서 부족한 앞자리를 특정 문자열로 채웁니다.

Parameters

| Name | Type | Default value | Description | | :------ | :------ | :------ | :------ | | str | string | undefined | 소스 문자열 | | length | number | undefined | 타겟 문자열 갯수 | | word | string | '' | - | | type | -1 | 0 | 0 | - |

Returns

string

string

Param

type - 0: 앞자리 채우기, -1: 뒷자리 채우기

Example

const result = fillWord('4',2,'0');
// result = "04"

const result = fillWord('4',2,'0',-1);
// result = "40"

Defined in

str/fillWord.ts:20


getDaysInMonth

getDaysInMonth(year, month): Date[]

특정 년도와 월의 시작일부터 종료일까지의 날짜 배열을 반환합니다.

Parameters

| Name | Type | Description | | :------ | :------ | :------ | | year | number | 년도를 나타내는 숫자 | | month | number | 월을 나타내는 숫자 (1부터 12까지의 숫자) |

Returns

Date[]

해당 년도와 월의 날짜 배열. 예: ['YYYY-MM-DD', 'YYYY-MM-DD', ...]

Example

   getDaysInMonth(2024, 4);
    // [2024-04-01 ... 2024-04-30]

Defined in

date/getDaysInMonth.ts:18


getFirstInMonth

getFirstInMonth(year, month): Date

Parameters

| Name | Type | | :------ | :------ | | year | number | | month | number |

Returns

Date

Defined in

date/getFirstDayInMotth.ts:10


getLastInMonth

getLastInMonth(year, month): Date

특정 년도와 월의 마지막일을 반환합니다.

Parameters

| Name | Type | Description | | :------ | :------ | :------ | | year | number | 년도를 나타내는 숫자 | | month | number | 월을 나타내는 숫자 (1부터 12까지의 숫자) |

Returns

Date

Date

Defined in

date/getLastDayInMotth.ts:9


getPreviousMonthLastDay

getPreviousMonthLastDay(date): Date

get previouse month

Parameters

| Name | Type | | :------ | :------ | | date | Date |

Returns

Date

previous date

Example

 getPreviouseMonth(
		new Date('2024-04-15') 
 )
 // 2024-03-31

Defined in

date/getPreviousMonthLastDay.ts:16


getPreviousMonthLastSunday

getPreviousMonthLastSunday(year, month): Date[] | []

the last Sunday of the previous month 특정년도의 월 시작일(1)이 일요일이 아닌 경우 이전 달의 마지막 주 일요일까지

Parameters

| Name | Type | Description | | :------ | :------ | :------ | | year | number | 년도를 나타내는 숫자 | | month | number | 월을 나타내는 숫자 (1부터 12까지의 숫자) |

Returns

Date[] | []

Date[] | []

Example

expect(
	getPreviousMonthLastSunday(2024,4)
).toEqual([
	new Date('2024-03-31T00:00:00.000Z')
])

expect(
	getPreviousMonthLastSunday(2024,5)
).toEqual([
	new Date('2024-04-28T00:00:00.000Z'),
		new Date('2024-04-29T00:00:00.000Z'),
		new Date('2024-04-30T00:00:00.000Z'),
])

Defined in

date/getPreviousMonthLastSunday.ts:33


isWeek

isWeek(date, dayOfWeek): boolean

요일 체크 checked is day of week

Parameters

| Name | Type | | :------ | :------ | | date | Date | | dayOfWeek | DayOfWeek |

Returns

boolean

boolean

Example

	const date = getFirstInMonth(2024, 4) // MON 2024-04-01T00:00:00.000Z
	isWeek(date,DayOfWeek.TUES); // true

Defined in

date/isWeek.ts:18


removeFirstSegment

removeFirstSegment(str, delimiter): string

Removes the first segment from a string delimited by the specified delimiter.

Parameters

| Name | Type | Description | | :------ | :------ | :------ | | str | string | The input string. | | delimiter | string | The delimiter used to split the string into segments. |

Returns

string

The modified string with the first segment removed.

Example

 const str1 = 'foo/bar';
 const str2 = '/foo/bar';

 removeFirstSegment(str1,'/'); // /bar
 removeFirstSegment(str1,'/'); // /bar

Defined in

str/removeFirstSegment.ts:17


removeLastSegment

removeLastSegment(str, delimiter): string

Removes the Last segment from a string delimited by the specified delimiter.

Parameters

| Name | Type | Description | | :------ | :------ | :------ | | str | string | The input string. | | delimiter | string | The delimiter used to split the string into segments. |

Returns

string

The modified string with the first segment removed.

Example

describe('removeLastSegment', ()=>{
    test('should return an remove Last segment',() => {
        expect(
            removeLastSegment('/foo/bar','/')
        ).toEqual('/foo');

        expect(
            removeLastSegment('foo/bar','/')
        ).toEqual('foo');

        expect(
            removeLastSegment('foo/bar/','/')
        ).toEqual('foo/bar');

    })
})

Defined in

str/removeLastSegment.ts:28


subtractDay

subtractDay(date, days): Date

주어진 날짜에서 일 수를 빼는 함수

Parameters

| Name | Type | Description | | :------ | :------ | :------ | | date | Date | 일 수를 뺄 날짜 | | days | number | 뺄 일 수 |

Returns

Date

일 수를 뺀 날짜

Defined in

date/subtractDay.ts:8