Skip to content
This repository was archived by the owner on Mar 28, 2018. It is now read-only.

Commit e846de5

Browse files
committed
Use standard style and ava
1 parent 517ab19 commit e846de5

File tree

6 files changed

+67
-18
lines changed

6 files changed

+67
-18
lines changed

.travis.yml

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
sudo: false
12
language: node_js
23
node_js:
3-
- 0.11
4-
- 0.10
4+
- 'stable'
5+
- '0.12'
6+
- '0.10'

README.md

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
1-
# CSS Url Regex
2-
3-
[![Build Status](https://travis-ci.org/cssstats/css-url-regex.svg?branch=master)](https://travis-ci.org/cssstats/css-url-regex)
1+
# css-url-regex [![Build Status](https://travis-ci.org/cssstats/css-url-regex.svg?branch=master)](https://travis-ci.org/johnotander/css-url-regex) [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](https://github.com/feross/standard)
42

53
A regular expression for matching CSS urls (`url(foo.css)`).
64

7-
In the near future this will be likely moved to <https://github.com/regexps>.
8-
95
## Installation
106

117
```
@@ -15,7 +11,7 @@ npm i --save css-url-regex
1511
## Usage
1612

1713
```javascript
18-
var cssUrl = require('css-url-regex');
14+
var cssUrl = require('css-url-regex')
1915

2016
cssUrl().test('url(bar.css)') // => true
2117
cssUrl().test('kljhsdf') // => false

index.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
'use strict';
1+
'use strict'
22

3-
module.exports = function() {
4-
return /url\(.*?\)/ig;
3+
module.exports = function () {
4+
return /url\(.*?\)/ig
55
}

license

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) John Otander <[email protected]> (johnotander.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.

package.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
"version": "0.0.1",
44
"description": "Regular expression for matching CSS urls.",
55
"main": "index.js",
6-
"directories": {
7-
"test": "test"
8-
},
6+
"files": [
7+
"index.js"
8+
],
99
"scripts": {
10-
"test": "mocha test"
10+
"test": "ava"
1111
},
1212
"repository": {
1313
"type": "git",
@@ -26,6 +26,6 @@
2626
},
2727
"homepage": "https://github.com/johnotander/css-url-regex",
2828
"devDependencies": {
29-
"mocha": "^2.0.1"
29+
"ava": "^0.2.0"
3030
}
3131
}

test/test.js renamed to test.js

+32-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,35 @@
1-
var assert = require('assert');
2-
var cssUrl = require('..');
1+
import test from 'ava'
2+
import cssUrlRegex from './'
33

4+
const matches = [
5+
'url(foo.css)',
6+
"url('foo.css')",
7+
'url(foo/bar.css)',
8+
'url(http://google.com/foo/bar)'
9+
]
10+
11+
const nonMatches = [
12+
'foo',
13+
'(foo.css)',
14+
'url (foo.css)'
15+
]
16+
17+
test('matches urls', t => {
18+
t.plan(matches.length)
19+
20+
matches.forEach((match) => {
21+
t.ok(cssUrlRegex().test(match))
22+
})
23+
})
24+
25+
test('does not match non existent urls', t => {
26+
t.plan(nonMatches.length)
27+
28+
nonMatches.forEach((nonMatch) => {
29+
t.notOk(cssUrlRegex().test(nonMatch))
30+
})
31+
})
32+
/*
433
describe('css-url-regex', function() {
534
635
it('should find a css url with no quotes', function() {
@@ -21,3 +50,4 @@ describe('css-url-regex', function() {
2150
["url(foo.css)", "url(bar.css)"]);
2251
});
2352
});
53+
*/

0 commit comments

Comments
 (0)