Removes query properties from `json` and stores them into a hidden property inside `model` so that they can be later merged back to `json`.
427721
function splitQueryProps(model, json) {
  const keys = Object.keys(json);

  if (hasQueryProps(json, keys)) {
    const queryProps = {};
    const modelProps = {};

    for (let i = 0, l = keys.length; i < l; ++i) {
      const key = keys[i];
      const value = json[key];

      if (isQueryProp(value)) {
        queryProps[key] = value;
      } else {
        modelProps[key] = value;
      }
    }

    defineNonEnumerableProperty(model, QUERY_PROPS_PROPERTY, queryProps);

    return modelProps;
  } else {
    return json;
  }
}
428863
function clearOwnProperties(obj) {
  _.forOwn(obj, function (value, key) {
    delete obj[key];
  });

  return obj;
}
600578
function removeBlankAttributes(obj) {
  return foldl(function(results, val, key) {
    if (val !== null && val !== undefined) results[key] = val;
    return results;
  }, {}, obj);
}
135282
function(model) {
        var modelObj = model.changedAttributes();
        _.each(model.changed, function(value, key) {
          if (typeof value === 'undefined' || value === null) {
            if (key == 'id') {
              delete modelObj[key];
            } else {
              modelObj[key] = null;
            }
          }
        });

        return modelObj;
      }
1061785
def _unjsonify(x, isattributes=False):
    """"""
    if isattributes:
        obj = json.loads(x)
        return dict_class(obj)
    return json.loads(x)
737130
def remove_query_param(url, key):
    

    (scheme, netloc, path, query, fragment) = urlparse.urlsplit(url)
    query_dict = urlparse.parse_qs(query)
    query_dict.pop(key, None)
    query = urlparse.urlencode(sorted(list(query_dict.items())), doseq=True)
    return urlparse.urlunsplit((scheme, netloc, path, query, fragment))
408540
function(model, options) {
      options || (options = {});
      model = this.getByCid(model) || this.get(model);
      if (!model) return null;
      delete this._byId[model.id];
      delete this._byCid[model.cid];
      this.models.splice(this.indexOf(model), 1);
      this.length--;
      if (!options.silent) model.trigger('remove', model, this, options);
      this._removeReference(model);
      return model;
    }
1237574
def remove_query_param(self, key, value=None):
        
        parse_result = self.query_params()
        if value is not None:
            index = parse_result[key].index(value)
            del parse_result[key][index]
        else:
            del parse_result[key]
        return URL._mutate(self, query=unicode_urlencode(parse_result, doseq=True))
575549
def _from_rest_hide(model, props):
    

    hide = model.get_fields_by_prop('from_rest', False)

    for field in hide:
        try:
            del props[field]
        except KeyError:
            continue
352009
def _populate(self, json):
        
        if not json:
            return

        # hide the raw JSON away in case someone needs it
        self._set('_raw_json', json)

        for key in json:
            if key in (k for k in type(self).properties.keys()
                    if not type(self).properties[k].identifier):
                if type(self).properties[key].relationship \
                    and not json[key] is None:
                    if isinstance(json[key], list):
                        objs = []
                        for d in json[key]:
                            if not 'id' in d:
                                continue
                            new_class = type(self).properties[key].relationship
                            obj = new_class.make_instance(d['id'],
                                    getattr(self,'_client'))
                            if obj:
                                obj._populate(d)
                            objs.append(obj)
                        self._set(key, objs)
                    else:
                        if isinstance(json[key], dict):
                            related_id = json[key]['id']
                        else:
                            related_id = json[key]
                        new_class = type(self).properties[key].relationship
                        obj = new_class.make_instance(related_id, getattr(self,'_client'))
                        if obj and isinstance(json[key], dict):
                            obj._populate(json[key])
                        self._set(key, obj)
                elif  type(self).properties[key].slug_relationship \
                        and not json[key] is None:
                    # create an object of the expected type with the given slug
                    self._set(key, type(self).properties[key].slug_relationship(self._client, json[key]))
                elif type(json[key]) is dict:
                    self._set(key, MappedObject(**json[key]))
                elif type(json[key]) is list:
                    # we're going to use MappedObject's behavior with lists to
                    # expand these, then grab the resulting value to set
                    mapping = MappedObject(_list=json[key])
                    self._set(key, mapping._list) # pylint: disable=no-member
                elif type(self).properties[key].is_datetime:
                    try:
                        t = time.strptime(json[key], DATE_FORMAT)
                        self._set(key, datetime.fromtimestamp(time.mktime(t)))
                    except:
                        #TODO - handle this better (or log it?)
                        self._set(key, json[key])
                else:
                    self._set(key, json[key])

        self._set('_populated', True)
        self._set('_last_updated', datetime.now())
