Skip to content

Commit

Permalink
feat: add noop
Browse files Browse the repository at this point in the history
Closes #36
  • Loading branch information
char0n committed Mar 29, 2017
1 parent fe8f4e2 commit 38877c5
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,11 @@ declare namespace RamdaAdjunct {
* Checks whether the passed value is complement of `integer`.
*/
isNotInteger(val: any): boolean

/**
* A function that performs no operations
*/
noop(): undefined
}

}
Expand Down
9 changes: 9 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Type
import isNotUndefined from './isNotUndefined';
import isUndefined from './isUndefined';
import isNull from './isNull';
Expand Down Expand Up @@ -34,7 +35,10 @@ import isFinite from './isFinite';
import isNotFinite from './isNotFinite';
import isInteger from './isInterger';
import isNotInteger from './isNotInteger';
// Function
import noop from './noop';

// Type
export { default as isNotUndefined } from './isNotUndefined';
export { default as isUndefined } from './isUndefined';
export { default as isNull } from './isNull';
Expand Down Expand Up @@ -71,11 +75,14 @@ export { default as isFinite } from './isFinite';
export { default as isNotFinite } from './isNotFinite';
export { default as isInteger } from './isInterger';
export { default as isNotInteger } from './isNotInteger';
// Function
export { default as noop } from './noop';

/**
* @namespace RA
*/
const RA = {
// Type
isNotUndefined,
isUndefined,
isNull,
Expand Down Expand Up @@ -112,6 +119,8 @@ const RA = {
isNotFinite,
isInteger,
isNotInteger,
// Function
noop,
};

export default RA;
15 changes: 15 additions & 0 deletions src/noop.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/**
* A function that performs no operations
*
* @func noop
* @memberOf RA
* @since {@link https://char0n.github.io/ramda-adjunct/1.0.0|v1.0.0}
* @category Function
* @sig ... -> undefined
* @return {undefined}
* @example
*
* RA.noop(); //=> undefined
* RA.noop(1, 2, 3); // undefined
*/
export default function noop() {}
11 changes: 11 additions & 0 deletions test/noop.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import RA from '../src/index';
import eq from './shared/eq';

describe('noop', function() {
it('tests `function` that performs no operations', function() {
eq(RA.noop(), undefined);
eq(RA.noop([1]), undefined);
eq(RA.noop(new Array()), undefined);
eq(RA.noop(1, 2, 3), undefined);
});
});

0 comments on commit 38877c5

Please sign in to comment.