-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add require of goog.assert #3469
Conversation
For me this file should be moved in option and will be used only by gcc or completely remove in the webpack migration ... |
73c1067
to
098a997
Compare
For the last commit, I've taken what was done for saccas. But I've improvised methods for AssertFunction, nassertObject, assertArray and assertElement. Because the code was not existing. |
098a997
to
c581610
Compare
src/goog.asserts.js_
Outdated
@@ -191,9 +191,9 @@ exports.assertFunction = function(value, opt_message, var_args) { | |||
* @throws {goog.asserts.AssertionError} When the value is not an object. | |||
*/ | |||
exports.assertObject = function(value, opt_message, var_args) { | |||
if (exports.ENABLE_ASSERTS && !goog.isObject(value)) { | |||
if (exports.ENABLE_ASSERTS && (value === null || typeof value != 'object')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
!Array.isArray(value) && typeof value == 'object' && value != null || typeof value == 'function';
src/goog.asserts.js_
Outdated
@@ -248,9 +248,9 @@ exports.assertBoolean = function(value, opt_message, var_args) { | |||
*/ | |||
exports.assertElement = function(value, opt_message, var_args) { | |||
if (exports.ENABLE_ASSERTS && | |||
(!goog.isObject(value) || value.nodeType != goog.dom.NodeType.ELEMENT)) { | |||
(value === null || typeof value != 'object' || value.nodeType == undefined)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
c581610
to
aae33b8
Compare
aae33b8
to
9fa797a
Compare
It will still fail because of:
Case 1: goog.exportSymbol
https://github.com/camptocamp/ngeo/blob/master/src/jstsexports.js#L14
Any idea ?
Case 2: goog.
https://github.com/camptocamp/ngeo/blob/master/src/goog.asserts.js_#L139 (and brothers)
Can I use
typeof(value) === "number"
?What should I do ?