0.1.0-beta.0 • Published 2 years ago

@vomjs/tools v0.1.0-beta.0

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

@vomjs/tools

JavaScript의 prototype을 이용하여 구현된 도구모음입니다.

Selector

jQuery 처럼 chaining 하여 사용될 수 있는 DOM API 도구입니다. 주로 low-level을 다룰때 사용됩니다.

문법

select(selector)
  .on(eventName, handler)  // 이벤트리스너 추가
  .off(eventName, handler) // 이벤트리스너 제거
  .context();              // 현재 선택된 DOM 반환

Pattern match

Pattern matching 문법을 차용하여 구현한 도구입니다.

문법

match(target)
  .when(pattern, ifMatch)
  .otherwise(otherwise);

예제

import { match } from '@vomjs/tools';

match({foo: 'hello world', bar: 123})
  .when(({foo}) => foo === 'hi', 'hello')
  .when({foo: /^hello/},
    () => console.log('foo matched'))
  .when(({bar}) => bar > 100,
    () => console.log('bar matched'))
  .otherwise(() => console.log('nope'));
1.0.0

2 years ago

0.0.3

2 years ago

0.0.4-rc.0

2 years ago

0.1.0-alpha.0

2 years ago

0.0.4-rc.1

2 years ago

0.1.0-beta.0

2 years ago

0.0.3-rc.0

2 years ago

0.0.4-alpha.0

2 years ago

0.0.2

2 years ago

0.0.1

3 years ago