This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.json.JSONArray; | |
import org.json.JSONException; | |
import org.json.JSONObject; | |
import java.util.*; | |
public class JsonHelper { | |
public static Object toJSON(Object object) throws JSONException { | |
if (object instanceof Map) { | |
JSONObject json = new JSONObject(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function isFunction(func){ | |
return Object.prototype.toString.call(func) === '[object Function]'; | |
} | |
/** | |
* This function converts an array to hash map | |
* @param {String | function} key describes the key to be evaluated in each object to use as key for hasmap | |
* @returns Object | |
* @Example | |
* [{id:123, name:'naveen'}, {id:345, name:"kumar"}].toHashMap("id") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* requireJS trace | |
* | |
* Given a configuration object, as would be passed to the optimizer, | |
* runs a raw build trace on the configuration, returning the traced | |
* dependency trees. | |
* | |
* Loaded as a requirejs module on the server. | |
* | |
* eg: |