Latest updates from IceHrmPro
This commit is contained in:
28
web/node_modules/json2mq/.npmignore
generated
vendored
Normal file
28
web/node_modules/json2mq/.npmignore
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
|
||||
# Runtime data
|
||||
pids
|
||||
*.pid
|
||||
*.seed
|
||||
|
||||
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||
lib-cov
|
||||
|
||||
# Coverage directory used by tools like istanbul
|
||||
coverage
|
||||
|
||||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
|
||||
.grunt
|
||||
|
||||
# Compiled binary addons (http://nodejs.org/api/addons.html)
|
||||
build/Release
|
||||
|
||||
# Dependency directory
|
||||
# Commenting this out is preferred by some people, see
|
||||
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git-
|
||||
node_modules
|
||||
|
||||
# Users Environment Variables
|
||||
.lock-wscript
|
||||
22
web/node_modules/json2mq/LICENSE
generated
vendored
Normal file
22
web/node_modules/json2mq/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014 Kiran Abburi
|
||||
|
||||
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.
|
||||
|
||||
44
web/node_modules/json2mq/README.md
generated
vendored
Normal file
44
web/node_modules/json2mq/README.md
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
# json2mq
|
||||
|
||||
json2mq is used to generate media query string from JSON or javascript object.
|
||||
|
||||
## Install
|
||||
npm install json2mq
|
||||
|
||||
## Usage
|
||||
```javascript
|
||||
var json2mq = require('json2mq');
|
||||
json2mq({minWidth: 100, maxWidth: 200});
|
||||
// -> '(min-width: 100px) and (max-width: 200px)'
|
||||
```
|
||||
* Media type
|
||||
```javascript
|
||||
json2mq({screen: true}); // -> 'screen'
|
||||
```
|
||||
* Media type with negation
|
||||
```javascript
|
||||
json2mq({handheld: false}); // -> 'not handheld'
|
||||
```
|
||||
|
||||
* Media features can be specified in camel case
|
||||
```javascript
|
||||
json2mq({minWidth: 100, maxWidth: 200});
|
||||
// -> '(min-width: 100px) and (max-width: 200px)'
|
||||
```
|
||||
* px is added to numeric dimension values
|
||||
```javascript
|
||||
json2mq({minWidth: 100, maxWidth: '20em'});
|
||||
// -> '(min-width: 100px) and (max-width: 20em)'
|
||||
```
|
||||
* Multiple media queries can be passed as an array
|
||||
```javascript
|
||||
json2mq([{screen: true, minWidth: 100}, {handheld: true, orientation: 'landscape'}]);
|
||||
// -> 'screen and (min-width: 100px), handheld and (orientation: landscape)'
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Contributors
|
||||
|
||||
* Eric Schoffstall
|
||||
|
||||
51
web/node_modules/json2mq/index.js
generated
vendored
Normal file
51
web/node_modules/json2mq/index.js
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
var camel2hyphen = require('string-convert/camel2hyphen');
|
||||
|
||||
var isDimension = function (feature) {
|
||||
var re = /[height|width]$/;
|
||||
return re.test(feature);
|
||||
};
|
||||
|
||||
var obj2mq = function (obj) {
|
||||
var mq = '';
|
||||
var features = Object.keys(obj);
|
||||
features.forEach(function (feature, index) {
|
||||
var value = obj[feature];
|
||||
feature = camel2hyphen(feature);
|
||||
// Add px to dimension features
|
||||
if (isDimension(feature) && typeof value === 'number') {
|
||||
value = value + 'px';
|
||||
}
|
||||
if (value === true) {
|
||||
mq += feature;
|
||||
} else if (value === false) {
|
||||
mq += 'not ' + feature;
|
||||
} else {
|
||||
mq += '(' + feature + ': ' + value + ')';
|
||||
}
|
||||
if (index < features.length-1) {
|
||||
mq += ' and '
|
||||
}
|
||||
});
|
||||
return mq;
|
||||
};
|
||||
|
||||
var json2mq = function (query) {
|
||||
var mq = '';
|
||||
if (typeof query === 'string') {
|
||||
return query;
|
||||
}
|
||||
// Handling array of media queries
|
||||
if (query instanceof Array) {
|
||||
query.forEach(function (q, index) {
|
||||
mq += obj2mq(q);
|
||||
if (index < query.length-1) {
|
||||
mq += ', '
|
||||
}
|
||||
});
|
||||
return mq;
|
||||
}
|
||||
// Handling single media query
|
||||
return obj2mq(query);
|
||||
};
|
||||
|
||||
module.exports = json2mq;
|
||||
53
web/node_modules/json2mq/package.json
generated
vendored
Normal file
53
web/node_modules/json2mq/package.json
generated
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
{
|
||||
"_from": "json2mq@^0.2.0",
|
||||
"_id": "json2mq@0.2.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-tje9O6nqvhIsg+lyBIOusQ0skEo=",
|
||||
"_location": "/json2mq",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "json2mq@^0.2.0",
|
||||
"name": "json2mq",
|
||||
"escapedName": "json2mq",
|
||||
"rawSpec": "^0.2.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^0.2.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/@ant-design/react-slick"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/json2mq/-/json2mq-0.2.0.tgz",
|
||||
"_shasum": "b637bd3ba9eabe122c83e9720483aeb10d2c904a",
|
||||
"_spec": "json2mq@^0.2.0",
|
||||
"_where": "/Users/thilina/TestProjects/icehrm-pro/web/node_modules/@ant-design/react-slick",
|
||||
"author": {
|
||||
"name": "Kiran Abburi"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/akiran/json2mq/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"string-convert": "^0.2.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Generate media query string from JSON or javascript object",
|
||||
"devDependencies": {
|
||||
"mocha": "^2.0.1",
|
||||
"should": "^4.3.0"
|
||||
},
|
||||
"homepage": "https://github.com/akiran/json2mq",
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"name": "json2mq",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/akiran/json2mq.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha test"
|
||||
},
|
||||
"version": "0.2.0"
|
||||
}
|
||||
39
web/node_modules/json2mq/test/test.js
generated
vendored
Normal file
39
web/node_modules/json2mq/test/test.js
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
var should = require('should');
|
||||
var json2mq = require('../');
|
||||
|
||||
describe('json2mq', function () {
|
||||
it('should return query string for media type', function () {
|
||||
json2mq({screen: true}).should.equal('screen');
|
||||
});
|
||||
|
||||
it('should return query string for media type with not', function () {
|
||||
json2mq({handheld: false}).should.equal('not handheld');
|
||||
});
|
||||
|
||||
it('should return query string for media features', function () {
|
||||
json2mq({minWidth: 100, maxWidth: 200}).should.equal('(min-width: 100px) and (max-width: 200px)');
|
||||
});
|
||||
|
||||
it('should return query string for media type and media features', function () {
|
||||
json2mq({screen: true, minWidth: 100, maxWidth: 200}).should.equal('screen and (min-width: 100px) and (max-width: 200px)');
|
||||
});
|
||||
|
||||
it('should add px unit to dimension features', function () {
|
||||
json2mq({minWidth: 100, aspectRatio: "3/4"}).should.equal('(min-width: 100px) and (aspect-ratio: 3/4)');
|
||||
});
|
||||
|
||||
it('should accept other units for dimension features if passed as string', function () {
|
||||
json2mq({minWidth: '10em', aspectRatio: "3/4"}).should.equal('(min-width: 10em) and (aspect-ratio: 3/4)');
|
||||
});
|
||||
|
||||
it('should return comma seperated query string for multiple media queries', function () {
|
||||
json2mq([
|
||||
{minWidth: 100},
|
||||
{handheld: true, orientation: 'landscape'}
|
||||
]).should.equal('(min-width: 100px), handheld and (orientation: landscape)');
|
||||
});
|
||||
|
||||
it('should only return feature if its value is true', function () {
|
||||
json2mq({all: true, monochrome: true}).should.equal('all and monochrome');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user