Skip to content

Commit cbca81a

Browse files
committed
feat(package): Implements initial basic shape
2 parents 9f14f93 + 734059e commit cbca81a

4 files changed

Lines changed: 20 additions & 10 deletions

File tree

README.md

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
# kittik-shape-basic
22

3-
![Build Status](https://img.shields.io/travis/ghaiklor/kittik-shape-basic.svg)
4-
![Coverage](https://img.shields.io/coveralls/ghaiklor/kittik-shape-basic.svg)
3+
![Build Status](https://img.shields.io/travis/kittikjs/shape-basic.svg)
4+
![Coverage](https://img.shields.io/coveralls/kittikjs/shape-basic.svg)
5+
56
![Downloads](https://img.shields.io/npm/dm/kittik-shape-basic.svg)
67
![Downloads](https://img.shields.io/npm/dt/kittik-shape-basic.svg)
78
![npm version](https://img.shields.io/npm/v/kittik-shape-basic.svg)
8-
![dependencies](https://img.shields.io/david/ghaiklor/kittik-shape-basic.svg)
9-
![dev dependencies](https://img.shields.io/david/dev/ghaiklor/kittik-shape-basic.svg)
109
![License](https://img.shields.io/npm/l/kittik-shape-basic.svg)
1110

11+
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
12+
[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)
13+
![dependencies](https://img.shields.io/david/kittikjs/shape-basic.svg)
14+
![dev dependencies](https://img.shields.io/david/dev/kittikjs/shape-basic.svg)
15+
1216
Basic shape which is needed for creating other shapes
1317

1418
## Getting Started
@@ -19,10 +23,16 @@ Install it via npm:
1923
npm install kittik-shape-basic
2024
```
2125

22-
And include in your project:
26+
Import module and extend another one:
2327

2428
```javascript
25-
import kittik-shape-basic from 'kittik-shape-basic';
29+
import { Shape } from 'kittik-shape-basic';
30+
31+
export class Rectangle extends Shape {
32+
constructor(...args) {
33+
super(...args);
34+
}
35+
}
2636
```
2737

2838
## License

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@
2727
"babel-preset-stage-0": "6.1.18",
2828
"chai": "3.4.1",
2929
"coveralls": "2.11.4",
30-
"cz-conventional-changelog": "^1.1.4",
30+
"cz-conventional-changelog": "1.1.4",
3131
"isparta": "4.0.0",
3232
"mocha": "2.3.4",
33-
"semantic-release": "^4.3.5",
33+
"semantic-release": "4.3.5",
3434
"sinon": "1.17.2"
3535
},
3636
"config": {

src/Basic.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ export class Shape {
234234
*/
235235
static fromObject(obj) {
236236
if (!obj.name || !obj.options) throw new Error('It looks like it is not an Object representation of the Shape');
237-
if (obj.name !== this.name) throw new Error(`It is not an Object representation of the ${this.name}`);
237+
if (obj.name !== this.name) throw new Error(`${obj.name} is not an Object representation of the ${this.name}`);
238238

239239
return this.create(obj.options);
240240
}

test/unit/Basic.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ describe('Shape', () => {
124124

125125
it('Should properly throw error if trying to create Shape not from its representation', () => {
126126
let obj = {name: 'Rectangle', options: {}};
127-
assert.throws(() => Shape.fromObject(obj), Error, 'It is not an Object representation of the Shape');
127+
assert.throws(() => Shape.fromObject(obj), Error, 'Rectangle is not an Object representation of the Shape');
128128
});
129129

130130
it('Should properly create Shape instance from Object representation', () => {

0 commit comments

Comments
 (0)