Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
tunnckoCore committed Feb 6, 2016
1 parent 8538178 commit 41653a8
Show file tree
Hide file tree
Showing 10 changed files with 66 additions and 51 deletions.
7 changes: 7 additions & 0 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
languages:
JavaScript: true
exclude_paths:
- "dist/**/*"
- "dist/*.js"
- "dist/**/*.js"
- "dist/**.js"
9 changes: 5 additions & 4 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
# .editorconfig <https://github.com/tunnckoCore/dotfiles>
#
# Copyright (c) 2015 Charlike Mike Reagent, contributors.
# Released under the MIT license.
#

root = true

Expand All @@ -24,3 +20,8 @@ trim_trailing_whitespace = true
[*.md]
insert_final_newline = false
trim_trailing_whitespace = false

[*.py]
indent_size = 4
insert_final_newline = true
trim_trailing_whitespace = true
5 changes: 1 addition & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
# .gitignore <https://github.com/tunnckoCore/dotfiles>
#
# Copyright (c) 2015 Charlike Mike Reagent, contributors.
# Released under the MIT license.
#

# Always-ignore dirs #
# ####################
Expand Down Expand Up @@ -54,3 +50,4 @@ Desktop.ini
npm-debug.log
.directory
._*
lcov.info
12 changes: 8 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ sudo: false
node_js:
- "0.10"
- "0.12"
- "1"
- "2"
- "4"
- "5"

notifications:
email:
Expand All @@ -17,9 +17,13 @@ before_script:
- standard

script:
- npm install istanbul-harmony
- npm install istanbul
- node --harmony node_modules/.bin/istanbul cover test.js

after_success:
- npm install coveralls
- cat ./coverage/lcov.info | coveralls
- cat coverage/lcov.info | coveralls

matrix:
allow_failures:
- node_js: "0.10"
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2015-2016 Charlike Mike Reagent

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.
21 changes: 0 additions & 21 deletions LICENSE.md

This file was deleted.

15 changes: 10 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,28 @@
## Install
```
npm i useware-context --save
npm test
```


## Usage
> For more use-cases see the [tests](./test.js)
```js
var useware = require('useware-context')
const useware = require('useware-context')

function fn1 () {
return this.foo
}

function fn2 () {
return this.bar
}
var args = useware({foo: 'baz', bar: 'qux'}, [1, 2, [fn1, 3]], 'arg', fn2)

// pass context as first argument
const args = useware({
foo: 'baz',
bar: 'qux'
}, [1, 2, [fn1, 3]], 'arg', fn2)

console.log(args) //=> [fn1, fn2]
console.log(args[0]()) //=> 'baz'
Expand Down Expand Up @@ -53,7 +58,7 @@ But before doing anything, please read the [CONTRIBUTING.md](./CONTRIBUTING.md)
[npmjs-url]: https://www.npmjs.com/package/useware-context
[npmjs-img]: https://img.shields.io/npm/v/useware-context.svg?label=useware-context

[license-url]: https://github.com/tunnckoCore/useware-context/blob/master/LICENSE.md
[license-url]: https://github.com/tunnckoCore/useware-context/blob/master/LICENSE
[license-img]: https://img.shields.io/badge/license-MIT-blue.svg


Expand Down Expand Up @@ -92,4 +97,4 @@ But before doing anything, please read the [CONTRIBUTING.md](./CONTRIBUTING.md)
[freenode-img]: https://img.shields.io/badge/freenode-%23charlike-5654a4.svg

[new-message-url]: https://github.com/tunnckoCore/messages
[new-message-img]: https://img.shields.io/badge/send%20me-message-green.svg
[new-message-img]: https://img.shields.io/badge/send%20me-message-green.svg
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*!
* useware-context <https://github.com/tunnckoCore/useware-context>
*
* Copyright (c) 2015 Charlike Mike Reagent <@tunnckoCore> (http://www.tunnckocore.tk)
* Copyright (c) 2015-2016 Charlike Mike Reagent <@tunnckoCore> (http://www.tunnckocore.tk)
* Released under the MIT license.
*/

Expand All @@ -13,7 +13,7 @@ var isObject = require('is-plain-object')
var isArguments = require('is-arguments')
var manageArguments = require('manage-arguments')

module.exports = function useware (val) {
module.exports = function usewareContext (val) {
var args = isArguments(val) ? manageArguments(val) : manageArguments(arguments)
var ctx = this || {}
if (isObject(args[0])) {
Expand Down
21 changes: 11 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"description": "Much like `useware` but with the ability to bind given context to each function.",
"repository": "tunnckoCore/useware-context",
"author": "Charlike Mike Reagent <@tunnckoCore> (http://www.tunnckocore.tk)",
"precommit.silent": true,
"main": "index.js",
"license": "MIT",
"scripts": {
Expand All @@ -17,35 +18,35 @@
"manage-arguments": "~1.0.0"
},
"devDependencies": {
"assertit": "^0.1.0"
"assertit": "^0.1.0",
"pre-commit": "*"
},
"files": [
"index.js"
],
"keywords": [
"any",
"args",
"arguments",
"arr",
"array",
"bind",
"context",
"control",
"ctx",
"deep",
"deeply",
"expand",
"extract",
"filter",
"flat",
"flatten",
"flow",
"function",
"manage",
"middleware",
"multiple",
"nested",
"type",
"typeof",
"use",
"useware",
"useware-context",
"util",
"val",
"value",
"ware"
]
}
}
2 changes: 1 addition & 1 deletion test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*!
* useware-context <https://github.com/tunnckoCore/useware-context>
*
* Copyright (c) 2015 Charlike Mike Reagent <@tunnckoCore> (http://www.tunnckocore.tk)
* Copyright (c) 2015-2016 Charlike Mike Reagent <@tunnckoCore> (http://www.tunnckocore.tk)
* Released under the MIT license.
*/

Expand Down

0 comments on commit 41653a8

Please sign in to comment.