cherry picking for lodash
This commit is contained in:
		@@ -1,4 +1,4 @@
 | 
			
		||||
import _ from 'lodash';
 | 
			
		||||
import pick from 'lodash/pick';
 | 
			
		||||
import {IdModel} from './id.model';
 | 
			
		||||
import {BaseModel} from './base.model';
 | 
			
		||||
 | 
			
		||||
@@ -11,6 +11,6 @@ export class MaterialModel extends BaseModel {
 | 
			
		||||
  numbers: string[] = [''];
 | 
			
		||||
 | 
			
		||||
  sendFormat() {
 | 
			
		||||
    return _.pick(this, ['name', 'supplier', 'group', 'numbers', 'properties']);
 | 
			
		||||
    return pick(this, ['name', 'supplier', 'group', 'numbers', 'properties']);
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
import _ from 'lodash';
 | 
			
		||||
import omit from 'lodash/omit';
 | 
			
		||||
import pick from 'lodash/pick';
 | 
			
		||||
import {IdModel} from './id.model';
 | 
			
		||||
import {BaseModel} from './base.model';
 | 
			
		||||
 | 
			
		||||
@@ -23,7 +24,7 @@ export class MeasurementModel extends BaseModel {
 | 
			
		||||
    return this;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  sendFormat(omit = []) {
 | 
			
		||||
    return _.omit(_.pick(this, ['sample_id', 'measurement_template', 'values']), omit);
 | 
			
		||||
  sendFormat(omitValues = []) {
 | 
			
		||||
    return omit(pick(this, ['sample_id', 'measurement_template', 'values']), omitValues);
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
import _ from 'lodash';
 | 
			
		||||
import pick from 'lodash/pick';
 | 
			
		||||
import {IdModel} from './id.model';
 | 
			
		||||
import {MaterialModel} from './material.model';
 | 
			
		||||
import {MeasurementModel} from './measurement.model';
 | 
			
		||||
@@ -16,7 +16,11 @@ export class SampleModel extends BaseModel {
 | 
			
		||||
  measurements: MeasurementModel[] = [];
 | 
			
		||||
  note_id: IdModel = null;
 | 
			
		||||
  user_id: IdModel = null;
 | 
			
		||||
  notes: {comment: string, sample_references: {sample_id: IdModel, relation: string}[], custom_fields: {[prop: string]: string}} = {comment: '', sample_references: [], custom_fields: {}};
 | 
			
		||||
  notes: {
 | 
			
		||||
    comment: string,
 | 
			
		||||
    sample_references: {sample_id: IdModel, relation: string}[],
 | 
			
		||||
    custom_fields: {[prop: string]: string}
 | 
			
		||||
  } = {comment: '', sample_references: [], custom_fields: {}};
 | 
			
		||||
  added: Date = null;
 | 
			
		||||
 | 
			
		||||
  deserialize(input: any): this {
 | 
			
		||||
@@ -35,6 +39,6 @@ export class SampleModel extends BaseModel {
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  sendFormat() {
 | 
			
		||||
    return _.pick(this, ['color', 'type', 'batch', 'condition', 'material_id', 'notes']);
 | 
			
		||||
    return pick(this, ['color', 'type', 'batch', 'condition', 'material_id', 'notes']);
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
import _ from 'lodash';
 | 
			
		||||
import pick from 'lodash/pick';
 | 
			
		||||
import {BaseModel} from './base.model';
 | 
			
		||||
import {IdModel} from './id.model';
 | 
			
		||||
 | 
			
		||||
@@ -23,6 +23,6 @@ export class UserModel extends BaseModel{
 | 
			
		||||
    if (mode === 'admin') {
 | 
			
		||||
      keys.push('level');
 | 
			
		||||
    }
 | 
			
		||||
    return _.pick(this, keys);
 | 
			
		||||
    return pick(this, keys);
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user