/**
 * Created by geweimin on 17/6/19.
 */
export const addClassName = (obj, cls) => {
  const objClass = obj.className;
  const blank = (objClass !== '') ? ' ' : '';
  const added = objClass + blank + cls;
  obj.className = added;
};

export const removeClassName = (obj, cls) => {
  let objClass = ' ' + obj.className + ' ';
  objClass = objClass.replace(/(\s+)/gi, ' ');
  let removed = objClass.replace(' ' + cls + ' ', ' ');
  removed = removed.replace(/(^\s+)|(\s+$)/g, '');
  obj.className = removed;
};
