Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7896123

Browse files
committed
build: generates build 0.1.0
1 parentce2c128 commit7896123

File tree

12 files changed

+140
-37
lines changed

12 files changed

+140
-37
lines changed

‎LICENSE‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2019 Codevor - js-library-boilerplate
3+
Copyright (c) 2019 Codevor - js-is-empty
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

‎README.md‎

Lines changed: 31 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,49 @@
1-
#js-library-boilerplate
1+
#📭Empty Checker
22

33
[![License][license-badge]][license-url][![Travis CI][travis-badge]][travis-url][![Coverage Status][coverage-badge]][coverage-url][![Commitizen][commitizen-badge]][commitizen-url]
44

5-
>js-library-boilerplate-description.
5+
📭`js-is-empty` makes your empty checks for you. We have empty checks for
6+
7+
-`Array`
8+
-`Object`
9+
-`String`
610

711
##Installation
812

9-
js-library-boilerplate is available on npm/yarn:
13+
`js-is-empty` is available on npm/yarn:
1014

1115
```bash
12-
$ npm install js-library-boilerplate --save
13-
$ yarn add js-library-boilerplate
16+
$ npm install@codevor/js-is-empty --save
17+
$ yarn add@codevor/js-is-empty
1418
```
1519

1620
##Usage
1721

1822
###With ES6/import
1923

2024
```js
21-
import {sum }from'js-library-boilerplate';
25+
import {isArrayEmpty,isObjectEmpty }from'@codevor/js-is-empty';
26+
27+
constmyEmptyArray= [];
28+
constperson= { name:'John Doe', age:32 };
2229

23-
sum(2,2);// => 4
30+
isArrayEmpty(myEmptyArray);// => true
31+
isObjectEmpty(person);// => false
2432
```
2533

2634
###With require
2735

2836
```js
29-
constsum=require('js-library-boilerplate').sum;
37+
constjsIsEmpty=require('@codevor/js-is-empty');
38+
39+
constisArrayEmpty=jsIsEmpty.isArrayEmpty;
40+
constisObjectEmpty=jsIsEmpty.isObjectEmpty;
41+
42+
constmyEmptyArray= [];
43+
constperson= { name:'John Doe', age:32 };
3044

31-
sum(2,2);// => 4
45+
isArrayEmpty(myEmptyArray);// => true
46+
isObjectEmpty(person);// => false
3247
```
3348

3449
##Contributing
@@ -37,21 +52,21 @@ Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code of conduc
3752

3853
##Changelog
3954

