require.js define function not defined

Hi, I have this define call using require.js.

/**
 * General helper functions
 */
define(['jquery'], function($) {
    'use strict';

    function GeneralHelpers() {}

    GeneralHelpers.prototype = {};
    GeneralHelpers.prototype.constructor = GeneralHelpers;

    /**
     * Determines if the object has given properties. Should work in multi-dimensional arrays
     * @see http://stackoverflow.com/questions/9274674/javascript-isset-function
     * @param obj
     * @param props
     * @returns {*}
     */
    GeneralHelpers.prototype.isset = function( obj, props ) {
        if ((typeof (obj) === 'undefined') || (obj === null))
            return false;
        else if (props && props.length > 0)
            return this.isset(obj[props.shift()], props);
        else
            return true;
    };

    return GeneralHelpers;

});

Open in new window


 But this require call doesn't work:

require(['GeneralHelpers'], function(GeneralHelpers) {
	GeneralHelpers.isset(obj, 'prop'); //undefined is not a function
}

Open in new window


I have the GeneralHelpers in my paths settings of the main.js file.

How do I call the isset function?

Thank you and God bless<><,
Victor
Victor KimuraSEO, Web DeveloperAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Avinash ZalaWeb ExpertCommented:
Can you please share link where I can review the error and debug the same?
0
Victor KimuraSEO, Web DeveloperAuthor Commented:
Sorry, I totally forgot about this. I think how I resolved this is that I created a shim with the jquery dependency instead of add it to the define as a parameter like so:

require.config({
   shim: {
      'GeneralHelpers': {deps: ['jquery']}
   }
});

Open in new window


Hope this helps someone else. Blessings<><
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Victor KimuraSEO, Web DeveloperAuthor Commented:
using shim with deps seems to work.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.