How to use the ejson.fromJSONValue function in ejson

To help you get started, we’ve selected a few ejson 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 RocketChat / Rocket.Chat.ReactNative / app / lib / methods / subscriptions / room.js View on Github external
const handleMessageReceived = protectedFunction((ddpMessage) => {
		const message = buildMessage(EJSON.fromJSONValue(ddpMessage.fields.args[0]));
		if (rid !== message.rid) {
			return;
		}
		requestAnimationFrame(() => {
			try {
				database.write(() => {
					database.create('messages', message, true);
					// if it's a thread "header"
					if (message.tlm) {
						database.create('threads', message, true);
					} else if (message.tmid) {
						message.rid = message.tmid;
						database.create('threadMessages', message, true);
					}
				});
github DefinitelyTyped / DefinitelyTyped / ejson / ejson-tests.ts View on Github external
function testFromJSONValue() {
  var str: string = '{a:"a"}';
  importedFromJSONValue(str);
}
github RocketChat / Rocket.Chat.ReactNative / app / lib / methods / helpers / mergeSubscriptionsRooms.js View on Github external
export const merge = (subscription, room) => {
	subscription = EJSON.fromJSONValue(subscription);
	room = EJSON.fromJSONValue(room);

	if (!subscription) {
		return;
	}
	if (room) {
		if (room.rid) {
			subscription.rid = room.rid;
		}
		subscription.roomUpdatedAt = room._updatedAt;
		subscription.lastMessage = normalizeMessage(room.lastMessage);
		subscription.ro = room.ro;
		subscription.description = room.description;
		subscription.topic = room.topic;
		subscription.announcement = room.announcement;
		subscription.reactWhenReadOnly = room.reactWhenReadOnly;
		subscription.archived = room.archived;
github RocketChat / Rocket.Chat.ReactNative / app / lib / methods / loadThreadMessages.js View on Github external
database.write(() => data.forEach((m) => {
						try {
							const message = buildMessage(EJSON.fromJSONValue(m));
							message.rid = tmid;
							database.create('threadMessages', message, true);
						} catch (e) {
							log('loadThreadMessages -> create messages', e);
						}
					}));
					return resolve(data);
github RocketChat / Rocket.Chat.ReactNative / app / lib / methods / helpers / mergeSubscriptionsRooms.js View on Github external
export const merge = (subscription, room) => {
	subscription = EJSON.fromJSONValue(subscription);
	room = EJSON.fromJSONValue(room);

	if (!subscription) {
		return;
	}
	if (room) {
		if (room.rid) {
			subscription.rid = room.rid;
		}
		subscription.roomUpdatedAt = room._updatedAt;
		subscription.lastMessage = normalizeMessage(room.lastMessage);
		subscription.ro = room.ro;
		subscription.description = room.description;
		subscription.topic = room.topic;
		subscription.announcement = room.announcement;
		subscription.reactWhenReadOnly = room.reactWhenReadOnly;
github RocketChat / Rocket.Chat.ReactNative / app / views / RoomView / index.js View on Github external
database.write(() => {
				database.create('threads', buildMessage(EJSON.fromJSONValue(thread)), true);
			});
		} catch (e) {

ejson

EJSON - Extended and Extensible JSON library from Meteor made compatible for Nodejs and Browserify

MIT
Latest version published 2 years ago

Package Health Score

54 / 100
Full package analysis