How to use the sails/lib/util.isString function in sails

To help you get started, we’ve selected a few sails examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github balderdashy / sails / lib / hooks / sockets / interpreter / getVerb.js View on Github external
if ( util.isString(messageName) && messageName.toLowerCase() !== 'message' ) {
		return messageName.toUpperCase();
	}

	// try and parse the socket io data if it looks like JSON
	var body;
	if ( util.isString(socketIOData) ) {
		try {
			body = JSON.parse(socketIOData);
		} catch(e) {}
	}

	// Only try to use the socket io data if it's usable
	if ( util.isObject(body) ) {

		if (util.isString(body.verb)) {
			return body.verb.toUpperCase();
		}

		if (util.isString(body.method)) {
			return body.method.toUpperCase();
		}
	}

	return 'GET';
};
github balderdashy / sails / lib / hooks / sockets / interpreter / getVerb.js View on Github external
// try and parse the socket io data if it looks like JSON
	var body;
	if ( util.isString(socketIOData) ) {
		try {
			body = JSON.parse(socketIOData);
		} catch(e) {}
	}

	// Only try to use the socket io data if it's usable
	if ( util.isObject(body) ) {

		if (util.isString(body.verb)) {
			return body.verb.toUpperCase();
		}

		if (util.isString(body.method)) {
			return body.method.toUpperCase();
		}
	}

	return 'GET';
};
github balderdashy / sails / lib / hooks / sockets / interpreter / getVerb.js View on Github external
module.exports = function getVerb (socketIOData, messageName) {

	// If message name is not `message`, it's the verb!
	if ( util.isString(messageName) && messageName.toLowerCase() !== 'message' ) {
		return messageName.toUpperCase();
	}

	// try and parse the socket io data if it looks like JSON
	var body;
	if ( util.isString(socketIOData) ) {
		try {
			body = JSON.parse(socketIOData);
		} catch(e) {}
	}

	// Only try to use the socket io data if it's usable
	if ( util.isObject(body) ) {

		if (util.isString(body.verb)) {
			return body.verb.toUpperCase();
		}

		if (util.isString(body.method)) {
			return body.method.toUpperCase();
		}
	}
github balderdashy / sails / lib / hooks / sockets / interpreter / getVerb.js View on Github external
module.exports = function getVerb (socketIOData, messageName) {

	// If message name is not `message`, it's the verb!
	if ( util.isString(messageName) && messageName.toLowerCase() !== 'message' ) {
		return messageName.toUpperCase();
	}

	// try and parse the socket io data if it looks like JSON
	var body;
	if ( util.isString(socketIOData) ) {
		try {
			body = JSON.parse(socketIOData);
		} catch(e) {}
	}

	// Only try to use the socket io data if it's usable
	if ( util.isObject(body) ) {

		if (util.isString(body.verb)) {
			return body.verb.toUpperCase();