Skip to content

Commit be6b864

Browse files
committed
feat: initail | docs | test
0 parents  commit be6b864

File tree

17 files changed

+321
-0
lines changed

17 files changed

+321
-0
lines changed

.editorconfig

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
indent_size = 2
6+
charset = utf-8
7+
trim_trailing_whitespace = true
8+
insert_final_newline = true
9+
10+
[*.md]
11+
trim_trailing_whitespace = false

.gitignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
node_modules
2+
bower_components
3+
coverage
4+
npm-debug.log
5+
yarn.lock
6+
package-lock.json
7+
.DS_Store
8+
.idea
9+
.vscode
10+
11+
# vscode localhistory
12+
.history

.npmignore

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
.idea
2+
.DS_Store
3+
**/npm-debug.log
4+
**/node_modules
5+
test
6+
__tests__
7+
src
8+
build
9+
docs
10+
gulpfile.js
11+
12+
.editorconfig
13+
.prettierrc
14+
Gemfile
15+
jest.config.js
16+
LICENSE.txt
17+
Rakefile
18+
express.js
19+
.vscode
20+
.release-it.json
21+
22+
23+
# vscode localhistory
24+
.history
25+
.release-it.json

.npmrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
sass_binary_site=https://npm.taobao.org/mirrors/node-sass/
2+
package-lock=false

.prettierrc

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"trailingComma": "none",
3+
"arrowParens": "always",
4+
"printWidth": 100,
5+
"bracketSpacing": true,
6+
"jsxBracketSameLine": true,
7+
"tabWidth": 2,
8+
"semi": true,
9+
"singleQuote": true,
10+
"overrides": [
11+
{
12+
"files": "*.scss",
13+
"options": {
14+
"trailingComma": "none",
15+
"tabWidth": 2,
16+
"parser": "scss"
17+
}
18+
},
19+
{
20+
"files": "*.json",
21+
"options": {
22+
"trailingComma": "none",
23+
"tabWidth": 2,
24+
"parser": "json"
25+
}
26+
},
27+
{
28+
"files": "*.md",
29+
"options": {
30+
"trailingComma": "none",
31+
"tabWidth": 2,
32+
"parser": "json"
33+
}
34+
}
35+
]
36+
}

.release-it.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"git": {
3+
"requireCleanWorkingDir": false
4+
},
5+
"hooks": {
6+
"after:init": [
7+
"npm run test",
8+
"t2k"
9+
],
10+
"after:bump": [
11+
"npm run build"
12+
]
13+
},
14+
"github": {
15+
"release": true
16+
}
17+
}

LICENSE.txt

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

README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# next-regex-index-of
2+
> JavaScript's String.indexOf() that allows for regular expressions.
3+
4+
[![version][version-image]][version-url]
5+
[![license][license-image]][license-url]
6+
[![size][size-image]][size-url]
7+
[![download][download-image]][download-url]
8+
9+
## installation
10+
```bash
11+
npm install -S @jswork/next-regex-index-of
12+
```
13+
14+
## usage
15+
```js
16+
import '@jswork/next-regex-index-of';
17+
18+
const str = `What's this? 这是什么?`;
19+
const res = nx.regexIndexOf(str, /[\u4e00-\u9fa5]/); // -1
20+
```
21+
22+
## license
23+
Code released under [the MIT license](https://github.com/afeiship/next-regex-index-of/blob/master/LICENSE.txt).
24+
25+
[version-image]: https://img.shields.io/npm/v/@jswork/next-regex-index-of
26+
[version-url]: https://npmjs.org/package/@jswork/next-regex-index-of
27+
28+
[license-image]: https://img.shields.io/npm/l/@jswork/next-regex-index-of
29+
[license-url]: https://github.com/afeiship/next-regex-index-of/blob/master/LICENSE.txt
30+
31+
[size-image]: https://img.shields.io/bundlephobia/minzip/@jswork/next-regex-index-of
32+
[size-url]: https://github.com/afeiship/next-regex-index-of/blob/master/dist/next-regex-index-of.min.js
33+
34+
[download-image]: https://img.shields.io/npm/dm/@jswork/next-regex-index-of
35+
[download-url]: https://www.npmjs.com/package/@jswork/next-regex-index-of

__tests__/index.spec.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
(function () {
2+
require('../src');
3+
4+
describe('api.basic test', () => {
5+
test('nx.regexIndexOf null string should return -1', () => {
6+
const res = nx.regexIndexOf(null, /xx/);
7+
expect(res).toBe(-1);
8+
});
9+
10+
test('nx.regexIndexOf search /[\u4e00-\u9fa5]/', () => {
11+
const str = `What's this? 这是什么?`;
12+
const res = nx.regexIndexOf(str, /[\u4e00-\u9fa5]/);
13+
expect(res).toBe(13);
14+
});
15+
});
16+
})();

build/clean.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
(function() {
2+
'use strict';
3+
4+
const gulp = require('gulp');
5+
const $ = require('gulp-load-plugins')({
6+
pattern: ['gulp-*', 'gulp.*', 'del']
7+
});
8+
9+
//clean
10+
gulp.task('clean', function() {
11+
return $.del('dist');
12+
});
13+
})();

0 commit comments

Comments
 (0)