From d060e8e7fa6148ca60f1a8fbd9a847a27e4e52b7 Mon Sep 17 00:00:00 2001 From: Alex Voronyansky Date: Thu, 12 May 2016 18:21:39 +0300 Subject: [PATCH] project refactored --- .gitignore | 112 ++++++++++++++++++++++++++------ .travis.yml | 12 ++++ LICENSE | 21 ++++++ README.md | 38 ++++++++++- {src => lib}/throttle.js | 0 package.json | 28 +++++--- {tests => test}/throttleTest.js | 2 +- 7 files changed, 180 insertions(+), 33 deletions(-) create mode 100644 .travis.yml create mode 100644 LICENSE rename {src => lib}/throttle.js (100%) rename {tests => test}/throttleTest.js (96%) diff --git a/.gitignore b/.gitignore index 8637fd0..14e8dcd 100644 --- a/.gitignore +++ b/.gitignore @@ -25,39 +25,67 @@ coverage # Compiled binary addons (http://nodejs.org/api/addons.html) build/Release -# Dependency directory -# https://docs.npmjs.com/misc/faq#should-i-check-my-node-modules-folder-into-git +# Dependency directories node_modules +jspm_packages + +# Optional npm cache directory +.npm + +# Optional REPL history +.node_repl_history +### OSX template +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk ### JetBrains template -# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio - -*.iml - -## Directory-based project format: -.idea/ -# if you remove the above rule, at least ignore the following: +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 # User-specific stuff: -# .idea/workspace.xml -# .idea/tasks.xml -# .idea/dictionaries +.idea/workspace.xml +.idea/tasks.xml +.idea/dictionaries +.idea/vcs.xml +.idea/jsLibraryMappings.xml # Sensitive or high-churn files: -# .idea/dataSources.ids -# .idea/dataSources.xml -# .idea/sqlDataSources.xml -# .idea/dynamic.xml -# .idea/uiDesigner.xml +.idea/dataSources.ids +.idea/dataSources.xml +.idea/dataSources.local.xml +.idea/sqlDataSources.xml +.idea/dynamic.xml +.idea/uiDesigner.xml # Gradle: -# .idea/gradle.xml -# .idea/libraries +.idea/gradle.xml +.idea/libraries # Mongo Explorer plugin: -# .idea/mongoSettings.xml +.idea/mongoSettings.xml ## File-based project format: -*.ipr *.iws ## Plugin-specific files: @@ -75,4 +103,46 @@ atlassian-ide-plugin.xml com_crashlytics_export_strings.xml crashlytics.properties crashlytics-build.properties +fabric.properties +### Windows template +# Windows image file caches +Thumbs.db +ehthumbs.db + +# Folder config file +Desktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msm +*.msp + +# Windows shortcuts +*.lnk + +# Archives +*.7z +*.dmg +*.gz +*.iso +*.jar +*.rar +*.tar +*.zip + +# Databases +*.sql +*.sqlite + +# OS temp files +.DS_Store* +Icon? + +# tmp files & folders +tmp + diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..7c8fa3f --- /dev/null +++ b/.travis.yml @@ -0,0 +1,12 @@ +language: node_js +node_js: + - "6" + - "5" + - "4" +os: + - linux + - osx + - windows +script: npm run coverage +# Send coverage data to Coveralls +after_script: cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..d7fc85e --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2016 Alex Voronyansky + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md index 8dfd708..f31f3a7 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,37 @@ -# Throttle Decorator +# Throttle Wrapper -Функиция-декоратор для контроля числа вызовов обернутой функции. \ No newline at end of file +[![Build Status](https://travis-ci.org/BelirafoN/throttle.svg?branch=master)](https://travis-ci.org/BelirafoN/throttle) +[![Coverage Status](https://coveralls.io/repos/BelirafoN/throttle/badge.svg)](https://coveralls.io/r/BelirafoN/throttle) +[![Code Climate](https://codeclimate.com/github/BelirafoN/throttle/badges/gpa.svg)](https://codeclimate.com/github/BelirafoN/throttle) + +Function-wrapper to reduce the number of calls the inverse function. + +## Install + +```bash +$ git clone git@github.com:BelirafoN/throttle.git +``` + +## Tests + +Tests require [Mocha](https://mochajs.org/). + +```bash +mocha ./tests +``` + +or with `npm` + +```bash +npm test +``` + +Test coverage with [Istanbul](https://gotwarlost.github.io/istanbul/) + +```bash +npm run coverage +``` + +## License + +Licensed under the MIT License \ No newline at end of file diff --git a/src/throttle.js b/lib/throttle.js similarity index 100% rename from src/throttle.js rename to lib/throttle.js diff --git a/package.json b/package.json index 4320b9d..497159e 100644 --- a/package.json +++ b/package.json @@ -1,21 +1,31 @@ { "name": "throttle", "version": "0.0.1", - "description": "Функиция-декоратор для контроля числа вызовов обернутой функции.", - "main": "./src/throttle.js", - "directories": { - "test": "tests" + "description": "Function-wrapper to reduce the number of calls the inverse function.", + "engines": { + "node": ">=4.0" + }, + "main": "./lib/throttle.js", + "dependencies": {}, + "devDependencies": { + "coveralls": "^2.11.9", + "istanbul": "^0.4.3", + "mocha": "^2.4.5" }, "scripts": { - "test": "mocha ./tests" + "test": "mocha ./test", + "coverage": "istanbul cover _mocha -- -R spec" }, "repository": { "type": "git", - "url": "git@git.ditrade.ru:BelirafoN/throttle.git" + "url": "git@github.com:BelirafoN/throttle.git" }, - "devDependencies": { - "mocha": "^2.4.5" + "author": { + "name": "Alex Voronyansky", + "email": "belirafon@gmail.com" + }, + "bugs": { + "email": "belirafon@gmail.com" }, - "author": "BelirafoN ", "license": "MIT" } diff --git a/tests/throttleTest.js b/test/throttleTest.js similarity index 96% rename from tests/throttleTest.js rename to test/throttleTest.js index b883aca..5661682 100644 --- a/tests/throttleTest.js +++ b/test/throttleTest.js @@ -7,7 +7,7 @@ "use strict"; const assert = require('assert'); -const throttle = require('../src/throttle'); +const throttle = require('../lib/throttle'); describe('Throttle decorator functionality', () => { let callCounter = 0,