Comparing version 1.1.3 to 1.2.0
{ | ||
"name": "decko", | ||
"version": "1.1.3", | ||
"main": "decko.js", | ||
"version": "1.2.0", | ||
"main": "dist/decko.js", | ||
"types": "dist/decko.d.ts", | ||
"description": "A collection of the most useful property decorators.", | ||
"scripts": { | ||
"build": "babel -f $npm_package_main -s -o $npm_package_main < src/${npm_package_main}", | ||
"test": "eslint {src,tests}/**.js && mocha --compilers js:babel/register tests/**/*.js", | ||
"build": "mkdir -p dist && babel -f src/decko.js -s -o $npm_package_main < src/decko.js && npm run build:ts", | ||
"build:ts": "cp src/decko.d.ts dist/", | ||
"test": "npm run test:ts && eslint {src,tests}/**.js && mocha --compilers js:babel/register tests/**/*.js", | ||
"test:ts": "tsc -p ./", | ||
"style:ts": "tsfmt -r", | ||
"prepublish": "npm run build", | ||
"release": "npm run build && git commit -am $npm_package_version && git tag $npm_package_version && git push && git push --tags && npm publish" | ||
}, | ||
"files": [ | ||
"src", | ||
"dist" | ||
], | ||
"repository": { | ||
@@ -21,4 +29,6 @@ "type": "git", | ||
"eslint": "^1.10.3", | ||
"mocha": "^2.3.0" | ||
"mocha": "^2.3.0", | ||
"typescript": "2.1.6", | ||
"typescript-formatter": "4.1.1" | ||
} | ||
} |
@@ -1,6 +0,20 @@ | ||
# decko [![NPM Version](http://img.shields.io/npm/v/decko.svg?style=flat)](https://npmjs.com/package/decko) [![Build Status](https://travis-ci.org/developit/decko.svg?branch=master)](https://travis-ci.org/developit/decko) | ||
# decko [![NPM Version](https://img.shields.io/npm/v/decko.svg?style=flat)](https://npmjs.com/package/decko) [![Build Status](https://travis-ci.org/developit/decko.svg?branch=master)](https://travis-ci.org/developit/decko) | ||
> A collection of the most useful [decorators](https://github.com/wycats/javascript-decorators). | ||
A concise implementation of the three most useful [decorators](https://github.com/wycats/javascript-decorators): | ||
- `@bind`: make the value of `this` constant within a method | ||
- `@debounce`: throttle calls to a method | ||
- `@memoize`: cache return values based on arguments | ||
Decorators help simplify code by replacing the noise of common patterns with declarative annotations. | ||
Conversely, decorators can also be overused and create obscurity. | ||
Decko establishes 3 standard decorators that are immediately recognizable, so you can avoid creating decorators in your own codebase. | ||
> 💡 **Tip:** decko is particularly well-suited to [**Preact Classful Components**](https://github.com/developit/preact). | ||
> | ||
> 💫 **Note:** | ||
> - For Babel 6+, be sure to install [babel-plugin-transform-decorators-legacy](https://github.com/loganfsmyth/babel-plugin-transform-decorators-legacy). | ||
> - For Typescript, be sure to enable `{"experimentalDecorators": true}` in your tsconfig.json. | ||
## Installation | ||
@@ -36,3 +50,3 @@ | ||
let e = new Example(); | ||
assert.equal(e.foo(), e); | ||
assert.equal(e.foo.call(null), e); | ||
``` | ||
@@ -39,0 +53,0 @@ |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
16126
121
7
8
151
1