logo

/Code Snippet|v2.0.0

TOAST UI CodeSnippet

tui-code-snippet is group of utility methods to make ease with developing javascript applications.

It includes several features like class simulation, browser detecting, type checking and more.

tui-code-snippet supports IE8+ and modern browsers and already has been used for open source javascript components and many commercial projects in NHN corporation.

Documents

Features

  • array

    • Handle arrays
  • browser

    • Detect browser
  • collection

    • Process collections
    • Support util methods for collections
  • customEvents

    • Add/Remove/fire custom events
  • defineClass

    • Define classes
  • domEvent

    • Add, remove, fire DOM events
    • Control mouse events
  • domUtil

    • Control the information of DOM
    • Add, remove, find DOM class name
  • enum

    • Manage constant value
    • Make immutability values but IE8 low
  • formatDate

    • Format date strings
  • inheritance

    • Simple inheritance (Nicholas C. Zakas, YUI Library)
    • Call supur constructor of superclass
    • Have to get inheritance before define child
    • Use mixin and inner object
  • object

    • Support utils to control object
  • request

    • Request image ping
  • string

    • Support utils such as decodeHTMLEntity, encodeHTMLEntity
  • tricks

    • Creates a debounced function and a throttled function
  • type

    • Check data type

Installation

Install the latest version using npm command:

$ npm install --save tui-code-snippet

or install the each version:

$ npm install --save tui-code-snippet@<version>

Usage

Import only functions that you need in your code:

var func = require('tui-code-snippet/<folder>/<function>');

// for example,
var inArray = require('tui-code-snippet/array/inArray');
var customEvents = require('tui-code-snippet/customEvents/customEvents');

The folder structure can be found here.

Browser Support

Chrome Chrome IE Internet Explorer Edge Edge Safari Safari Firefox Firefox
Yes 8+ Yes Yes Yes

License

This software is licensed under the MIT © NHN.

Resizable