Recent

Custom Controls Using Angular Material

Git Repo:  https://github.com/yawahang/ohcontrols Features DatePicker (Date Picker, Time Picker, Date Time Picker, and many more) RatingPicker (Vertical, Horizontal, Custom Icons) Select (Single Select, MultiSelect, Single Column, MultiColumn) Recursive Treeview

Check if property exists, return property as string, add new json array to existing

function utilityJson(objobj2nametype) {

  if (type === "b") { // return true if Property named name exists > getObjectByStringJSON(obj, [], "PropertyName to find in object", "b")

    Object.byString = function (on) {
      n = n.replace(/^\./'');
      if (n in oreturn true;
      else return false;
    }

    return Object.byString(objname);
  }
  else if (type === "s") { // return property name as string of arrays > getObjectByStringJSON(obj, [], "", "s")

    const prop = Object.keys(obj);
    var propNames = [];
    prop.forEach(function (k) {

      propNames.push(k);
    });

    return propNames;
  }
  else { // a  // append new properties to existing DS > getObjectByStringJSON(obj old, obj2 new (to be appended in old), "", "a")

    for (var i = 0i < obj2.lengthi++) {

      Object.assign(obj[i], obj2[i]); // common property will be replaced with latest value
    }
    return obj;
  }
}

Comments

Top Posts

SQL Server Symmetric Key & Certificate based Encryption With AES_256 Algorithm

Kendo Grid Angular Column Width, minResizableWidth dynamic

Kendo Grid AutoFit Columns