mofron-layout-margin
Advanced tools
Comparing version 0.0.11 to 0.1.0
81
index.js
@@ -12,34 +12,4 @@ /** | ||
this.name('Margin'); | ||
this.prmMap('type', 'value'); | ||
this.prmOpt(po, p2); | ||
this.getParam().check( | ||
(tp) => { | ||
try { | ||
if (undefined === tp) { | ||
return ''; | ||
} | ||
if ( ('string' != (typeof tp)) || | ||
( ('' != tp) && | ||
('top' != tp) && | ||
('right' != tp) && | ||
('bottom' != tp) && | ||
('left' != tp) ) ) { | ||
throw new Error('invalid parameter'); | ||
} | ||
} catch (e) { | ||
console.error(e.stack); | ||
throw e; | ||
} | ||
}, | ||
(val) => { | ||
try { | ||
if ( ('number' !== typeof val) && ('string' !== typeof val) ) { | ||
throw new Error('invalid parameter'); | ||
} | ||
} catch (e) { | ||
console.error(e.stack); | ||
throw e; | ||
} | ||
}, | ||
); | ||
} catch (e) { | ||
@@ -53,11 +23,5 @@ console.error(e.stack); | ||
try { | ||
let mg = 'margin'; | ||
let type = this.value()[0]; | ||
let val = this.value()[1]; | ||
if ('' !== type) { | ||
mg += '-' + type; | ||
} | ||
let mg = (null === this.type()) ? 'margin' : 'margin' + '-' + this.type(); | ||
let setmgn = {}; | ||
setmgn[mg] = ('number' !== typeof val) ? val : val + 'px'; | ||
setmgn[mg] = ('number' !== typeof this.value()) ? this.value() : this.value() + 'px'; | ||
tgt.adom().style(setmgn); | ||
@@ -69,4 +33,43 @@ } catch (e) { | ||
} | ||
type (prm) { | ||
try { | ||
if (undefined === prm) { | ||
/* getter */ | ||
return (undefined === this.m_type) ? null : this.m_type; | ||
} | ||
/* setter */ | ||
if ( ('string' !== typeof prm) || | ||
( ('top' !== prm) && | ||
('right' !== prm) && | ||
('bottom' !== prm) && | ||
('left' !== prm) ) ) { | ||
throw new Error('invalid parameter'); | ||
} | ||
this.m_type = prm; | ||
} catch (e) { | ||
console.error(e.stack); | ||
throw e; | ||
} | ||
} | ||
value (prm) { | ||
try { | ||
if (undefined === prm) { | ||
/* getter */ | ||
return (undefined === this.m_value) ? null : this.m_value; | ||
} | ||
/* setter */ | ||
if (('string' !== typeof prm) && ('number' !== typeof prm)) { | ||
throw new Error('invalid parameter'); | ||
} | ||
this.m_value = prm; | ||
} catch (e) { | ||
console.error(e.stack); | ||
throw e; | ||
} | ||
} | ||
} | ||
module.exports = mofron.layout.Margin; | ||
/* end of file */ |
{ | ||
"name": "mofron-layout-margin", | ||
"version": "0.0.11", | ||
"version": "0.1.0", | ||
"description": "margin layout of mofron", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
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
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
67
4158