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

kadvice

v2.0.2

Published

advice korean ver

Downloads

25

Readme

Kadvice

⚡️ Fixtures

한국어 기반 명언 모음집입니다. 영어의 고통에서 해방되세요.

  • 💡 한국어 기반 명언 모음집
  • 🛠️ 필요에 따라 명언 모음을 변경할 수 있는 커스터마이징 기능
  • 🔩 7KB의 작은 용량 (Gzip 기준)
  • 🔑 TypeScript 완벽 지원
  • 📦 삶과 동기부여 등에 대한 100여개의 명연

🌐 Demo

데모 보러가기 명언 리스트 보기

📦 Install

npm i kadvice

// or

yarn add kadvice

⌨️ Type

| 타입명 | 타입 | 설명 | | ------------- | ------------- | -------------------------------------------------------------- | | author | string | 말한 사람의 이름 | | authorProfile | string | 말한 사람의 직업 or 별칭 | | message | string | 말한 내용 | | tag | 1, 2, 3 | 주제에 따른 태그 번호.1 = 삶 관련, 2 = 동기부여 관련, 3 = 기타 |

🔨 Usage

import { kadvice } from 'kadvice';

const advices = kadvice.getAll();
const advice = kadvice.getOne();
const dailyAdvice = kadvice.getOneByDaily();

🗃️ API

1. getAll()

  • getAll() 함수는 전체 명언 리스트를 반환합니다. (배열을 반환)
  • getAll 함수는 1 | 2 | 3을 인자로 받아 특정 태그의 전체 명언 리스트를 반환합니다.

Example

const advices = kadvice.getAll();

// or

const lifeAdvices = kadvice.getAll(1);

2. getOne()

  • getOne() 함수는 명언 리스트 중 하나를 랜덤으로 반환 합니다. (객체를 반환)
  • getOne 함수는 1 | 2 | 3을 인자로 받아 특정 태그의 명언 리스트 중 하나를 랜덤으로 반환합니다.

Example

const advice = kadvice.getOne();

// or

const lifeAdvice = kadvice.getOne(1);

3. getOneByDaily()

  • daily() 함수는 매일 자정에 새로운 명언을 반환합니다.
  • daily 함수는 1 | 2 | 3을 인자로 받아 특정 태그의 명언을 반환합니다.
  • 내부적으로 로컬스토리지를 활용하며, countmidNight을 key로 사용합니다.

Example

const daily = kadvice.getOneByDaily();

or;

const daily = kadvice.getOneByDaily(1);

리액트에선 다음과 같이 활용하세요.

const [dailyAdvice, setDailyAdvice] = kadvice.getOne();

const handleClick = () => {
  setDailyAdvice(kadvice.getOne());
};

Customizing

  • 커스터마이징 기능을 지원합니다.
import { KadviceService, KadviceStorageService } from "kadvice";

const sampleJson: KadviceJsonModel[] = [
  {
    author: 'Alice',
    authorProfile: 'Designer',
    message: 'This is message number 1.',
    tag: 1,
  },
  {
    author: 'Bob',
    authorProfile: 'Doctor',
    message: 'This is message number 2.',
    tag: 2,
  },
  // ...etc
];

function getCustomAdvice() {
  return new KadviceService(sampleJson, new KadviceStorageService()));
}

const kadvice = getCustomAdvice();
  • 원하는 명언을 추가할 수 있습니다.
import { KadviceService, KadviceStorageService, getAdviceFixtures } from "kadvice";

const sampleJson: KadviceJsonModel[] = [
  ...getAdviceFixtures(),
  {
    author: 'Alice',
    authorProfile: 'Designer',
    message: 'This is message number 1.',
    tag: 1,
  },
  {
    author: 'Bob',
    authorProfile: 'Doctor',
    message: 'This is message number 2.',
    tag: 2,
  },
  // ...etc
];

function getCustomAdvice() {
  return new KadviceService(sampleJson, new KadviceStorageService()));
}

const kadvice = getCustomAdvice();
  • 원하는 localStorage key로 변경할 수 있습니다.
function getCustomAdvice() {
  return new KadviceService(sampleJson, new KadviceStorageService('customCountKey', 'customMidNightKey')));
}

const kadvice = getCustomAdvice();