|
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- export const findidx : Function = (arr: any, val: any) => {
- return arr.findIndex(item => {
- return item.id === val
- })
- }
-
- export const intersectionAlike : Function = (objA: any, objB: any) => {
- const result = {};
- for (const keyA in objA) {
- if (objB.hasOwnProperty(keyA)) {
- result[keyA] = objB[keyA];
- }
- }
- return result;
- }
-
-
-
- export const hasValue : Function = (obj: any) => {
- let result = '';
- result = Object.keys(obj).filter(key => obj[key] !== 0).map(key => `${obj[key]}`).join('')
- return result;
- }
-
-
- export const divObj : Function = (obj: any) => {
- const result = []
- obj.reduce((acc, curr, index) => {
- curr.idx = index;
- result.push(curr)
- // const key = `node${index}Info`;
- // acc[key] = curr;
- // return acc;
- }, {});
-
- return result;
- }
-
-
-
- export const alreadyValue: Function = (obj: any) => {
- const result = []
- obj.reduce((acc, curr, index) => {
- curr.idx = index;
- result.push(curr)
- // const key = `node${index}Info`;
- // acc[key] = curr;
- // return acc;
- }, {});
-
- return result;
- }
|