Code Monkey home page Code Monkey logo

time-based-sequence-character's Introduction

time-based-sequence-character

시간 베이스로 문자열 반환

  • 매시간마다 애국가 한 음절을 반환합니다
  • 기준 시간은 2021. 9. 24. 오후 5:46:16로부터 시작합니다

Install

npm install time-based-sequence-character

Usage

// example
import { getTimeBasedCharacter } from 'time-based-sequence-character';

// 한 시간마다 애국가 한 음절을 반환
const char = getTimeBasedCharacter(new Date().getTime());
console.log({ char });
// custom example
import { TimeBasedSequenceCharacter } from 'time-based-sequence-character';

// 현재 시간을 기준으로 10초마다 '0', '1', '0', '1', '0', '1',...
const curTime = new Date().getTime();
const tbsc = new TimeBasedSequenceCharacter({
  baseTime: curTime,
  gap: 10,
  arr: ['0', '1'],
});
const char = tbsc.getTimeBasedCharacter(curTime);
console.log({ char }); // { char: '0' }

const postChars = [1, 2, 3, 4, 5]
  .map((v) => v * 10 * 1000 + curTime)
  .map((time) => tbsc.getTimeBasedCharacter(time));
console.log({ postChars }); // { postChars: [ '1', '0', '1', '0', '1' ] }

time-based-sequence-character's People

Contributors

chinsun9 avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

yundo-gi

time-based-sequence-character's Issues

refactor: tsconfig

  • tsconfig.json이랑 tsconfig.build.json이 있는데 중복이 많다
  • build.json은 tsconfig.json을 확장하는 방향으로 수정하기

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.