How to use the object-path function in object-path

To help you get started, we’ve selected a few object-path 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 jaydenseric / graphql-upload / src / index.js View on Github external
form.parse(request, (error, { operations }, files) => {
      if (error) reject(new Error(error))

      // Decode the GraphQL operation(s). This is an array if batching is
      // enabled.
      operations = JSON.parse(operations)

      // Check if files were uploaded
      if (Object.keys(files).length) {
        // File field names contain the original path to the File object in the
        // GraphQL operation input variables. Relevent data for each uploaded
        // file now gets placed back in the variables.
        const operationsPath = objectPath(operations)
        Object.keys(files).forEach(variablesPath => {
          const { name, type, size, path } = files[variablesPath]
          operationsPath.set(variablesPath, { name, type, size, path })
        })
      }

      // Provide fields for replacement request body
      resolve(operations)
    })
  })
github strues / boldr / server / middleware / apolloUpload.js View on Github external
form.parse(request, (error, { operations }, files) => {
      if (error) {
        reject(new Error(error));
      }

      // Decode the GraphQL operation(s). This is an array
      // if batching is enabled.
      operations = JSON.parse(operations);
      // Check if files were uploaded
      if (Object.keys(files).length) {
        // File field names contain the original path to
        // the File object in the GraphQL operation input
        // variables. Relevent data for each uploaded file
        // now gets placed back in the variables.
        const operationsPath = objectPath(operations);
        Object.keys(files).forEach(variablesPath => {
          const { name, type, size, path } = files[variablesPath];
          operationsPath.set(variablesPath, { name, type, size, path });
        });
      }

      // Provide fields for replacement request body
      resolve(operations);
    });
  });
github strues / boldr / packages / server / src / middleware / apolloUpload.js View on Github external
form.parse(req, (error, { operations }, files) => {
      if (error) {
        return reject(new Error(error));
      }
      debug('parsing form data');
      // Decode the GraphQL operation(s). This is an array
      // if batching is enabled.
      operations = JSON.parse(operations);
      // Check if files were uploaded
      if (Object.keys(files).length) {
        // File field names contain the original path to
        // the File object in the GraphQL operation input
        // variables. Relevent data for each uploaded file
        // now gets placed back in the variables.
        const operationsPath = objectPath(operations);
        Object.keys(files).forEach(variablesPath => {
          const { name, type, size, path } = files[variablesPath];
          return operationsPath.set(variablesPath, { name, type, size, path });
        });
      }

      // Provide fields for replacement request body
      return resolve(operations);
    });
  });
github minhtranite / react-validation-decorator / src / Validation.js View on Github external
updateState = (newState, callback) => {
      let state = this.state;
      let stateModel = ObjectPath(state);
      for (let property in newState) {
        if (newState.hasOwnProperty(property)) {
          stateModel.set(property, newState[property]);
        }
      }
      if (callback) {
        this.setState(state, callback);
      } else {
        this.setState(state);
      }
    };
  };
github feawesome / react-awesome-player / src / index.js View on Github external
componentDidMount() {
    const sources = ObjectPath(this.props).get('options.sources') || []
    const isSource = sources.length

    if (!this.player && isSource) {
      this.initialize();
    }
  }
github zapkub / cu-vivid-museum-wiki / legacy / containers / SearchInputBar.js View on Github external
withProps(({ state, texts, data }) => ({
         data: objectPath(data),
         confirmSearch: () => {
           const categories = []
           Object.keys(state).forEach((key) => {
             if (state[key]) {
               categories.push(key)
             }
           })

           const queryParam = {
             searchTexts: texts,
             categories: categories.join(',')
           }
           if (categories.length < 1) {
             queryParam.categories = Object.keys(Categories).join(',')
           }
           Router.push(`/results?${queryString.stringify(queryParam)}`)
github feawesome / react-awesome-player / src / index.js View on Github external
resetUrl() {
    const sources = ObjectPath(this.props).get('options.sources') || []

    sources[0] && this.player.src(sources[0].src);
    this.player.poster(this.props.options.poster);
  }
github dacz / rxr / src / createScopedState.js View on Github external
.scan((state, [ scope, reducer ]) =>
      immutable.set(state, scope, reducer(objectPath(state, scope)))
    )