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
This repository was archived by the owner on Jun 9, 2025. It is now read-only.

Commit79a8fd1

Browse files
authored
Fix#17, add test case, release 0.23 (#18)
*Fix#17, add test case, release 0.23* Fix eslint for travis* Tweak travis* Tweak test case
1 parenteb2f057 commit79a8fd1

File tree

6 files changed

+29
-10
lines changed

6 files changed

+29
-10
lines changed

‎.eslintrc‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
{
2-
"ecmaFeatures": {
3-
"modules": true
4-
},
5-
"env": {
2+
"env": {
63
"node": true,
74
"es6": true,
85
"mocha": true

‎.travis.yml‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
language:node_js
22
node_js:
3-
-"6"
3+
-8
4+
-10
5+
-12
46
cache:
57
-node_modules
68
install:
79
-npm install
8-
-npm install -g eslint
910
-npm install -g codecov
1011
script:
11-
-eslint .
12+
-npm run lint
1213
-istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -R spec
1314
-codecov
1415

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ query
3737
.get()// /[a-z]{3}[0-9]*$/g
3838
```
3939

40-
Required Node6.0+ for the ES6 support, Or you can use[Babel](http://babeljs.io/) to support Node below 6.0.
40+
Required Node8.0+ for the ES6 support, Or you can use[Babel](http://babeljs.io/) to support Node below 6.0.
4141

4242
Using[Webpack](http://webpack.github.io) and[babel-loader](https://github.com/babel/babel-loader) to pack it if want to use in browsers.
4343

‎lib/Builder.js‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ class Builder {
215215
noDigit(){
216216
this._validateAndAddMethodType(METHOD_TYPE_CHARACTER,METHOD_TYPES_ALLOWED_FOR_CHARACTERS)
217217

218-
returnthis.add(`[^0-9]`)
218+
returnthis.add('[^0-9]')
219219
}
220220

221221
/**
@@ -761,6 +761,9 @@ class Builder {
761761
_mapCaptureIndexToName(result){
762762
constnames=this._captureNames
763763

764+
// No match
765+
if(!result){returnnull}
766+
764767
returnArray.prototype.reduce.call(result.slice(1),(result,current,index)=>{
765768
if(names[index]){
766769
result[names[index]]=current||''

‎package.json‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
{
22
"name":"srl",
3-
"version":"0.2.2",
3+
"version":"0.2.3",
44
"description":"Simple Regex Language",
55
"main":"lib/SRL.js",
66
"scripts": {
77
"test":"mocha",
8+
"lint":"eslint lib --fix",
89
"coverage":"istanbul cover _mocha"
910
},
1011
"repository": {
@@ -30,6 +31,7 @@
3031
},
3132
"homepage":"https://simple-regex.com",
3233
"devDependencies": {
34+
"eslint":"^6.8.0",
3335
"istanbul":"^0.4.5",
3436
"mocha":"^3.0.2",
3537
"mocha-lcov-reporter":"^1.2.0"

‎test/issue-17-test.js‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
'use strict'
2+
3+
constassert=require('assert')
4+
constSRL=require('../')
5+
6+
describe('Fix issue 17',()=>{
7+
it('Capture group name assignment fails',()=>{
8+
assert.doesNotThrow(()=>{
9+
constquery=newSRL('capture (literally "TEST") as test')
10+
constmatch=query.getMatch('WORD NOT HERE')
11+
assert.equal(match,null)
12+
},TypeError)
13+
})
14+
})
15+
16+

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp