How to use the ejson._getTypes 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 inProgress-team / react-native-meteor / src / CollectionFS / FSCollection.js View on Github external
import EJSON from 'ejson';

import Collection from '../Collection';
import Data from '../Data';
import setProperties from './setProperties';

if (!EJSON._getTypes()['FS.File']) {
  EJSON.addType('FS.File', function(value) {
    return {
      getFileRecord() {
        const collection =
          Data.db['cfs.' + value.collectionName + '.filerecord'];

        const item = collection && collection.get(value._id);

        if (!item) return value;

        return setProperties(value.collectionName, item);
      },
    };
  });
}

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