40-
This project adheres to[Semantic Versioning](https://semver.org/). Every release, along with the migration instructions, is documented on the Github[Releases](https://github.com/codevor/js-library-boilerplate/releases) page.
55+
This project adheres to[Semantic Versioning](https://semver.org/). Every release, along with the migration instructions, is documented on the Github[Releases](https://github.com/codevor/js-is-empty/releases) page.
4156

4257
##Bugs and Sugestions
4358

44-
Report bugs or do suggestions using the[issues](https://github.com/codevor/js-library-boilerplate/issues).
59+
Report bugs or do suggestions using the[issues](https://github.com/codevor/js-is-empty/issues).
4560

4661
##License
4762

4863
[MIT License](LICENSE) ©[Codevor](https://github.com/codevor)
4964

50-
[license-badge]:https://img.shields.io/github/license/codevor/js-library-boilerplate.svg
65+
[license-badge]:https://img.shields.io/github/license/codevor/js-is-empty.svg
5166
[license-url]:https://opensource.org/licenses/MIT
52-
[coverage-badge]:https://coveralls.io/repos/github/codevor/js-library-boilerplate/badge.svg?branch=master
53-
[coverage-url]:https://coveralls.io/github/codevor/js-library-boilerplate?branch=master
54-
[travis-badge]:https://travis-ci.org/codevor/js-library-boilerplate.svg?branch=master
55-
[travis-url]:https://travis-ci.org/codevor/js-library-boilerplate
67+
[coverage-badge]:https://coveralls.io/repos/github/codevor/js-is-empty/badge.svg?branch=master
68+
[coverage-url]:https://coveralls.io/github/codevor/js-is-empty?branch=master
69+
[travis-badge]:https://travis-ci.org/codevor/js-is-empty.svg?branch=master
70+
[travis-url]:https://travis-ci.org/codevor/js-is-empty
5671
[commitizen-badge]:https://img.shields.io/badge/commitizen-friendly-brightgreen.svg
5772
[commitizen-url]:http://commitizen.github.io/cz-cli/

‎package.json‎

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
2-
"name":"js-library-boilerplate",
2+
"name":"@codevor/js-is-empty",
33
"version":"0.1.0",
4-
"description":"js-library-boilerplate-description",
5-
"main":"dist/js-library-boilerplate.js",
6-
"unpkg":"dist/js-library-boilerplate.min.js",
4+
"description":"📭Basic empty checker",
5+
"main":"dist/js-is-empty.js",
6+
"unpkg":"dist/js-is-empty.min.js",
77
"scripts": {
88
"clean":"rimraf dist",
99
"dev":"NODE_ENV=dev webpack --progress --colors --watch",
@@ -15,17 +15,20 @@
1515
"prepublish":"yarn lint && yarn test && yarn clean && yarn build:umd",
1616
"commit":"git-cz"
1717
},
18-
"keywords": [],
19-
"author":"Helder Burato Berto <helder.burato@gmail.com> (https://helder.dev/)",
18+
"keywords": [
19+
"Utils",
20+
"Empty Checker"
21+
],
22+
"author":"Ilê Caian <ile.caian@gmail.com> (https://ile.pink/)",
2023
"license":"MIT",
2124
"repository": {
2225
"type":"git",
23-
"url":"git+https://github.com/codevor/js-library-boilerplate.git"
26+
"url":"git+https://github.com/codevor/js-is-empty.git"
2427
},
2528
"bugs": {
26-
"url":"https://github.com/codevor/js-library-boilerplate/issues"
29+
"url":"https://github.com/codevor/js-is-empty/issues"
2730
},
28-
"homepage":"https://github.com/codevor/js-library-boilerplate#readme",
31+
"homepage":"https://github.com/codevor/js-is-empty#readme",
2932
"devDependencies": {
3033
"@babel/cli":"^7.6.4",
3134
"@babel/core":"^7.6.4",
@@ -50,5 +53,8 @@
5053
"commitizen": {
5154
"path":"./node_modules/cz-conventional-changelog"
5255
}
56+
},
57+
"dependencies": {
58+
"@codevor/js-is-type":"^0.1.1"
5359
}
5460
}

‎src/index.js‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
exportfunctionsum(x,y){
2-
returnx+y;
3-
}
1+
export{defaultasisArrayEmpty}from'./is-array-empty';
2+
export{defaultasisObjectEmpty}from'./is-object-empty';
3+
export{defaultasisStringEmpty}from'./is-string-empty';

‎src/is-array-empty.js‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import{isArray}from'@codevor/js-is-type';
2+
3+
constisArrayEmpty=value=>isArray(value)&&value.length===0;
4+
5+
exportdefaultisArrayEmpty;

‎src/is-object-empty.js‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import{isObject}from'@codevor/js-is-type';
2+
3+
importisArrayEmptyfrom'./is-array-empty';
4+
5+
constisObjectEmpty=value=>isObject(value)&&isArrayEmpty(Object.keys(value));
6+
7+
exportdefaultisObjectEmpty;

‎src/is-string-empty.js‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import{isString}from'@codevor/js-is-type';
2+
3+
constisStringEmpty=value=>isString(value)&&value.length===0;
4+
5+
exportdefaultisStringEmpty;

‎tests/is-array-empty.test.js‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import{isArrayEmpty}from'../src';
2+
3+
describe('isArrayEmpty()',()=>{
4+
constarrayEmptyValue=[];
5+
constarrayValue=[4,true,'test'];
6+
conststringValue='This is a string';
7+
constbooleanValue=true;
8+
9+
test('correct empty array should be valid',()=>{
10+
expect(isArrayEmpty(arrayEmptyValue)).toBeTruthy();
11+
});
12+
13+
test('correct array but not empty should be invalid',()=>{
14+
expect(isArrayEmpty(arrayValue)).toBeFalsy();
15+
});
16+
17+
test('string value should be invalid',()=>{
18+
expect(isArrayEmpty(stringValue)).toBeFalsy();
19+
});
20+
21+
test('boolean value should be invalid',()=>{
22+
expect(isArrayEmpty(booleanValue)).toBeFalsy();
23+
});
24+
});

‎tests/is-object-empty.test.js‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import{isObjectEmpty}from'../src';
2+
3+
describe('isObjectEmpty()',()=>{
4+
constobjectEmptyValue={};
5+
constobjectValue={age:23,name:'John Doe'};
6+
conststringValue='Test string';
7+
constarrayValue=[];
8+
9+
test('correct empty object should be valid',()=>{
10+
expect(isObjectEmpty(objectEmptyValue)).toBeTruthy();
11+
});
12+
13+
test('correct object, but non empty should be invalid',()=>{
14+
expect(isObjectEmpty(objectValue)).toBeFalsy();
15+
});
16+
17+
test('string value should be invalid',()=>{
18+
expect(isObjectEmpty(stringValue)).toBeFalsy();
19+
});
20+
21+
test('array is kind of object but is not empty',()=>{
22+
expect(isObjectEmpty(arrayValue)).toBeFalsy();
23+
});
24+
});

‎tests/is-string-empty.test.js‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import{isStringEmpty}from'../src';
2+
3+
describe('isStringEmpty()',()=>{
4+
conststringEmptyValue='';
5+
conststringValue='This is a string';
6+
constnumberValue=2;
7+
constarrayValue=['a',5,true];
8+
9+
test('correct empty string should be valid',()=>{
10+
expect(isStringEmpty(stringEmptyValue)).toBeTruthy();
11+
});
12+
13+
test('correct string, but non empty should be invalid',()=>{
14+
expect(isStringEmpty(stringValue)).toBeFalsy();
15+
});
16+
17+
test('numper value should be invalid',()=>{
18+
expect(isStringEmpty(numberValue)).toBeFalsy();
19+
});
20+
21+
test('array value should be invalid',()=>{
22+
expect(isStringEmpty(arrayValue)).toBeFalsy();
23+
});
24+
});

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp