Skip to content

Commit 2e9fddd

Browse files
committed
init0
0 parents  commit 2e9fddd

13 files changed

+325
-0
lines changed

.editorconfig

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# EditorConfig is awesome: http://EditorConfig.org
2+
3+
# top-most EditorConfig file
4+
root = true
5+
6+
charset = utf-8
7+
8+
[*]
9+
end_of_line = lf
10+
insert_final_newline = true
11+
indent_style = space
12+
indent_size = 2

.gitignore

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
#### joe made this: https://goel.io/joe
2+
3+
#####=== Node ===#####
4+
5+
# Logs
6+
logs
7+
*.log
8+
9+
# Runtime data
10+
pids
11+
*.pid
12+
*.seed
13+
14+
# Directory for instrumented libs generated by jscoverage/JSCover
15+
lib-cov
16+
17+
# Coverage directory used by tools like istanbul
18+
coverage
19+
20+
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
21+
.grunt
22+
23+
# node-waf configuration
24+
.lock-wscript
25+
26+
# Compiled binary addons (http://nodejs.org/api/addons.html)
27+
build/Release
28+
29+
# Dependency directory
30+
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git-
31+
node_modules
32+
33+
# Debug log from npm
34+
npm-debug.log
35+
36+
#####=== OSX ===#####
37+
.DS_Store
38+
.AppleDouble
39+
.LSOverride
40+
41+
# Icon must end with two \r
42+
Icon
43+
44+
# Thumbnails
45+
._*
46+
47+
# Files that might appear on external disk
48+
.Spotlight-V100
49+
.Trashes
50+
51+
# Directories potentially created on remote AFP share
52+
.AppleDB
53+
.AppleDesktop
54+
Network Trash Folder
55+
Temporary Items
56+
.apdisk
57+

.jshintrc

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"node": true,
3+
"esnext": true,
4+
"bitwise": true,
5+
"curly": true,
6+
"eqeqeq": true,
7+
"eqnull": true,
8+
"immed": true,
9+
"latedef": "nofunc",
10+
"newcap": false,
11+
"noarg": true,
12+
"undef": true,
13+
"strict": false,
14+
"trailing": true,
15+
"smarttabs": true,
16+
"indent": 2,
17+
"white": false,
18+
"quotmark": "single",
19+
"laxbreak": true,
20+
"globals" : {
21+
"describe" : false,
22+
"expect" : false,
23+
"it" : false,
24+
"before" : false,
25+
"beforeEach" : false,
26+
"after" : false,
27+
"afterEach" : false
28+
}
29+
}

.travis.yml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
language: node_js
2+
before_install:
3+
- "export DISPLAY=:99.0"
4+
- "sh -e /etc/init.d/xvfb start"
5+
node_js:
6+
- '0.10'

CONTRIBUTING.markdown

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Contributing
2+
3+
- Always add tests
4+
- Update documentation if needed
5+
- run `gulp test` before submitting
6+
7+
## Bug fixes
8+
9+
Always add a test for the bug in a separate commit so we can easily cherry pick
10+
it for verification.
11+
12+
## New features
13+
14+
It's recommended to open an issue before sending a pull request to avoid
15+
unnecessary work.

LICENSE

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2015 hemanth.hm
4+
Copyright (c) 2015 stoeffel
5+
6+
Permission is hereby granted, free of charge, to any person obtaining a copy
7+
of this software and associated documentation files (the "Software"), to deal
8+
in the Software without restriction, including without limitation the rights
9+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
copies of the Software, and to permit persons to whom the Software is
11+
furnished to do so, subject to the following conditions:
12+
13+
The above copyright notice and this permission notice shall be included in all
14+
copies or substantial portions of the Software.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
SOFTWARE.
23+

README.markdown

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# fj-or
2+
3+
[![Build Status](https://travis-ci.org/fp-js/fj-or.svg)](https://travis-ci.org/fp-js/fj-or) [![npm version](https://badge.fury.io/js/fj-or.svg)](http://badge.fury.io/js/fj-or)
4+
> x && y
5+
6+
## Installation
7+
8+
`npm install fj-or --save`
9+
10+
## Usage
11+
12+
```js
13+
var or = require('fj-or');
14+
15+
let T = () => true;
16+
let F = () => false;
17+
18+
or(T, T)()); // => true
19+
or(T)(T)()); // => true
20+
or(T, F)()); // => false
21+
or(F, F)()); // => false
22+
or(F, F)()); // => false
23+
```
24+
25+
26+
## API
27+
28+
### or
29+
30+
`or(p1, p2)`
31+
32+
***Parameters***
33+
34+
| Name | Type | Description |
35+
| ------------- | ----------- | -------------------------- |
36+
| p1 | function | A function that returns true or false |
37+
| p2 | function | A function that returns true or false |
38+
39+
***Returns***
40+
41+
| Type | Description |
42+
| ----------- | -------------------------- |
43+
| function | Returns a function which returns true if p1 or p2 return true |

gulpfile.js

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
var gulp = require('gulp'),
2+
watch = require('gulp-watch'),
3+
run = require('gulp-run'),
4+
sourcemaps = require('gulp-sourcemaps'),
5+
rename = require('gulp-rename'),
6+
to5 = require('gulp-6to5');
7+
8+
gulp.task('6to5', function() {
9+
return gulp.src('**/*.es6')
10+
.pipe(sourcemaps.init())
11+
.pipe(to5({
12+
experimental: true,
13+
loose: 'all'
14+
}))
15+
.pipe(sourcemaps.write())
16+
.pipe(rename({
17+
extname: '.js'
18+
}))
19+
.pipe(gulp.dest('./'));
20+
});
21+
22+
gulp.task('test', ['6to5'], function() {
23+
return gulp.src('test.js')
24+
.pipe(run('node test -b -l phantom -e -q'));
25+
});
26+
27+
gulp.task('default', ['test'], function() {
28+
gulp.watch('**/*.es6', ['test']);
29+
});

index.es6

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { curry2 } from 'fj-curry';
2+
3+
4+
function _or(x, y) {
5+
return () => {
6+
return x() || y();
7+
};
8+
}
9+
10+
let or = curry2(_or);
11+
12+
export default or;

index.js

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
"use strict";
2+
3+
var curry2 = require("fj-curry").curry2;
4+
5+
6+
7+
function _or(x, y) {
8+
return function () {
9+
return x() || y();
10+
};
11+
}
12+
13+
var or = curry2(_or);
14+
15+
module.exports = or;

package.json

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"name": "fj-and",
3+
"version": "0.0.0",
4+
"description": "x && y",
5+
"main": "index.js",
6+
"scripts": {
7+
"test": "gulp test"
8+
},
9+
"repository": {
10+
"type": "git",
11+
"url": "https://github.com/fp-js/fj-and.git"
12+
},
13+
"keywords": [
14+
"fp-js",
15+
"fp-dom",
16+
"fp",
17+
"dom",
18+
"and"
19+
],
20+
"contributors": [
21+
"hemanth.hm <[email protected]> (http://www.h3manth.com)",
22+
"stoeffel <[email protected]> (http://www.schtoeffel.ch)"
23+
],
24+
"license": "MIT",
25+
"bugs": {
26+
"url": "https://github.com/fp-js/fj-and/issues"
27+
},
28+
"homepage": "https://github.com/fp-js/fj-and",
29+
"devDependencies": {
30+
"gulp": "^3.8.10",
31+
"gulp-6to5": "^3.0.0",
32+
"gulp-rename": "^1.2.0",
33+
"gulp-run": "^1.6.6",
34+
"gulp-sourcemaps": "^1.3.0",
35+
"gulp-watch": "^4.1.0",
36+
"prova": "^2.1.1"
37+
},
38+
"dependencies": {
39+
"fj-curry": "^1.0.0"
40+
}
41+
}

test.es6

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import test from 'prova';
2+
import or from './';
3+
4+
5+
test('fj-or', (t) => {
6+
t.plan(5);
7+
8+
let T = () => true;
9+
let F = () => false;
10+
11+
t.ok(or(T, T)());
12+
t.ok(or(T)(T)());
13+
t.ok(or(T, F)());
14+
t.notOk(or(F, F)());
15+
t.notOk(or(F, F)());
16+
});

test.js

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
"use strict";
2+
3+
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
4+
5+
var test = _interopRequire(require("prova"));
6+
7+
var or = _interopRequire(require("./"));
8+
9+
10+
11+
12+
test("fj-or", function (t) {
13+
t.plan(5);
14+
15+
var T = function () {
16+
return true;
17+
};
18+
var F = function () {
19+
return false;
20+
};
21+
22+
t.ok(or(T, T)());
23+
t.ok(or(T)(T)());
24+
t.ok(or(T, F)());
25+
t.notOk(or(F, F)());
26+
t.notOk(or(F, F)());
27+
});

0 commit comments

Comments
 (0)