code-error-fragment
Advanced tools
Comparing version 0.0.216 to 0.0.217
62
build.js
@@ -16,2 +16,64 @@ (function (global, factory) { | ||
/** | ||
* Results cache | ||
*/ | ||
var res = ''; | ||
var cache; | ||
/** | ||
* Expose `repeat` | ||
*/ | ||
var repeatString = repeat; | ||
/** | ||
* Repeat the given `string` the specified `number` | ||
* of times. | ||
* | ||
* **Example:** | ||
* | ||
* ```js | ||
* var repeat = require('repeat-string'); | ||
* repeat('A', 5); | ||
* //=> AAAAA | ||
* ``` | ||
* | ||
* @param {String} `string` The string to repeat | ||
* @param {Number} `number` The number of times to repeat the string | ||
* @return {String} Repeated string | ||
* @api public | ||
*/ | ||
function repeat(str, num) { | ||
if (typeof str !== 'string') { | ||
throw new TypeError('expected a string'); | ||
} | ||
// cover common, quick use cases | ||
if (num === 1) return str; | ||
if (num === 2) return str + str; | ||
var max = str.length * num; | ||
if (cache !== str || typeof cache === 'undefined') { | ||
cache = str; | ||
res = ''; | ||
} else if (res.length >= max) { | ||
return res.substr(0, max); | ||
} | ||
while (max > res.length && num > 1) { | ||
if (num & 1) { | ||
res += str; | ||
} | ||
num >>= 1; | ||
str += str; | ||
} | ||
res += str; | ||
res = res.substr(0, max); | ||
return res; | ||
} | ||
'use strict'; | ||
@@ -18,0 +80,0 @@ |
@@ -1,2 +0,2 @@ | ||
import nprepeatString from 'repeat-string'; | ||
import repeatString from 'repeat-string'; | ||
import padStart from 'pad-start'; | ||
@@ -3,0 +3,0 @@ |
{ | ||
"name": "code-error-fragment", | ||
"version": "0.0.216", | ||
"version": "0.0.217", | ||
"author": "Vlad Trushin", | ||
@@ -16,4 +16,4 @@ "homepage": "https://github.com/vtrushin/code-error-fragment", | ||
"main": "build.js", | ||
"module": "index", | ||
"jsnext:main": "index", | ||
"module": "module", | ||
"jsnext:main": "module", | ||
"dependencies": { | ||
@@ -20,0 +20,0 @@ "pad-start": "^1.0.2", |
@@ -6,27 +6,9 @@ import commonjs from 'rollup-plugin-commonjs'; | ||
export default { | ||
const plugins = [ | ||
commonjs(), | ||
resolve() | ||
]; | ||
const settings = { | ||
input: 'index.js', | ||
name: 'codeErrorFragment', | ||
output: { | ||
file: 'build.js', | ||
format: 'umd' | ||
}, | ||
plugins: [ | ||
resolve(), | ||
commonjs(), | ||
babel({ | ||
exclude: 'node_modules/**', | ||
presets: [ | ||
['es2015', { | ||
modules: false | ||
}], | ||
'stage-3' | ||
], | ||
plugins: [ | ||
'external-helpers' | ||
], | ||
// fixing temporary rollup's regression, remove when https://github.com/rollup/rollup/issues/1595 gets solved | ||
externalHelpersWhitelist: babelHelpersList.filter(helperName => helperName !== 'asyncGenerator'), | ||
}) | ||
], | ||
watch: { | ||
@@ -36,2 +18,38 @@ include: '*.js', | ||
} | ||
} | ||
}; | ||
export default [ | ||
// ES5 build | ||
Object.assign({}, settings, { | ||
name: 'codeErrorFragment', | ||
output: { | ||
file: 'build.js', | ||
format: 'umd' | ||
}, | ||
plugins: plugins.concat( | ||
babel({ | ||
exclude: 'node_modules/**', | ||
presets: [ | ||
['es2015', { | ||
modules: false | ||
}], | ||
'stage-3' | ||
], | ||
plugins: [ | ||
'external-helpers' | ||
], | ||
// fixing temporary rollup's regression, remove when https://github.com/rollup/rollup/issues/1595 gets solved | ||
externalHelpersWhitelist: babelHelpersList.filter(helperName => helperName !== 'asyncGenerator'), | ||
}) | ||
) | ||
}), | ||
// ES6 module | ||
Object.assign({}, settings, { | ||
output: { | ||
file: 'module.js', | ||
format: 'es' | ||
}, | ||
plugins | ||
}) | ||
] |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11686
8
314