1007318
function clean(obj) {
  var ret = {};

  // Remove traits/properties that are already represented
  // outside of the data container
  // TODO: Refactor into `omit` call
  var excludeKeys = ['id', 'name', 'firstName', 'lastName'];
  each(excludeKeys, function(omitKey) {
    clear(obj, omitKey);
  });

  // Flatten nested hierarchy, preserving arrays
  obj = flatten(obj);

  // Discard nulls, represent arrays as comma-separated strings
  // FIXME: This also discards `undefined`s. Is that OK?
  for (var key in obj) {
    if (has.call(obj, key)) {
      var val = obj[key];
      if (val == null) {
        continue;
      }

      if (is.array(val)) {
        ret[key] = val.toString();
        continue;
      }

      ret[key] = val;
    }
  }

  return ret;
}
1038950
def delete(self, model):
        

        signals.pre_delete.send(model.__class__, model=model)

        param = {'rid_value': self.to_pg(model)[model.rid_field]}
        query = """
                DELETE FROM {table}
                WHERE {rid_field} = %(rid_value)s
                RETURNING {cols};
                """

        query = query.format(
            cols=self.field_cols(model),
            rid_field=model.rid_field,
            table=model.rtype,
        )

        result = self.query(query, param=param)

        signals.post_delete.send(model.__class__, model=model)

        return result
450641
def to_rest_model(model, includes=None):
    

    props = {}
    props['data'] = _to_rest(model, includes=includes)
    props['included'] = _to_rest_includes(model, includes=includes)

    return props
655111
@SuppressWarnings("unchecked")
    private static void parseProperties(JSONObject modelJSON,
                                        Shape current,
                                        Boolean keepGlossaryLink) throws JSONException {
        if (modelJSON.has("properties")) {
            JSONObject propsObject = modelJSON.getJSONObject("properties");
            Iterator<String> keys = propsObject.keys();
            Pattern pattern = Pattern.compile(jsonPattern);

            while (keys.hasNext()) {
                StringBuilder result = new StringBuilder();
                int lastIndex = 0;
                String key = keys.next();
                String value = propsObject.getString(key);

                if (!keepGlossaryLink) {
                    Matcher matcher = pattern.matcher(value);
                    while (matcher.find()) {
                        String id = matcher.group(1);
                        current.addGlossaryIds(id);
                        String text = matcher.group(2);
                        result.append(text);
                        lastIndex = matcher.end();
                    }
                    result.append(value.substring(lastIndex));
                    value = result.toString();
                }

                current.putProperty(key,
                                    value);
            }
        }
    }
1023508
def remove_properties_containing_None(properties_dict):
    
    # remove empty properties - as validations may fail
    new_dict  = dict()
    for key in properties_dict.keys():
        value = properties_dict[key]
        if value is not None:
            new_dict[key] = value
    return new_dict
781225
function populateOriginalKeyDetails (json, originalKey) {
  const properties = [
    'id',
    'name'
  ]

  properties
    .filter(jsonProp => !json.hasOwnProperty(jsonProp))
    .forEach(jsonProp => {
      json[jsonProp] = originalKey
    })
}
339342
function copyNonHalProperties(unparsed, resource) {
  Object.keys(unparsed).forEach(function(key) {
    if (key !== '_links' && key !== '_embedded') {
      resource[key] = unparsed[key];
    }
  });
}