⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 5.06 - comparing the two techniques.js

📁 JS设计模式源代码
💻 JS
字号:
/* DataParser singleton, converts character delimited strings into arrays. */ /*   Now using true private methods. */GiantCorp.DataParser = (function() {  // Private attributes.  var whitespaceRegex = /\s+/;    // Private methods.  function stripWhitespace(str) {    return str.replace(whitespaceRegex, '');  }  function stringSplit(str, delimiter) {    return str.split(delimiter);  }    // Everything returned in the object literal is public, but can access the  // members in the closure created above.  return {     // Public method.    stringToArray: function(str, delimiter, stripWS) {      if(stripWS) {        str = stripWhitespace(str);      }      var outputArray = stringSplit(str, delimiter);      return outputArray;    }  };})(); // Invoke the function and assign the returned object literal to      // GiantCorp.DataParser.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -