mirror of
https://github.com/idanoo/GoScrobble
synced 2025-07-01 13:42:20 +00:00
0.2.0 - Mid migration
This commit is contained in:
parent
139e6a915e
commit
7e38fdbd7d
42393 changed files with 5358157 additions and 62 deletions
6
web/node_modules/is-color-stop/.eslintrc
generated
vendored
Normal file
6
web/node_modules/is-color-stop/.eslintrc
generated
vendored
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"extends": "eslint-config-airbnb/base",
|
||||
"rules": {
|
||||
"strict": 0
|
||||
}
|
||||
}
|
6
web/node_modules/is-color-stop/.npmignore
generated
vendored
Normal file
6
web/node_modules/is-color-stop/.npmignore
generated
vendored
Normal file
|
@ -0,0 +1,6 @@
|
|||
.idea
|
||||
node_modules/
|
||||
.DS_Store
|
||||
npm-debug.log
|
||||
.nyc_output/
|
||||
coverage
|
9
web/node_modules/is-color-stop/.travis.yml
generated
vendored
Normal file
9
web/node_modules/is-color-stop/.travis.yml
generated
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
language: node_js
|
||||
|
||||
node_js:
|
||||
- "4"
|
||||
- "6"
|
||||
- "7"
|
||||
|
||||
after_success:
|
||||
- npm run coveralls
|
9
web/node_modules/is-color-stop/HISTORY.md
generated
vendored
Normal file
9
web/node_modules/is-color-stop/HISTORY.md
generated
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
# is-color-stop
|
||||
|
||||
## 1.0.0
|
||||
|
||||
- bump
|
||||
|
||||
## 1.1.0
|
||||
|
||||
- support calc
|
21
web/node_modules/is-color-stop/LICENSE
generated
vendored
Normal file
21
web/node_modules/is-color-stop/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2017 pigcan
|
||||
|
||||
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.
|
59
web/node_modules/is-color-stop/README.md
generated
vendored
Normal file
59
web/node_modules/is-color-stop/README.md
generated
vendored
Normal file
|
@ -0,0 +1,59 @@
|
|||
# is-color-stop
|
||||
|
||||
Check if a string is CSS color stop
|
||||
|
||||
[](https://npmjs.org/package/is-color-stop)
|
||||
[](https://travis-ci.org/pigcan/is-color-stop)
|
||||
[](https://coveralls.io/r/pigcan/is-color-stop)
|
||||
[](https://npmjs.org/package/is-color-stop)
|
||||
[](https://david-dm.org/pigcan/is-color-stop)
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```shell
|
||||
$ npm install is-color-stop
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const isColorStop = require('is-color-stop');
|
||||
|
||||
isColorStop('yellow') // true
|
||||
isColorStop('yellow', '12px') // true
|
||||
isColorStop('yellow', 'calc(100%)') // true
|
||||
isColorStop('yellow', 'px') // false
|
||||
|
||||
isColorStop.isColor('red') // true
|
||||
isColorStop.isColor('rgb(255)') // false
|
||||
|
||||
isColorStop.isRGB('rgb(255, 0, 0)') // true
|
||||
isColorStop.isRGB('rgb(255)') // false
|
||||
|
||||
isColorStop.isRGBA('rgba(255, 0, 0, .8)') // true
|
||||
isColorStop.isRGBA('rgba(255, 0, 0)') // false
|
||||
|
||||
isColorStop.isHSL('hsl(123, 45%, 67%)') // true
|
||||
isColorStop.isHSL('hsl(123, 45%)') // false
|
||||
|
||||
isColorStop.isHSLA('hsla(123, 45%, 67%, 0.4)') // true
|
||||
isColorStop.isHSLA('hsla(123, 45%, 67%)') // false
|
||||
|
||||
isColorStop.isHex('#fff') // true
|
||||
isColorStop.isHex('#ff') // false
|
||||
|
||||
isColorStop.isCSSColorName('tomato') // true
|
||||
isColorStop.isCSSColorName('hoge') // false
|
||||
|
||||
isColorStop.isCSSLengthUnit('px') // true
|
||||
isColorStop.isCSSLengthUnit('x') // false
|
||||
|
||||
isColorStop.isTransparent('transparent') // true
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2017 Pigcan
|
38
web/node_modules/is-color-stop/index.js
generated
vendored
Normal file
38
web/node_modules/is-color-stop/index.js
generated
vendored
Normal file
|
@ -0,0 +1,38 @@
|
|||
'use strict';
|
||||
|
||||
const isRGB = require('./lib/isRGB');
|
||||
const isRGBA = require('./lib/isRGBA');
|
||||
const isHSL = require('./lib/isHSL');
|
||||
const isHSLA = require('./lib/isHSLA');
|
||||
const isHex = require('./lib/isHex');
|
||||
const isCSSColorName = require('./lib/isCSSColorName');
|
||||
const isTransparent = require('./lib/isTransparent');
|
||||
const isCSSLengthUnit = require('./lib/isCSSLengthUnit');
|
||||
const isStop = require('./lib/isStop');
|
||||
|
||||
function isColor(colorStr) {
|
||||
const color =
|
||||
isRGB(colorStr) ||
|
||||
isRGBA(colorStr) ||
|
||||
isHSL(colorStr) ||
|
||||
isHSLA(colorStr) ||
|
||||
isHex(colorStr) ||
|
||||
isCSSColorName(colorStr) ||
|
||||
isTransparent(colorStr);
|
||||
|
||||
return color;
|
||||
}
|
||||
|
||||
|
||||
module.exports = function isColorStop(color, stop) {
|
||||
return isColor(color) && isStop(stop);
|
||||
};
|
||||
module.exports.isColor = isColor;
|
||||
module.exports.isRGB = isRGB;
|
||||
module.exports.isRGBA = isRGBA;
|
||||
module.exports.isHSL = isHSL;
|
||||
module.exports.isHSLA = isHSLA;
|
||||
module.exports.isHex = isHex;
|
||||
module.exports.isCSSColorName = isCSSColorName;
|
||||
module.exports.isTransparent = isTransparent;
|
||||
module.exports.isCSSLengthUnit = isCSSLengthUnit;
|
9
web/node_modules/is-color-stop/lib/isCSSColorName.js
generated
vendored
Normal file
9
web/node_modules/is-color-stop/lib/isCSSColorName.js
generated
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
'use strict';
|
||||
|
||||
const colorNames = require('css-color-names');
|
||||
|
||||
function isCSSColorName(str) {
|
||||
return !!colorNames[str];
|
||||
}
|
||||
|
||||
module.exports = isCSSColorName;
|
25
web/node_modules/is-color-stop/lib/isCSSLengthUnit.js
generated
vendored
Normal file
25
web/node_modules/is-color-stop/lib/isCSSLengthUnit.js
generated
vendored
Normal file
|
@ -0,0 +1,25 @@
|
|||
'use strict';
|
||||
|
||||
const lengthArray = [
|
||||
'PX',
|
||||
'IN',
|
||||
'CM',
|
||||
'MM',
|
||||
'EM',
|
||||
'REM',
|
||||
'POINTS',
|
||||
'PC',
|
||||
'EX',
|
||||
'CH',
|
||||
'VW',
|
||||
'VH',
|
||||
'VMIN',
|
||||
'VMAX',
|
||||
'%',
|
||||
];
|
||||
|
||||
function isCSSLengthUnit(unit) {
|
||||
return lengthArray.indexOf(unit.toUpperCase()) >= 0;
|
||||
}
|
||||
|
||||
module.exports = isCSSLengthUnit;
|
9
web/node_modules/is-color-stop/lib/isHSL.js
generated
vendored
Normal file
9
web/node_modules/is-color-stop/lib/isHSL.js
generated
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
'use strict';
|
||||
|
||||
const hslRegex = require('hsl-regex');
|
||||
|
||||
function isHSL(str) {
|
||||
return hslRegex({ exact: true }).test(str);
|
||||
}
|
||||
|
||||
module.exports = isHSL;
|
9
web/node_modules/is-color-stop/lib/isHSLA.js
generated
vendored
Normal file
9
web/node_modules/is-color-stop/lib/isHSLA.js
generated
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
'use strict';
|
||||
|
||||
const hslaRegex = require('hsla-regex');
|
||||
|
||||
function isHSLA(str) {
|
||||
return hslaRegex({ exact: true }).test(str);
|
||||
}
|
||||
|
||||
module.exports = isHSLA;
|
9
web/node_modules/is-color-stop/lib/isHex.js
generated
vendored
Normal file
9
web/node_modules/is-color-stop/lib/isHex.js
generated
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
'use strict';
|
||||
|
||||
const hexRegex = require('hex-color-regex');
|
||||
|
||||
function isHex(str) {
|
||||
return hexRegex({ exact: true }).test(str);
|
||||
}
|
||||
|
||||
module.exports = isHex;
|
9
web/node_modules/is-color-stop/lib/isRGB.js
generated
vendored
Normal file
9
web/node_modules/is-color-stop/lib/isRGB.js
generated
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
'use strict';
|
||||
|
||||
const rgbRegex = require('rgb-regex');
|
||||
|
||||
function isRGB(str) {
|
||||
return rgbRegex({ exact: true }).test(str);
|
||||
}
|
||||
|
||||
module.exports = isRGB;
|
9
web/node_modules/is-color-stop/lib/isRGBA.js
generated
vendored
Normal file
9
web/node_modules/is-color-stop/lib/isRGBA.js
generated
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
'use strict';
|
||||
|
||||
const rgbaRegex = require('rgba-regex');
|
||||
|
||||
function isRgba(str) {
|
||||
return rgbaRegex({ exact: true }).test(str);
|
||||
}
|
||||
|
||||
module.exports = isRgba;
|
23
web/node_modules/is-color-stop/lib/isStop.js
generated
vendored
Normal file
23
web/node_modules/is-color-stop/lib/isStop.js
generated
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
'use strict';
|
||||
|
||||
const isCSSLengthUnit = require('./isCSSLengthUnit');
|
||||
const unit = require('../util/unit');
|
||||
|
||||
function isStop(str) {
|
||||
let stop = !str;
|
||||
|
||||
if (!stop) {
|
||||
const node = unit(str);
|
||||
if (node) {
|
||||
if (node.number === 0 || (!isNaN(node.number) && isCSSLengthUnit(node.unit))) {
|
||||
stop = true;
|
||||
}
|
||||
} else {
|
||||
stop = (/^calc\(\S+\)$/g).test(str);
|
||||
}
|
||||
}
|
||||
|
||||
return stop;
|
||||
}
|
||||
|
||||
module.exports = isStop;
|
7
web/node_modules/is-color-stop/lib/isTransparent.js
generated
vendored
Normal file
7
web/node_modules/is-color-stop/lib/isTransparent.js
generated
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
function isTransparent(str) {
|
||||
return str === 'transparent';
|
||||
}
|
||||
|
||||
module.exports = isTransparent;
|
44
web/node_modules/is-color-stop/package.json
generated
vendored
Normal file
44
web/node_modules/is-color-stop/package.json
generated
vendored
Normal file
|
@ -0,0 +1,44 @@
|
|||
{
|
||||
"name": "is-color-stop",
|
||||
"description": "Check if a string is CSS color stop",
|
||||
"version": "1.1.0",
|
||||
"main": "index.js",
|
||||
"directories": {
|
||||
"test": "test"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "nyc --reporter=lcov --reporter=text mocha",
|
||||
"coveralls": "cat ./coverage/lcov.info | coveralls",
|
||||
"lint": "eslint --ext .js lib util ./index.js"
|
||||
},
|
||||
"devDependencies": {
|
||||
"coveralls": "^2.13.1",
|
||||
"eslint": "^4.3.0",
|
||||
"eslint-config-airbnb": "^15.1.0",
|
||||
"eslint-plugin-import": "^2.7.0",
|
||||
"mocha": "^3.4.2",
|
||||
"nyc": "^11.0.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"css-color-names": "^0.0.4",
|
||||
"hex-color-regex": "^1.1.0",
|
||||
"hsl-regex": "^1.0.0",
|
||||
"hsla-regex": "^1.0.0",
|
||||
"rgb-regex": "^1.0.1",
|
||||
"rgba-regex": "^1.0.0"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/pigcan/is-color-stop.git"
|
||||
},
|
||||
"keywords": [
|
||||
"color-stop",
|
||||
"is-color"
|
||||
],
|
||||
"author": "pigcan <jiangjay818@gmail.com>",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/pigcan/is-color-stop/issues"
|
||||
},
|
||||
"homepage": "https://github.com/pigcan/is-color-stop#readme"
|
||||
}
|
49
web/node_modules/is-color-stop/test/index.test.js
generated
vendored
Normal file
49
web/node_modules/is-color-stop/test/index.test.js
generated
vendored
Normal file
|
@ -0,0 +1,49 @@
|
|||
'use strict';
|
||||
|
||||
const assert = require('assert');
|
||||
const isColorStop = require('..');
|
||||
|
||||
describe('is-color-stop', function () {
|
||||
it('isColorStop', function () {
|
||||
assert.ok(isColorStop('yellow'));
|
||||
assert.ok(isColorStop('yellow', '12px'));
|
||||
assert.ok(!isColorStop('yellow', 'px'));
|
||||
assert.ok(isColorStop('yellow', 'calc(100%)'));
|
||||
});
|
||||
|
||||
it('isColor', function () {
|
||||
assert.ok(isColorStop.isColor('rgb(255, 255, 255)'));
|
||||
});
|
||||
|
||||
it('isRGB', function () {
|
||||
assert.ok(isColorStop.isRGB('rgb(255, 255, 255)'));
|
||||
});
|
||||
|
||||
it('isRGBA', function () {
|
||||
assert.ok(isColorStop.isRGBA('rgba(255, 255, 255, .9)'));
|
||||
});
|
||||
|
||||
it('isHSL', function () {
|
||||
assert.ok(isColorStop.isHSL('hsl(123, 45%, 67%)'));
|
||||
});
|
||||
|
||||
it('isHSLA', function () {
|
||||
assert.ok(isColorStop.isHSLA('hsla(123, 45%, 67%, .9)'));
|
||||
});
|
||||
|
||||
it('isHex', function () {
|
||||
assert.ok(isColorStop.isHex('#123456'));
|
||||
});
|
||||
|
||||
it('isCSSColorName', function () {
|
||||
assert.ok(isColorStop.isCSSColorName('yellow'));
|
||||
});
|
||||
|
||||
it('isTransparent', function () {
|
||||
assert.ok(isColorStop.isTransparent('transparent'));
|
||||
});
|
||||
|
||||
it('isCSSLengthUnit', function () {
|
||||
assert.ok(isColorStop.isCSSLengthUnit('px'));
|
||||
});
|
||||
});
|
34
web/node_modules/is-color-stop/test/unit.test.js
generated
vendored
Normal file
34
web/node_modules/is-color-stop/test/unit.test.js
generated
vendored
Normal file
|
@ -0,0 +1,34 @@
|
|||
'use strict';
|
||||
|
||||
const assert = require('assert');
|
||||
const unit = require('../util/unit');
|
||||
|
||||
describe('unit', function () {
|
||||
it('unit', function () {
|
||||
assert.deepEqual(unit('.23rem'), {
|
||||
number: '.23',
|
||||
unit: 'rem',
|
||||
});
|
||||
|
||||
assert.deepEqual(unit('.2.3rem'), {
|
||||
number: '.2',
|
||||
unit: '.3rem',
|
||||
});
|
||||
|
||||
assert.deepEqual(unit('2.'), {
|
||||
number: '2.',
|
||||
unit: '',
|
||||
});
|
||||
|
||||
assert.deepEqual(unit('+2.'), {
|
||||
number: '+2.',
|
||||
unit: '',
|
||||
});
|
||||
|
||||
assert.deepEqual(unit('+-2.'), false);
|
||||
|
||||
assert.deepEqual(unit('.'), false);
|
||||
|
||||
assert.deepEqual(unit('.rem'), false);
|
||||
});
|
||||
});
|
48
web/node_modules/is-color-stop/util/unit.js
generated
vendored
Normal file
48
web/node_modules/is-color-stop/util/unit.js
generated
vendored
Normal file
|
@ -0,0 +1,48 @@
|
|||
'use strict';
|
||||
|
||||
/**
|
||||
* https://github.com/TrySound/postcss-value-parser/blob/fc679a7e17877841ff9fe455722280b65abd4f28/lib/unit.js
|
||||
* parse node -> number and unit
|
||||
*/
|
||||
|
||||
const minus = '-'.charCodeAt(0);
|
||||
const plus = '+'.charCodeAt(0);
|
||||
const dot = '.'.charCodeAt(0);
|
||||
|
||||
module.exports = function unit(value) {
|
||||
let pos = 0;
|
||||
const length = value.length;
|
||||
let dotted = false;
|
||||
let containsNumber = false;
|
||||
let code;
|
||||
let number = '';
|
||||
|
||||
while (pos < length) {
|
||||
code = value.charCodeAt(pos);
|
||||
|
||||
if (code >= 48 && code <= 57) {
|
||||
number += value[pos];
|
||||
containsNumber = true;
|
||||
} else if (code === dot) {
|
||||
if (dotted) {
|
||||
break;
|
||||
}
|
||||
dotted = true;
|
||||
number += value[pos];
|
||||
} else if (code === plus || code === minus) {
|
||||
if (pos !== 0) {
|
||||
break;
|
||||
}
|
||||
number += value[pos];
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
|
||||
pos += 1;
|
||||
}
|
||||
|
||||
return containsNumber ? {
|
||||
number,
|
||||
unit: value.slice(pos),
|
||||
} : false;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue