Bijoujs / Bijou.js

Bijou.js: Useful JavaScript snippets in one simple library
https://bijou.js.org
GNU General Public License v3.0
32 stars 8 forks source link

Remove hundreds of lines #103

Closed GrahamSH-LLK closed 3 years ago

GrahamSH-LLK commented 3 years ago

In the code, we have this. Really? Hundreds of lines of code to add to an array? Can we attempt to remove this?

let _temp = {
  addEventListeners: addEventListeners,
  addStyles: addStyles,
  animate: animate,
  arrayDiff: arrayDiff,
  arrayToCSV: arrayToCSV,
  attributes: attributes,
  averageBy: averageBy,
  blendColors: blendColors,
  browser: browser,
  byteSize: byteSize,
  camelCase: camelCase,
  capitalize: capitalize,
  clone: clone,
  compStyle: compStyle,
  composeFunction: composeFunction,
  contains: contains,
  context: context,
  cookies: cookies,
  copy: copy,
  createElement: createElement,
  curryFunction: curryFunction,
  dayName: dayName,
  diff: diff,
  disableRightClick: disableRightClick,
  dispatch: dispatch,
  drag: drag,
  each: each,
  ease: ease,
  editDistance: editDistance,
  elementSiblings: elementSiblings,
  escapeHTML: escapeHTML,
  flatten: flatten,
  formToObject: formToObject,
  formatHTML: formatHTML,
  formatMilliseconds: formatMilliseconds,
  formatNumber: formatNumber,
  fullScreen: fullScreen,
  getHTML: getHTML,
  getJSON: getJSON,
  hashString: hashString,
  hexToRGB: hexToRGB,
  hub: hub,
  imageToData: imageToData,
  inPartialView: inPartialView,
  inView: inView,
  inlineCSS: inlineCSS,
  isAsync: isAsync,
  jsonToCsv: jsonToCsv,
  lightOrDark: lightOrDark,
  lightenColor: lightenColor,
  listen: listen,
  loadScript: loadScript,
  mapObjectKeys: mapObjectKeys,
  mapObjectValues: mapObjectValues,
  markdownToHTML: markdownToHTML,
  memoize: memoize,
  merge: merge,
  mobileOrDesktop: mobileOrDesktop,
  nFlatten: nFlatten,
  notify: notify,
  observeMutations: observeMutations,
  onOutsideClick: onOutsideClick,
  onScrollStop: onScrollStop,
  parseHTML: parseHTML,
  preloadImage: preloadImage,
  previousPage: previousPage,
  primesTo: primesTo,
  querySelector: querySelector,
  random: random,
  randomColor: randomColor,
  range: range,
  regex: regex,
  remove: remove,
  removeComments: removeComments,
  removeTags: removeTags,
  replaceBetween: replaceBetween,
  replaceMultiple: replaceMultiple,
  replaceSelection: replaceSelection,
  replaceText: replaceText,
  requestInterval: requestInterval,
  rgbToHex: rgbToHex,
  runAsync: runAsync,
  sanitize: sanitize,
  saveBlob: saveBlob,
  scrambleString: scrambleString,
  seedRandom: seedRandom,
  serializeForm: serializeForm,
  shuffleArray: shuffleArray,
  sortObj: sortObj,
  sortTable: sortTable,
  sortTableBy: sortTableBy,
  speak: speak,
  splice: splice,
  spliceArrayBuffer: spliceArrayBuffer,
  syllables: syllables,
  syntaxHighlight: syntaxHighlight,
  textNodes: textNodes,
  throttle: throttle,
  tilt: tilt,
  timeFunction: timeFunction,
  unCamelCase: unCamelCase,
  unescapeHTML: unescapeHTML,
  unionArrays: unionArrays,
  uniqueArray: uniqueArray,
  urlQuery: urlQuery,
  uuid: uuid,
  widows: widows,
};
Explosion-Scratch commented 3 years ago

lol, no we can't remove it. Without it we get undefined errors, and more errors, and way more errors, believe me, I tried. Minifying that section is also a bad idea, as it means that it's unreadable and hard to add new functions. (Which btw has to be done manually to _temp).

Explosion-Scratch commented 3 years ago

In bijou-min.js and bijou-node.js it's minfied.