initial commit
This commit is contained in:
26
node_modules/hex-color-regex/.editorconfig
generated
vendored
Normal file
26
node_modules/hex-color-regex/.editorconfig
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
# .editorconfig <https://github.com/tunnckoCore/dotfiles>
|
||||
#
|
||||
# Copyright (c) 2015 Charlike Mike Reagent, contributors.
|
||||
# Released under the MIT license.
|
||||
#
|
||||
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
indent_size = 2
|
||||
indent_style = space
|
||||
|
||||
[*.js]
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.php]
|
||||
indent_size = 4
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.md]
|
||||
insert_final_newline = false
|
||||
trim_trailing_whitespace = false
|
||||
56
node_modules/hex-color-regex/.npmignore
generated
vendored
Normal file
56
node_modules/hex-color-regex/.npmignore
generated
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
# .gitignore <https://github.com/tunnckoCore/dotfiles>
|
||||
#
|
||||
# Copyright (c) 2015 Charlike Mike Reagent, contributors.
|
||||
# Released under the MIT license.
|
||||
#
|
||||
|
||||
# Always-ignore dirs #
|
||||
# ####################
|
||||
_gh_pages
|
||||
node_modules
|
||||
bower_components
|
||||
components
|
||||
vendor
|
||||
build
|
||||
dest
|
||||
dist
|
||||
src
|
||||
lib-cov
|
||||
coverage
|
||||
nbproject
|
||||
cache
|
||||
temp
|
||||
tmp
|
||||
hex-color-regex
|
||||
|
||||
# Packages #
|
||||
# ##########
|
||||
*.7z
|
||||
*.dmg
|
||||
*.gz
|
||||
*.iso
|
||||
*.jar
|
||||
*.rar
|
||||
*.tar
|
||||
*.zip
|
||||
|
||||
# OS, Logs and databases #
|
||||
# #########################
|
||||
*.pid
|
||||
*.dat
|
||||
*.log
|
||||
*.sql
|
||||
*.sqlite
|
||||
*~
|
||||
~*
|
||||
|
||||
# Another files #
|
||||
# ###############
|
||||
Icon?
|
||||
.DS_Store*
|
||||
Thumbs.db
|
||||
ehthumbs.db
|
||||
Desktop.ini
|
||||
npm-debug.log
|
||||
.directory
|
||||
._*
|
||||
31
node_modules/hex-color-regex/.travis.yml
generated
vendored
Normal file
31
node_modules/hex-color-regex/.travis.yml
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
language: "node_js"
|
||||
sudo: false
|
||||
|
||||
node_js:
|
||||
- "0.8"
|
||||
- "0.10"
|
||||
- "0.12"
|
||||
- "1"
|
||||
- "2"
|
||||
|
||||
notifications:
|
||||
email:
|
||||
on_success: never
|
||||
on_failure: never
|
||||
|
||||
before_script:
|
||||
- npm install standard
|
||||
- standard
|
||||
|
||||
script:
|
||||
- npm install istanbul-harmony
|
||||
- node --harmony node_modules/.bin/istanbul cover test.js
|
||||
|
||||
after_success:
|
||||
- npm install coveralls
|
||||
- cat ./coverage/lcov.info | coveralls
|
||||
|
||||
matrix:
|
||||
allow_failures:
|
||||
- node_js: "0.8"
|
||||
- node_js: "0.10"
|
||||
45
node_modules/hex-color-regex/CHANGELOG.md
generated
vendored
Normal file
45
node_modules/hex-color-regex/CHANGELOG.md
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
|
||||
|
||||
## 1.1.0 / 2017-06-03
|
||||
- Release v1.1.0
|
||||
- Add support for "alpha" channel in hex colors (merge [#11](https://github.com/regexhq/hex-color-regex/pull/11)):
|
||||
- `#RRGGBBAA`
|
||||
- `#RGBA`
|
||||
|
||||
Reference
|
||||
- https://googlechrome.github.io/samples/css-alpha-channel/
|
||||
- https://www.chromestatus.com/feature/5685348285808640
|
||||
|
||||
## 1.0.3 / 2015-07-14
|
||||
- Release v1.0.3 / npm@v1.0.3
|
||||
- update stuff, add related libs, @tunnckoCore
|
||||
- merge pull request #8, @kevva
|
||||
- Null guard, @bevacqua
|
||||
|
||||
## 1.0.2 / 2015-06-01
|
||||
- Release v1.0.2 / npm@v1.0.2
|
||||
- david to watch for devDeps
|
||||
- matching groups, close #6
|
||||
- update readme example
|
||||
- add more tests
|
||||
- switch coveralls with codeclimate coverage
|
||||
- add and update tests
|
||||
- update, close #5
|
||||
- add strict mode, merge #4
|
||||
|
||||
## 1.0.1 / 2015-03-26
|
||||
- Release v1.0.1 / npm@v1.0.1
|
||||
- bump deps
|
||||
- add `bluebird` as devDep
|
||||
|
||||
## 1.0.0 / 2015-02-03
|
||||
- Release v1.0.0 / npm@v1.0.0
|
||||
- add keywords
|
||||
- add usage examples
|
||||
- update tests
|
||||
- remove `after_script` from travis
|
||||
- replace `mocha` with `mukla`
|
||||
- fix regex
|
||||
|
||||
## 0.0.0 - 2015-02-02
|
||||
- first commits
|
||||
32
node_modules/hex-color-regex/CONTRIBUTING.md
generated
vendored
Normal file
32
node_modules/hex-color-regex/CONTRIBUTING.md
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
# Contributing Guidelines
|
||||
|
||||
Contributions are always welcome!
|
||||
|
||||
**Before spending lots of time on something, ask for feedback on your idea first!**
|
||||
|
||||
Please search issues and pull requests before adding something new to avoid duplicating efforts and conversations.
|
||||
|
||||
|
||||
## Installing
|
||||
|
||||
Fork and clone the repo, then `npm install` to install all dependencies and `npm test` to ensure all is okey before you start anything.
|
||||
|
||||
|
||||
## Testing
|
||||
|
||||
Tests are run with `npm test`. Please ensure all tests are passing before submitting a pull request (unless you're creating a failing test to increase test coverage or show a problem).
|
||||
|
||||
## Code Style
|
||||
|
||||
[![standard][standard-image]][standard-url]
|
||||
|
||||
This repository uses [`standard`][standard-url] to maintain code style and consistency, and to avoid style arguments. You are encouraged to install it globally. `npm test` runs `standard` so you don't have to!
|
||||
|
||||
```
|
||||
npm i standard -g
|
||||
```
|
||||
|
||||
It is intentional to don't have `standard`, `istanbul` and `coveralls` in the devDependencies. Travis will handle all that stuffs. That approach will save bandwidth also installing and development time.
|
||||
|
||||
[standard-image]: https://cdn.rawgit.com/feross/standard/master/badge.svg
|
||||
[standard-url]: https://github.com/feross/standard
|
||||
21
node_modules/hex-color-regex/LICENSE.md
generated
vendored
Normal file
21
node_modules/hex-color-regex/LICENSE.md
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
# The MIT License
|
||||
|
||||
Copyright (c) 2015 [Charlike Make Reagent](http://j.mp/1stW47C)
|
||||
|
||||
> Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
> of this software and associated documentation files (the "Software"), to deal
|
||||
> in the Software without restriction, including without limitation the rights
|
||||
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
> copies of the Software, and to permit persons to whom the Software is
|
||||
> furnished to do so, subject to the following conditions:
|
||||
>
|
||||
> The above copyright notice and this permission notice shall be included in
|
||||
> all copies or substantial portions of the Software.
|
||||
>
|
||||
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
> SOFTWARE.
|
||||
170
node_modules/hex-color-regex/README.md
generated
vendored
Normal file
170
node_modules/hex-color-regex/README.md
generated
vendored
Normal file
@@ -0,0 +1,170 @@
|
||||
# [hex-color-regex][author-www-url] [![npmjs.com][npmjs-img]][npmjs-url] [![The MIT License][license-img]][license-url]
|
||||
|
||||
> The best regular expression (regex) for matching hex color values from string.
|
||||
|
||||
[![code climate][codeclimate-img]][codeclimate-url] [![standard code style][standard-img]][standard-url] [![travis build status][travis-img]][travis-url] [![coverage status][coverage-img]][coverage-url] [![dependency status][david-img]][david-url]
|
||||
|
||||
|
||||
## Install
|
||||
```
|
||||
npm i hex-color-regex --save
|
||||
npm test
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
> For more use-cases see the [tests](./test.js)
|
||||
|
||||
- `[opts]` **{Object}** pass `strict: true` for strict mode
|
||||
- `return` **{RegExp}**
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
var hexColorRegex = require('hex-color-regex')
|
||||
|
||||
hexColorRegex().test('#f3f}') //=> true
|
||||
hexColorRegex({strict: true}).test('#f3f}') //=> false
|
||||
|
||||
hexColorRegex().test('foo #f3f bar') //=> true
|
||||
hexColorRegex({strict: true}).test('foo #f3f bar') //=> false
|
||||
|
||||
hexColorRegex().test('#a54f2c}') //=> true
|
||||
hexColorRegex({strict: true}).test('#a54f2c}') //=> false
|
||||
|
||||
hexColorRegex().test('foo #a54f2c bar') //=> true
|
||||
hexColorRegex({strict: true}).test('foo #a54f2c bar') //=> false
|
||||
|
||||
hexColorRegex().test('#ffff') //=> false
|
||||
hexColorRegex().test('ffff') //=> false
|
||||
|
||||
hexColorRegex().test('#fff') //=> true
|
||||
hexColorRegex().test('fff') //=> false
|
||||
|
||||
hexColorRegex().test('#4g1') //=> false
|
||||
hexColorRegex().test('4g1') //=> false
|
||||
hexColorRegex().test('#zY1') //=> false
|
||||
hexColorRegex().test('zY1') //=> false
|
||||
hexColorRegex().test('#7f68ZY') //=> false
|
||||
hexColorRegex().test('7f68ZY') //=> false
|
||||
hexColorRegex().test('ffffff') //=> false
|
||||
|
||||
hexColorRegex().test('#afebe3') //=> true
|
||||
hexColorRegex().test('#AFEBE3') //=> true
|
||||
hexColorRegex().test('#3cb371') //=> true
|
||||
hexColorRegex().test('#3CB371') //=> true
|
||||
hexColorRegex().test('#556b2f') //=> true
|
||||
hexColorRegex().test('#556B2F') //=> true
|
||||
hexColorRegex().test('#708090') //=> true
|
||||
hexColorRegex().test('#7b68ee') //=> true
|
||||
hexColorRegex().test('#7B68EE') //=> true
|
||||
hexColorRegex().test('#eeeeee') //=> true
|
||||
hexColorRegex().test('#ffffff') //=> true
|
||||
hexColorRegex().test('#111111') //=> true
|
||||
|
||||
hexColorRegex().test('#afe') //=> true
|
||||
hexColorRegex().test('#AF3') //=> true
|
||||
hexColorRegex().test('#3cb') //=> true
|
||||
hexColorRegex().test('#3CB') //=> true
|
||||
hexColorRegex().test('#b2f') //=> true
|
||||
hexColorRegex().test('#5B2') //=> true
|
||||
hexColorRegex().test('#708') //=> true
|
||||
hexColorRegex().test('#68e') //=> true
|
||||
hexColorRegex().test('#7AF') //=> true
|
||||
hexColorRegex().test('#777') //=> true
|
||||
hexColorRegex().test('#FFF') //=> true
|
||||
hexColorRegex().test('#fff') //=> true
|
||||
```
|
||||
|
||||
|
||||
## Matching groups
|
||||
|
||||
- `match[0]` hex value with hash - `#f3f3f3`
|
||||
- `match[1]` hex value without the hash - `f3f3f3`
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
hexColorRegex().exec('foo #fff bar')
|
||||
//=> [ '#fff', 'fff', index: 4, input: 'foo #fff bar' ]
|
||||
|
||||
hexColorRegex({strict: true}).exec('foo #fff bar')
|
||||
//=> null
|
||||
|
||||
hexColorRegex().exec('foo #f3f3f3 bar')
|
||||
//=> [ '#f3f3f3', 'f3f3f3', index: 4, input: 'foo #f3f3f3 bar' ]
|
||||
|
||||
hexColorRegex({strict: true}).exec('foo #f3f3f3 bar')
|
||||
//=> null
|
||||
```
|
||||
|
||||
|
||||
## Related
|
||||
- [benz](https://github.com/tunnckocore/benz): Compose your control flow with absolute elegance. Support async/await, callbacks, thunks, generators, promises, observables, child… [more](https://github.com/tunnckocore/benz)
|
||||
- [is-hexcolor](https://github.com/tunnckocore/is-hexcolor): Check that given value is valid hex color, using `hex-color-regex` - the best regex for… [more](https://github.com/tunnckocore/is-hexcolor)
|
||||
- [is-ansi](https://github.com/tunnckocore/is-ansi): Check that given string contain ANSI color codes, without CLI
|
||||
- [is-missing](https://github.com/tunnckocore/is-missing): Check that given `name` or `user/repo` exists in npm registry or in github as user… [more](https://github.com/tunnckocore/is-missing)
|
||||
- [is-kindof](https://github.com/tunnckocore/is-kindof): Check type of given javascript value. Support promises, generators, streams, and native types. Thin wrapper… [more](https://github.com/tunnckocore/is-kindof)
|
||||
- [is-typeof-error](https://github.com/tunnckocore/is-typeof-error): Check that given value is any type of error and instanceof Error
|
||||
- [is-async-function](https://github.com/tunnckocore/is-async-function): Check that given function is async (callback) function or not. Trying to guess that based… [more](https://github.com/tunnckocore/is-async-function)
|
||||
- [kind-error](https://github.com/tunnckocore/kind-error): Correct inheriting from `Error`. Supports constructing from an object of properties - focused on assertion.
|
||||
- [kind-of-extra](https://github.com/tunnckocore/kind-of-extra): Extends `kind-of` type check utility with support for promises, generators, streams and errors. Like `kindof(Promise.resolve(1))… [more](https://github.com/tunnckocore/kind-of-extra)
|
||||
- [vez](https://github.com/tunnckocore/vez): Middleware composition at new level. Ultimate alternative to `ware`, `plugins`, `koa-compose` and `composition` packages. Allows… [more](https://github.com/tunnckocore/vez)
|
||||
|
||||
|
||||
## Contributing
|
||||
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/regexhq/hex-color-regex/issues/new).
|
||||
But before doing anything, please read the [CONTRIBUTING.md](./CONTRIBUTING.md) guidelines.
|
||||
|
||||
|
||||
## [Charlike Make Reagent](http://j.mp/1stW47C) [![new message to charlike][new-message-img]][new-message-url] [![freenode #charlike][freenode-img]][freenode-url]
|
||||
|
||||
[![tunnckocore.tk][author-www-img]][author-www-url] [![keybase tunnckocore][keybase-img]][keybase-url] [![tunnckoCore npm][author-npm-img]][author-npm-url] [![tunnckoCore twitter][author-twitter-img]][author-twitter-url] [![tunnckoCore github][author-github-img]][author-github-url]
|
||||
|
||||
|
||||
[npmjs-url]: https://www.npmjs.com/package/hex-color-regex
|
||||
[npmjs-img]: https://img.shields.io/npm/v/hex-color-regex.svg?label=hex-color-regex
|
||||
|
||||
[license-url]: https://github.com/regexhq/hex-color-regex/blob/master/LICENSE.md
|
||||
[license-img]: https://img.shields.io/badge/license-MIT-blue.svg
|
||||
|
||||
|
||||
[codeclimate-url]: https://codeclimate.com/github/regexps/hex-color-regex
|
||||
[codeclimate-img]: https://img.shields.io/codeclimate/github/regexps/hex-color-regex.svg
|
||||
|
||||
[coverage-url]: https://codeclimate.com/github/regexps/hex-color-regex
|
||||
[coverage-img]: https://img.shields.io/codeclimate/coverage/github/regexps/hex-color-regex.svg
|
||||
|
||||
[travis-url]: https://travis-ci.org/regexhq/hex-color-regex
|
||||
[travis-img]: https://img.shields.io/travis/regexhq/hex-color-regex.svg
|
||||
|
||||
[coveralls-url]: https://coveralls.io/r/regexhq/hex-color-regex
|
||||
[coveralls-img]: https://img.shields.io/coveralls/regexhq/hex-color-regex.svg
|
||||
|
||||
[david-url]: https://david-dm.org/regexhq/hex-color-regex
|
||||
[david-img]: https://img.shields.io/david/dev/regexhq/hex-color-regex.svg
|
||||
|
||||
[standard-url]: https://github.com/feross/standard
|
||||
[standard-img]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg
|
||||
|
||||
|
||||
[author-www-url]: http://www.tunnckocore.tk
|
||||
[author-www-img]: https://img.shields.io/badge/www-tunnckocore.tk-fe7d37.svg
|
||||
|
||||
[keybase-url]: https://keybase.io/tunnckocore
|
||||
[keybase-img]: https://img.shields.io/badge/keybase-tunnckocore-8a7967.svg
|
||||
|
||||
[author-npm-url]: https://www.npmjs.com/~tunnckocore
|
||||
[author-npm-img]: https://img.shields.io/badge/npm-~tunnckocore-cb3837.svg
|
||||
|
||||
[author-twitter-url]: https://twitter.com/tunnckoCore
|
||||
[author-twitter-img]: https://img.shields.io/badge/twitter-@tunnckoCore-55acee.svg
|
||||
|
||||
[author-github-url]: https://github.com/tunnckoCore
|
||||
[author-github-img]: https://img.shields.io/badge/github-@tunnckoCore-4183c4.svg
|
||||
|
||||
[freenode-url]: http://webchat.freenode.net/?channels=charlike
|
||||
[freenode-img]: https://img.shields.io/badge/freenode-%23charlike-5654a4.svg
|
||||
|
||||
[new-message-url]: https://github.com/tunnckoCore/messages
|
||||
[new-message-img]: https://img.shields.io/badge/send%20me-message-green.svg
|
||||
16
node_modules/hex-color-regex/index.js
generated
vendored
Normal file
16
node_modules/hex-color-regex/index.js
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
/*!
|
||||
* hex-color-regex <https://github.com/regexps/hex-color-regex>
|
||||
*
|
||||
* Copyright (c) 2015 Charlike Mike Reagent <@tunnckoCore> (http://www.tunnckocore.tk)
|
||||
* Released under the MIT license.
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
module.exports = function hexColorRegex(opts) {
|
||||
opts = opts && typeof opts === 'object' ? opts : {}
|
||||
|
||||
return opts.strict
|
||||
? /^#([a-f0-9]{3,4}|[a-f0-9]{4}(?:[a-f0-9]{2}){1,2})\b$/i
|
||||
: /#([a-f0-9]{3}|[a-f0-9]{4}(?:[a-f0-9]{2}){0,2})\b/gi
|
||||
}
|
||||
68
node_modules/hex-color-regex/package.json
generated
vendored
Normal file
68
node_modules/hex-color-regex/package.json
generated
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
{
|
||||
"_from": "hex-color-regex@^1.1.0",
|
||||
"_id": "hex-color-regex@1.1.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-l9sfDFsuqtOqKDsQdqrMRk0U85RZc0RtOR9yPI7mRVOa4FsR/BVnZ0shmQRM96Ji99kYZP/7hn1cedc1+ApsTQ==",
|
||||
"_location": "/hex-color-regex",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "hex-color-regex@^1.1.0",
|
||||
"name": "hex-color-regex",
|
||||
"escapedName": "hex-color-regex",
|
||||
"rawSpec": "^1.1.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^1.1.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/is-color-stop"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/hex-color-regex/-/hex-color-regex-1.1.0.tgz",
|
||||
"_shasum": "4c06fccb4602fe2602b3c93df82d7e7dbf1a8a8e",
|
||||
"_spec": "hex-color-regex@^1.1.0",
|
||||
"_where": "D:\\Air66 Files\\dev_sites\\www.airurl.dev.cc\\user\\plugins\\air66Theme\\node_modules\\is-color-stop",
|
||||
"author": {
|
||||
"name": "Charlike Mike Reagent",
|
||||
"email": "@tunnckoCore",
|
||||
"url": "http://www.tunnckocore.tk"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/regexps/hex-color-regex/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {},
|
||||
"deprecated": false,
|
||||
"description": "The best regular expression (regex) for matching hex color values from string.",
|
||||
"devDependencies": {
|
||||
"mukla": "^0.4.9"
|
||||
},
|
||||
"homepage": "https://github.com/regexps/hex-color-regex#readme",
|
||||
"keywords": [
|
||||
"color",
|
||||
"colors",
|
||||
"css",
|
||||
"expr",
|
||||
"expression",
|
||||
"expressions",
|
||||
"hex",
|
||||
"match",
|
||||
"matching",
|
||||
"regex",
|
||||
"regexp",
|
||||
"regexps",
|
||||
"regular",
|
||||
"web"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"name": "hex-color-regex",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/regexps/hex-color-regex.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "standard && node test.js"
|
||||
},
|
||||
"version": "1.1.0"
|
||||
}
|
||||
294
node_modules/hex-color-regex/test.js
generated
vendored
Normal file
294
node_modules/hex-color-regex/test.js
generated
vendored
Normal file
@@ -0,0 +1,294 @@
|
||||
/*!
|
||||
* hex-color-regex <https://github.com/regexps/hex-color-regex>
|
||||
*
|
||||
* Copyright (c) 2015 Charlike Mike Reagent <@tunnckoCore> (http://www.tunnckocore.tk)
|
||||
* Released under the MIT license.
|
||||
*/
|
||||
|
||||
/* jshint asi:true */
|
||||
|
||||
'use strict'
|
||||
|
||||
var test = require('mukla')
|
||||
var hexColorRegex = require('./index')
|
||||
|
||||
var sixDigits = {
|
||||
pass: [
|
||||
'#afebe3',
|
||||
'#AFEBE3',
|
||||
'#3cb371',
|
||||
'#3CB371',
|
||||
'#556b2f',
|
||||
'#556B2F',
|
||||
'#708090',
|
||||
'#7b68ee',
|
||||
'#7B68EE',
|
||||
'#eeeeee',
|
||||
'#ffffff',
|
||||
'#123fff}',
|
||||
'#111111'
|
||||
],
|
||||
fail: [
|
||||
'afebe3',
|
||||
'AFEBE3',
|
||||
'3cb371',
|
||||
'ABC371',
|
||||
'556b2f',
|
||||
'5A6B2F',
|
||||
'708090',
|
||||
'7b68ee',
|
||||
'7B68EE',
|
||||
'eeeeee',
|
||||
'ffffff',
|
||||
'111111',
|
||||
'afebef',
|
||||
'3c537f',
|
||||
'556B2f',
|
||||
'708135',
|
||||
'EE3EF1',
|
||||
'7f68ZY',
|
||||
'#7f68ZY',
|
||||
'#7z68ZY',
|
||||
'#GR68',
|
||||
'#Z68',
|
||||
'#666EFR'
|
||||
]
|
||||
}
|
||||
|
||||
var threeDigits = {
|
||||
pass: [
|
||||
'#afe',
|
||||
'#AF3',
|
||||
'#3cb',
|
||||
'#3CB',
|
||||
'#b2f',
|
||||
'#5B2',
|
||||
'#708',
|
||||
'#68e',
|
||||
'#7AF',
|
||||
'#777',
|
||||
'#FFF',
|
||||
'#fff',
|
||||
'#f3f}',
|
||||
'#111'
|
||||
],
|
||||
fail: [
|
||||
'fff',
|
||||
'4zy',
|
||||
'4g1',
|
||||
'111',
|
||||
'Ge3',
|
||||
'zY1',
|
||||
'#ggg',
|
||||
'#4zy',
|
||||
'#4g1',
|
||||
'#Ge3',
|
||||
'#zY1'
|
||||
]
|
||||
}
|
||||
|
||||
var fourDigits = {
|
||||
pass: ['#afe0', '#AF31', '#3cba', '#3CBA', '#b2ff', '#5B2F'],
|
||||
fail: ['afe0', 'AF31', '#3cbg', '#3CBy', '#b2fz']
|
||||
}
|
||||
|
||||
var eightDigits = {
|
||||
pass: ['#afebe300', '#AFEBE3AA', '#3cb371ff', '#3CB371CC', '#556b2f55'],
|
||||
fail: ['afebe300', 'AFEBE3AA', '#3cb371fg', '#3CB371xy', '#556b2fz9']
|
||||
}
|
||||
|
||||
test('hex-color-regex:', function() {
|
||||
test('in no strict mode', function() {
|
||||
test('six digit hex', function() {
|
||||
test('should be `true`', function() {
|
||||
sixDigits.pass.forEach(function(hex) {
|
||||
test('when `' + hex + '` value', function() {
|
||||
test.equal(hexColorRegex().test(hex), true)
|
||||
})
|
||||
})
|
||||
test('when `foo #ae3f4c bar` value', function() {
|
||||
test.equal(hexColorRegex().test('foo #ae3f4c bar'), true)
|
||||
})
|
||||
})
|
||||
test('should be `false`', function() {
|
||||
sixDigits.fail.forEach(function(hex) {
|
||||
test('when `' + hex + '` value', function() {
|
||||
test.equal(hexColorRegex().test(hex), false)
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
test('three digit hex', function() {
|
||||
test('should be `true`', function() {
|
||||
threeDigits.pass.forEach(function(hex) {
|
||||
test('when `' + hex + '` value', function() {
|
||||
test.equal(hexColorRegex().test(hex), true)
|
||||
})
|
||||
})
|
||||
test('when `foo #e4f bar` value', function() {
|
||||
test.equal(hexColorRegex().test('foo #e4f bar'), true)
|
||||
})
|
||||
})
|
||||
test('should be `false`', function() {
|
||||
threeDigits.fail.forEach(function(hex) {
|
||||
test('when `' + hex + '` value', function() {
|
||||
test.equal(hexColorRegex().test(hex), false)
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
test('eight digit alpha channel hex', function() {
|
||||
test('should be `true`', function() {
|
||||
eightDigits.pass.forEach(function(hex) {
|
||||
test('when `' + hex + '` value', function() {
|
||||
test.equal(hexColorRegex().test(hex), true)
|
||||
})
|
||||
})
|
||||
test('when `foo #ae3f4c bar` value', function() {
|
||||
test.equal(hexColorRegex().test('foo #ae3f4c00 bar'), true)
|
||||
})
|
||||
})
|
||||
test('should be `false`', function() {
|
||||
eightDigits.fail.forEach(function(hex) {
|
||||
test('when `' + hex + '` value', function() {
|
||||
test.equal(hexColorRegex().test(hex), false)
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
test('four digit alpha channel hex', function() {
|
||||
test('should be `true`', function() {
|
||||
fourDigits.pass.forEach(function(hex) {
|
||||
test('when `' + hex + '` value', function() {
|
||||
test.equal(hexColorRegex().test(hex), true)
|
||||
})
|
||||
})
|
||||
test('when `foo #ae3f4c bar` value', function() {
|
||||
test.equal(hexColorRegex().test('foo #ae3f bar'), true)
|
||||
})
|
||||
})
|
||||
test('should be `false`', function() {
|
||||
fourDigits.fail.forEach(function(hex) {
|
||||
test('when `' + hex + '` value', function() {
|
||||
test.equal(hexColorRegex().test(hex), false)
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
test('using regex().exec(hex)', function() {
|
||||
sixDigits.pass.forEach(function(hex) {
|
||||
var hexed = hex.replace('}', '')
|
||||
test('should match `' + hexed + '` when `' + hex + '` hex', function() {
|
||||
var actual = hexColorRegex().exec(hex)[0]
|
||||
var expected = hexed
|
||||
|
||||
test.equal(actual, expected)
|
||||
})
|
||||
})
|
||||
test('should match `#ae3f4c` when `foo #ae3f4c bar` string', function() {
|
||||
var actual = hexColorRegex().exec('foo #ae3f4c bar')[0]
|
||||
var expected = '#ae3f4c'
|
||||
|
||||
test.equal(actual, expected)
|
||||
})
|
||||
threeDigits.pass.forEach(function(hex) {
|
||||
var hexed = hex.replace('}', '')
|
||||
test('should match `' + hexed + '` when `' + hex + '` hex', function() {
|
||||
var actual = hexColorRegex().exec(hex)[0]
|
||||
var expected = hexed
|
||||
|
||||
test.equal(actual, expected)
|
||||
})
|
||||
})
|
||||
test('should match `#e7f` when `foo #e7f bar` string', function() {
|
||||
var actual = hexColorRegex().exec('foo #e7f bar')[0]
|
||||
var expected = '#e7f'
|
||||
|
||||
test.equal(actual, expected)
|
||||
})
|
||||
eightDigits.pass.forEach(function(hex) {
|
||||
var hexed = hex.replace('}', '')
|
||||
test('should match `' + hexed + '` when `' + hex + '` hex', function() {
|
||||
var actual = hexColorRegex().exec(hex)[0]
|
||||
var expected = hexed
|
||||
|
||||
test.equal(actual, expected)
|
||||
})
|
||||
})
|
||||
test('should match `#ae3f4c00` when `foo #ae3f4c00 bar` string', function() {
|
||||
var actual = hexColorRegex().exec('foo #ae3f4c00 bar')[0]
|
||||
var expected = '#ae3f4c00'
|
||||
|
||||
test.equal(actual, expected)
|
||||
})
|
||||
fourDigits.pass.forEach(function(hex) {
|
||||
var hexed = hex.replace('}', '')
|
||||
test('should match `' + hexed + '` when `' + hex + '` hex', function() {
|
||||
var actual = hexColorRegex().exec(hex)[0]
|
||||
var expected = hexed
|
||||
|
||||
test.equal(actual, expected)
|
||||
})
|
||||
})
|
||||
test('should match `#e7f0` when `foo #e7f0 bar` string', function() {
|
||||
var actual = hexColorRegex().exec('foo #e7f0 bar')[0]
|
||||
var expected = '#e7f0'
|
||||
|
||||
test.equal(actual, expected)
|
||||
})
|
||||
})
|
||||
})
|
||||
test('in strict mode', function() {
|
||||
test('six digit hex `#123fff}` should return false', function() {
|
||||
test.equal(hexColorRegex({ strict: true }).test('#123fff}'), false)
|
||||
})
|
||||
test('string contain six digit hex `foo #ae3f4c bar` return false', function() {
|
||||
test.equal(hexColorRegex({ strict: true }).test('foo #ae3f4c bar'), false)
|
||||
})
|
||||
test('three digit hex `#f3f}` should return false', function() {
|
||||
test.equal(hexColorRegex({ strict: true }).test('#f3f}'), false)
|
||||
})
|
||||
test('string contain three digit hex `foo #e7f bar` return false', function() {
|
||||
test.equal(hexColorRegex({ strict: true }).test('foo #e7f bar'), false)
|
||||
})
|
||||
test('eight digit alpha channel hex `#123fff00}` should return false', function() {
|
||||
test.equal(hexColorRegex({ strict: true }).test('#123fff00}'), false)
|
||||
})
|
||||
test('string contain eight digit alpha channel hex `foo #ae3f4cff bar` return false', function() {
|
||||
test.equal(
|
||||
hexColorRegex({ strict: true }).test('foo #ae3f4cff bar'),
|
||||
false
|
||||
)
|
||||
})
|
||||
test('four digit alpha channel hex `#f3f0}` should return false', function() {
|
||||
test.equal(hexColorRegex({ strict: true }).test('#f3f0}'), false)
|
||||
})
|
||||
test('string contain four digit alpha channel hex `foo #e7ff bar` return false', function() {
|
||||
test.equal(hexColorRegex({ strict: true }).test('foo #e7ff bar'), false)
|
||||
})
|
||||
test('should not match when `foo #ae3f4c bar` string', function() {
|
||||
var actual = hexColorRegex({ strict: true }).exec('foo #ae3f4c bar')
|
||||
var expected = null
|
||||
|
||||
test.equal(actual, expected)
|
||||
})
|
||||
test('should not match when `foo #e7f bar` string', function() {
|
||||
var actual = hexColorRegex({ strict: true }).exec('foo #e7f bar')
|
||||
var expected = null
|
||||
|
||||
test.equal(actual, expected)
|
||||
})
|
||||
test('should not match when `foo #ae3f4cff bar` string', function() {
|
||||
var actual = hexColorRegex({ strict: true }).exec('foo #ae3f4cff bar')
|
||||
var expected = null
|
||||
|
||||
test.equal(actual, expected)
|
||||
})
|
||||
test('should not match when `foo #e7ff bar` string', function() {
|
||||
var actual = hexColorRegex({ strict: true }).exec('foo #e7ff bar')
|
||||
var expected = null
|
||||
|
||||
test.equal(actual, expected)
|
||||
})
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user