Skip to content
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

Merged
merged 2 commits into from
Feb 1, 2018
Merged

Conversation

ger-benjamin
Copy link
Member

@ger-benjamin ger-benjamin commented Jan 31, 2018

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 ?

@sbrunner
Copy link
Member

For me this file should be moved in option and will be used only by gcc or completely remove in the webpack migration ...
https://github.com/camptocamp/ngeo/blob/master/src/jstsexports.js#L14

@sbrunner
Copy link
Member

@ger-benjamin ger-benjamin added this to the 2.3 milestone Jan 31, 2018
@ger-benjamin ger-benjamin self-assigned this Jan 31, 2018
@ger-benjamin ger-benjamin force-pushed the add_goog_require branch 3 times, most recently from 73c1067 to 098a997 Compare February 1, 2018 06:57
@ger-benjamin
Copy link
Member Author

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.

@@ -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')) {
Copy link
Member

@sbrunner sbrunner Feb 1, 2018

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';

@@ -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)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

@gberaudo gberaudo merged commit 5865157 into camptocamp:master Feb 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants