spa-component-grid
Advanced tools
Comparing version 1.0.0 to 1.0.1
126
index.js
/** | ||
* @license The MIT License (MIT) | ||
* @copyright Stanislav Kalashnik <darkpark.main@gmail.com> | ||
* @author Stanislav Kalashnik <darkpark.main@gmail.com> | ||
*/ | ||
@@ -81,6 +81,12 @@ | ||
if ( DEVELOP ) { | ||
if ( typeof config !== 'object' ) { throw new Error(__filename + ': wrong config type'); } | ||
if ( typeof config !== 'object' ) { | ||
throw new Error(__filename + ': wrong config type'); | ||
} | ||
// init parameters checks | ||
if ( config.className && typeof config.className !== 'string' ) { throw new Error(__filename + ': wrong or empty config.className'); } | ||
//if ( config.navigate && typeof config.navigate !== 'function' ) { throw new Error(__filename + ': wrong config.navigate type'); } | ||
if ( 'className' in config && (!config.className || typeof config.className !== 'string') ) { | ||
throw new Error(__filename + ': wrong or empty config.className'); | ||
} | ||
// if ( config.navigate && typeof config.navigate !== 'function' ) { | ||
// throw new Error(__filename + ': wrong config.navigate type'); | ||
// } | ||
} | ||
@@ -188,4 +194,8 @@ | ||
if ( DEVELOP ) { | ||
if ( arguments.length !== 2 ) { throw new Error(__filename + ': wrong arguments number'); } | ||
if ( !($item instanceof Element) ) { throw new Error(__filename + ': wrong $item type'); } | ||
if ( arguments.length !== 2 ) { | ||
throw new Error(__filename + ': wrong arguments number'); | ||
} | ||
if ( !($item instanceof Element) ) { | ||
throw new Error(__filename + ': wrong $item type'); | ||
} | ||
} | ||
@@ -300,4 +310,8 @@ | ||
if ( DEVELOP ) { | ||
if ( arguments.length !== 1 ) { throw new Error(__filename + ': wrong arguments number'); } | ||
if ( !Array.isArray(data) ) { throw new Error(__filename + ': wrong data type'); } | ||
if ( arguments.length !== 1 ) { | ||
throw new Error(__filename + ': wrong arguments number'); | ||
} | ||
if ( !Array.isArray(data) ) { | ||
throw new Error(__filename + ': wrong data type'); | ||
} | ||
} | ||
@@ -327,8 +341,20 @@ | ||
if ( DEVELOP ) { | ||
//if ( !('value' in item) ) { throw new Error(__filename + ': field "value" is missing'); } | ||
if ( Number(item.colSpan) !== item.colSpan ) { throw new Error(__filename + ': item.colSpan must be a number'); } | ||
if ( Number(item.rowSpan) !== item.rowSpan ) { throw new Error(__filename + ': item.rowSpan must be a number'); } | ||
if ( item.colSpan <= 0 ) { throw new Error(__filename + ': item.colSpan should be positive'); } | ||
if ( item.rowSpan <= 0 ) { throw new Error(__filename + ': item.rowSpan should be positive'); } | ||
if ( ('focus' in item) && Boolean(item.focus) !== item.focus ) { throw new Error(__filename + ': item.focus must be boolean'); } | ||
// if ( !('value' in item) ) { | ||
// throw new Error(__filename + ': field "value" is missing'); | ||
// } | ||
if ( Number(item.colSpan) !== item.colSpan ) { | ||
throw new Error(__filename + ': item.colSpan must be a number'); | ||
} | ||
if ( Number(item.rowSpan) !== item.rowSpan ) { | ||
throw new Error(__filename + ': item.rowSpan must be a number'); | ||
} | ||
if ( item.colSpan <= 0 ) { | ||
throw new Error(__filename + ': item.colSpan should be positive'); | ||
} | ||
if ( item.rowSpan <= 0 ) { | ||
throw new Error(__filename + ': item.rowSpan should be positive'); | ||
} | ||
if ( ('focus' in item) && Boolean(item.focus) !== item.focus ) { | ||
throw new Error(__filename + ': item.focus must be boolean'); | ||
} | ||
if ( ('disable' in item) && Boolean(item.disable) !== item.disable ) { | ||
@@ -359,4 +385,8 @@ throw new Error(__filename + ': item.disable must be boolean'); | ||
if ( DEVELOP ) { | ||
if ( arguments.length !== 6 ) { throw new Error(__filename + ': wrong arguments number'); } | ||
if ( !Array.isArray(map) ) { throw new Error(__filename + ': wrong map type'); } | ||
if ( arguments.length !== 6 ) { | ||
throw new Error(__filename + ': wrong arguments number'); | ||
} | ||
if ( !Array.isArray(map) ) { | ||
throw new Error(__filename + ': wrong map type'); | ||
} | ||
} | ||
@@ -399,4 +429,8 @@ | ||
if ( DEVELOP ) { | ||
if ( arguments.length !== 1 ) { throw new Error(__filename + ': wrong arguments number'); } | ||
if ( !Array.isArray(data) ) { throw new Error(__filename + ': wrong data type'); } | ||
if ( arguments.length !== 1 ) { | ||
throw new Error(__filename + ': wrong arguments number'); | ||
} | ||
if ( !Array.isArray(data) ) { | ||
throw new Error(__filename + ': wrong data type'); | ||
} | ||
} | ||
@@ -571,8 +605,14 @@ | ||
if ( DEVELOP ) { | ||
if ( arguments.length !== 1 ) { throw new Error(__filename + ': wrong arguments number'); } | ||
if ( typeof config !== 'object' ) { throw new Error(__filename + ': wrong config type'); } | ||
if ( arguments.length !== 1 ) { | ||
throw new Error(__filename + ': wrong arguments number'); | ||
} | ||
if ( typeof config !== 'object' ) { | ||
throw new Error(__filename + ': wrong config type'); | ||
} | ||
if ( config.data && (!Array.isArray(config.data) || !Array.isArray(config.data[0])) ) { | ||
throw new Error(__filename + ': wrong config.data type'); | ||
} | ||
if ( config.render && typeof config.render !== 'function' ) { throw new Error(__filename + ': wrong config.render type'); } | ||
if ( config.render && typeof config.render !== 'function' ) { | ||
throw new Error(__filename + ': wrong config.render type'); | ||
} | ||
} | ||
@@ -591,3 +631,5 @@ | ||
if ( DEVELOP ) { | ||
if ( !config.sizeX || !config.sizeY ) { throw new Error(__filename + ': wrong grid data size'); } | ||
if ( !config.sizeX || !config.sizeY ) { | ||
throw new Error(__filename + ': wrong grid data size'); | ||
} | ||
} | ||
@@ -697,4 +739,8 @@ | ||
if ( DEVELOP ) { | ||
if ( arguments.length !== 1 ) { throw new Error(__filename + ': wrong arguments number'); } | ||
if ( Number(direction) !== direction ) { throw new Error(__filename + ': direction must be a number'); } | ||
if ( arguments.length !== 1 ) { | ||
throw new Error(__filename + ': wrong arguments number'); | ||
} | ||
if ( Number(direction) !== direction ) { | ||
throw new Error(__filename + ': direction must be a number'); | ||
} | ||
} | ||
@@ -895,3 +941,5 @@ | ||
if ( DEVELOP ) { | ||
if ( arguments.length !== 1 ) { throw new Error(__filename + ': wrong arguments number'); } | ||
if ( arguments.length !== 1 ) { | ||
throw new Error(__filename + ': wrong arguments number'); | ||
} | ||
} | ||
@@ -902,4 +950,8 @@ | ||
if ( DEVELOP ) { | ||
if ( !($item instanceof Element) ) { throw new Error(__filename + ': wrong $item type'); } | ||
if ( $item.parentNode.parentNode.parentNode.parentNode !== this.$body ) { throw new Error(__filename + ': wrong $item parent element'); } | ||
if ( !($item instanceof Element) ) { | ||
throw new Error(__filename + ': wrong $item type'); | ||
} | ||
if ( $item.parentNode.parentNode.parentNode.parentNode !== this.$body ) { | ||
throw new Error(__filename + ': wrong $item parent element'); | ||
} | ||
} | ||
@@ -910,3 +962,5 @@ | ||
if ( DEVELOP ) { | ||
if ( !($prev instanceof Element) ) { throw new Error(__filename + ': wrong $prev type'); } | ||
if ( !($prev instanceof Element) ) { | ||
throw new Error(__filename + ': wrong $prev type'); | ||
} | ||
} | ||
@@ -971,6 +1025,14 @@ | ||
if ( DEVELOP ) { | ||
if ( arguments.length !== 2 ) { throw new Error(__filename + ': wrong arguments number'); } | ||
if ( !($item instanceof Element) ) { throw new Error(__filename + ': wrong $item type'); } | ||
if ( $item.parentNode.parentNode.parentNode.parentNode !== this.$body ) { throw new Error(__filename + ': wrong $item parent element'); } | ||
if ( Boolean(state) !== state ) { throw new Error(__filename + ': state must be boolean'); } | ||
if ( arguments.length !== 2 ) { | ||
throw new Error(__filename + ': wrong arguments number'); | ||
} | ||
if ( !($item instanceof Element) ) { | ||
throw new Error(__filename + ': wrong $item type'); | ||
} | ||
if ( $item.parentNode.parentNode.parentNode.parentNode !== this.$body ) { | ||
throw new Error(__filename + ': wrong $item parent element'); | ||
} | ||
if ( Boolean(state) !== state ) { | ||
throw new Error(__filename + ': state must be boolean'); | ||
} | ||
} | ||
@@ -977,0 +1039,0 @@ |
{ | ||
"name": "spa-component-grid", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Base grid/table implementation.", | ||
@@ -15,16 +15,17 @@ "author": { | ||
"sass": "node-sass --indent-width 4 --include-path ../../.. sass/develop.scss css/develop.css && node-sass --indent-width 4 --include-path ../../.. sass/release.scss css/release.css", | ||
"lint": "eslint .", | ||
"lint": "eslint --ignore-pattern '/docs/' .", | ||
"test": "npm run lint", | ||
"jsdoc": "jsdoc --destination doc *.js readme.md" | ||
"jsdoc": "jsdoc --destination docs *.js readme.md" | ||
}, | ||
"dependencies": { | ||
"spa-component": "1.*.*", | ||
"spa-keys": "1.*.*" | ||
"spa-component": "^1.5.0", | ||
"spa-keys": "^1.4.1" | ||
}, | ||
"devDependencies": { | ||
"eslint": "3.*.*", | ||
"spa-eslint-config": "1.*.*" | ||
"jsdoc": "^3.5.5", | ||
"spa-eslint": "^1.0.0" | ||
}, | ||
"keywords": [ | ||
"spa", | ||
"sdk", | ||
"spasdk", | ||
@@ -31,0 +32,0 @@ "framework", |
@@ -37,4 +37,4 @@ Grid component | ||
If you have any problem or suggestion please open an issue [here](https://github.com/spasdk/component-grid/issues). | ||
Pull requests are welcomed with respect to the [JavaScript Code Style](https://github.com/DarkPark/jscs). | ||
If you have any problems or suggestions please open an [issue](https://github.com/spasdk/component-grid/issues) | ||
according to the contribution [rules](.github/contributing.md). | ||
@@ -41,0 +41,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
37538
953
11
1
Updatedspa-component@^1.5.0
Updatedspa-keys@^1.4.1