Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/kamataryo/symbol-function


https://github.com/kamataryo/symbol-function

Last synced: 4 days ago
JSON representation

Awesome Lists containing this project

README

        

# SymbolFunction

[![npm version](https://badge.fury.io/js/%40kamataryo%2Fsymbol-function.svg)](https://badge.fury.io/js/%40kamataryo%2Fsymbol-function)
[![Build Status](https://travis-ci.org/kamataryo/symbol-function.svg?branch=master)](https://travis-ci.org/kamataryo/symbol-function)

SymbolFunction can be used as a function and bracket suffix safely.

## install

```shell
$ yarn add @kamataryo/symbol-function
# or
$ npm insall @kamataryo/symbol-function
```

## usage

```javascript
// it works as a Function'
const func = new SymbolFunction(() => 'xyz')
func() // 'xyz'
})

// it can be used as bracket suffix
const func1 = new SymbolFunction(() => {})
const func2 = new SymbolFunction(() => {})
const obj = {}
obj[func1] = 123
obj[func2] = 234

obj[func1] // 123
obj[func2] // 234
```