How to use the js-data.utils.isUndefined function in js-data

To help you get started, we’ve selected a few js-data 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 GoogleCloudPlatform / js-data-cloud-datastore / src / index.js View on Github external
getOperator (operator, opts) {
    opts || (opts = {});
    opts.operators || (opts.operators = {});
    let ownOps = this.operators || {};
    return utils.isUndefined(opts.operators[operator]) ? ownOps[operator] || OPERATORS[operator] : opts.operators[operator];
  }
});
github js-data / js-data-sql / src / index.js View on Github external
.then((ids) => {
        const id = utils.isUndefined(props[idAttribute]) ? (ids.length ? ids[0] : undefined) : props[idAttribute]
        if (utils.isUndefined(id)) {
          throw new Error('Failed to create!')
        }
        return this._find(mapper, id, opts).then((result) => [result[0], { ids }])
      })
  },
github GoogleCloudPlatform / js-data-cloud-datastore / src / index.js View on Github external
getKind (mapper, opts) {
    opts || (opts = {});
    return utils.isUndefined(opts.kind) ? (utils.isUndefined(mapper.kind) ? mapper.name : mapper.kind) : opts.kind;
  },
github js-data / js-data-http / src / index.js View on Github external
getEndpoint (mapper, id, opts) {
    opts || (opts = {})
    opts.params = utils.isUndefined(opts.params) ? {} : opts.params
    const relationList = mapper.relationList || []
    let endpoint = utils.isUndefined(opts.endpoint) ? (utils.isUndefined(mapper.endpoint) ? mapper.name : mapper.endpoint) : opts.endpoint

    relationList.forEach((def) => {
      if (def.type !== 'belongsTo' || !def.parent) {
        return
      }
      let item
      const parentKey = def.foreignKey
      const parentDef = def.getRelation()
      let parentId = opts.params[parentKey]

      if (parentId === false || !parentKey || !parentDef) {
        if (parentId === false) {
          delete opts.params[parentKey]
        }
        return false
      } else {
github js-data / js-data-http / src / index.js View on Github external
getEndpoint (mapper, id, opts) {
    opts || (opts = {})
    opts.params = utils.isUndefined(opts.params) ? {} : opts.params
    const relationList = mapper.relationList || []
    let endpoint = utils.isUndefined(opts.endpoint) ? (utils.isUndefined(mapper.endpoint) ? mapper.name : mapper.endpoint) : opts.endpoint

    relationList.forEach((def) => {
      if (def.type !== 'belongsTo' || !def.parent) {
        return
      }
      let item
      const parentKey = def.foreignKey
      const parentDef = def.getRelation()
      let parentId = opts.params[parentKey]

      if (parentId === false || !parentKey || !parentDef) {
        if (parentId === false) {
          delete opts.params[parentKey]
        }
github js-data / js-data-rethinkdb / src / index.js View on Github external
waitForDb (opts) {
    opts || (opts = {})
    const db = utils.isUndefined(opts.db) ? this.rOpts.db : opts.db
    if (!this.databases[db]) {
      this.databases[db] = this.r.branch(
        this.r.dbList().contains(db),
        true,
        this.r.dbCreate(db)
      ).run()
    }
    return this.databases[db]
  },
github js-data / js-data-sql / src / index.js View on Github external
.then((ids) => {
        const id = utils.isUndefined(props[idAttribute]) ? (ids.length ? ids[0] : undefined) : props[idAttribute]
        if (utils.isUndefined(id)) {
          throw new Error('Failed to create!')
        }
        return this._find(mapper, id, opts).then((result) => [result[0], { ids }])
      })
  },
github js-data / js-data-sql / src / index.js View on Github external
selectTable (mapper, opts) {
    opts || (opts = {})
    const query = utils.isUndefined(opts.query) ? this.knex : opts.query
    const table = this.getTable(mapper)
    return query.select(`${table}.*`).from(table)
  }
})
github GoogleCloudPlatform / js-data-cloud-datastore / src / index.js View on Github external
records.forEach((record, i) => {
        if (!record) {
          return;
        }
        const id = utils.get(record, idAttribute);
        if (!utils.isUndefined(id)) {
          utils.deepMixIn(record, props[i]);
          entities.push({
            method: 'update',
            key: this.datastore.key([this.getKind(mapper, opts), id]),
            data: record
          });
          _records.push(record);
        }
      });
      if (!_records.length) {
github js-data / js-data-rethinkdb / src / index.js View on Github external
getOperator (operator, opts) {
    opts || (opts = {})
    opts.operators || (opts.operators = {})
    let ownOps = this.operators || {}
    return utils.isUndefined(opts.operators[operator]) ? ownOps[operator] : opts.operators[operator]
  },