21 lines
553 B
TypeScript
21 lines
553 B
TypeScript
|
import { Injectable } from '@angular/core';
|
||
|
import { IJsonline } from '../models/json-line';
|
||
|
import { ISenMLItem } from '../models/senml-item';
|
||
|
|
||
|
@Injectable({
|
||
|
providedIn: 'root',
|
||
|
})
|
||
|
export class SenmlService {
|
||
|
constructor() {
|
||
|
}
|
||
|
|
||
|
getSenMLItem(name:string,jsonLine:IJsonline): ISenMLItem {
|
||
|
if (jsonLine) {
|
||
|
var senmlPack = jsonLine.data as ISenMLItem[];
|
||
|
var temp = senmlPack.filter((i) => i.u == name);
|
||
|
if (temp.length == 1) return temp[0];
|
||
|
return null;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|