Repository: pbiswas101/Mathball (js)

Issue:
Kaprekar Number
### Do the checklist before filing the issue:

- [ ] Is this something you can **debug and fix**?
- [x] Do you have Node.js and all the relevant dev-dependencies installed?
- [ ] Is this a **feature request** that you can add?

###### NOTE: Provide a clear and concise description of the feature that needs to be added! Or if its a bug, then provide the necessary steps to reproduce it.

- *Give your answer below:*

------------

[Function: **M.isKaprekar()**] needs to be added!
For more info:

https://www.geeksforgeeks.org/kaprekar-number/

*M.isKaprekar()* needs to accept a positive integer and all other arguments passed should throw a type error which needs to be handled gracefully! For error handling, you should refer to how other features like M.isArmstrong() is implemented.

Pull request description:
Adding Fibbinary numbers. Issue #128
### Do the checklist before submitting the PR:

- [x] Have you read the guidelines mentioned in **CONTRIBUTING.md**?
- [x] Have you squashed your commits?

**Q**: What version of *Node.js* you've used in the project? (`e.g. Node v10.11.0`)
**A**:v11.6.0

**Q**: Mention the *Issue Number*! (`e.g. Fixed #8`)
**A**:#128

- *Give additional information regarding the PR below:*

------------


Patch:
diff --git a/src/fibbinary/index.js b/src/fibbinary/index.js
new file mode 100644
index 0000000..284aa55
--- /dev/null
+++ b/src/fibbinary/index.js
@@ -0,0 +1,16 @@
+const validate = require('../validation/positive-integer');
+
+function isFibbinary(num){
+    if ((num & (num >> 1)) === 0) {
+        return true;
+    }
+
+    else{
+        return false;
+    }
+}
+
+exports.check = num => {
+    validate(num, 'fibbinary');
+    return isFibbinary(num);
+};
\ No newline at end of file


Test patch:
diff --git a/test/fibbinary-spec.js b/test/fibbinary-spec.js
new file mode 100644
index 0000000..4c9e7f2
--- /dev/null
+++ b/test/fibbinary-spec.js
@@ -0,0 +1,40 @@
+const assert = require('assert'),
+    fibbinary = require('../src/fibbinary').check;
+
+describe('[Function: fibbinary]', () => {
+    it('should be a function', () => {
+        assert.strictEqual(typeof fibbinary, 'function');
+    });
+
+    it('should return a boolean only', () => {
+        assert.strictEqual(typeof fibbinary(100), 'boolean');
+    });
+
+    it('should return a boolean only', () => {
+        assert.strictEqual(typeof fibbinary(31), 'boolean');
+    });
+
+    it('should return a \'true\' when 10 is passed as an argument', () => {
+        assert.strictEqual(fibbinary(10), true);
+    });
+
+    it('should return a \'false\' when 63 is passed as an argument', () => {
+        assert.strictEqual(fibbinary(63), false);
+    });
+
+    it('should throw an error when no arguments passed', () => {
+		assert.throws(() => fibbinary(), TypeError);
+    });
+    
+    it('should throw an error when a negative number is passed', () => {
+		assert.throws(() => fibbinary(-20), TypeError);
+    });
+    
+    it('should throw an error when a string is passed', () => {
+        assert.throws(() => fibbinary('asd'), TypeError);
+    });
+
+    it('should throw an error when a floating point number is passed', () => {
+        assert.throws(() => fibbinary(1.265436), TypeError);
+    });
+});
\ No newline at end of file