afa7bb666b7617f94c9b5fa60cbf3620.json 2.81 KB
{"ast":null,"code":"/** Used as references for various `Number` constants. */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n/* Built-in method references for those with the same name as other `lodash` methods. */\n\nvar nativeFloor = Math.floor;\n/**\n * The base implementation of `_.repeat` which doesn't coerce arguments.\n *\n * @private\n * @param {string} string The string to repeat.\n * @param {number} n The number of times to repeat the string.\n * @returns {string} Returns the repeated string.\n */\n\nfunction baseRepeat(string, n) {\n  var result = '';\n\n  if (!string || n < 1 || n > MAX_SAFE_INTEGER) {\n    return result;\n  } // Leverage the exponentiation by squaring algorithm for a faster repeat.\n  // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.\n\n\n  do {\n    if (n % 2) {\n      result += string;\n    }\n\n    n = nativeFloor(n / 2);\n\n    if (n) {\n      string += string;\n    }\n  } while (n);\n\n  return result;\n}\n\nmodule.exports = baseRepeat;","map":{"version":3,"sources":["C:/Users/kkwan_000/Desktop/git/2017110269/minsung/node_modules/lodash/_baseRepeat.js"],"names":["MAX_SAFE_INTEGER","nativeFloor","Math","floor","baseRepeat","string","n","result","module","exports"],"mappings":"AAAA;AACA,IAAIA,gBAAgB,GAAG,gBAAvB;AAEA;;AACA,IAAIC,WAAW,GAAGC,IAAI,CAACC,KAAvB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASC,UAAT,CAAoBC,MAApB,EAA4BC,CAA5B,EAA+B;AAC7B,MAAIC,MAAM,GAAG,EAAb;;AACA,MAAI,CAACF,MAAD,IAAWC,CAAC,GAAG,CAAf,IAAoBA,CAAC,GAAGN,gBAA5B,EAA8C;AAC5C,WAAOO,MAAP;AACD,GAJ4B,CAK7B;AACA;;;AACA,KAAG;AACD,QAAID,CAAC,GAAG,CAAR,EAAW;AACTC,MAAAA,MAAM,IAAIF,MAAV;AACD;;AACDC,IAAAA,CAAC,GAAGL,WAAW,CAACK,CAAC,GAAG,CAAL,CAAf;;AACA,QAAIA,CAAJ,EAAO;AACLD,MAAAA,MAAM,IAAIA,MAAV;AACD;AACF,GARD,QAQSC,CART;;AAUA,SAAOC,MAAP;AACD;;AAEDC,MAAM,CAACC,OAAP,GAAiBL,UAAjB","sourcesContent":["/** Used as references for various `Number` constants. */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeFloor = Math.floor;\n\n/**\n * The base implementation of `_.repeat` which doesn't coerce arguments.\n *\n * @private\n * @param {string} string The string to repeat.\n * @param {number} n The number of times to repeat the string.\n * @returns {string} Returns the repeated string.\n */\nfunction baseRepeat(string, n) {\n  var result = '';\n  if (!string || n < 1 || n > MAX_SAFE_INTEGER) {\n    return result;\n  }\n  // Leverage the exponentiation by squaring algorithm for a faster repeat.\n  // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.\n  do {\n    if (n % 2) {\n      result += string;\n    }\n    n = nativeFloor(n / 2);\n    if (n) {\n      string += string;\n    }\n  } while (n);\n\n  return result;\n}\n\nmodule.exports = baseRepeat;\n"]},"metadata":{},"sourceType":"script"}