Skip to content

Commit f135fb3

Browse files
committed
Refactor to use base package
1 parent 6828991 commit f135fb3

File tree

8 files changed

+3
-466
lines changed

8 files changed

+3
-466
lines changed

lib/node_modules/@stdlib/string/repeat/lib/builtin.js

-28
This file was deleted.

lib/node_modules/@stdlib/string/repeat/lib/has_builtin.js

-28
This file was deleted.

lib/node_modules/@stdlib/string/repeat/lib/index.js

+1-13
Original file line numberDiff line numberDiff line change
@@ -38,21 +38,9 @@
3838

3939
// MODULES //
4040

41-
var HAS_BUILTIN = require( './has_builtin.js' );
42-
var polyfill = require( './polyfill.js' );
4341
var main = require( './main.js' );
4442

4543

46-
// MAIN //
47-
48-
var repeat;
49-
if ( HAS_BUILTIN ) {
50-
repeat = main;
51-
} else {
52-
repeat = polyfill;
53-
}
54-
55-
5644
// EXPORTS //
5745

58-
module.exports = repeat;
46+
module.exports = main;

lib/node_modules/@stdlib/string/repeat/lib/main.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
var isNonNegativeInteger = require( '@stdlib/assert/is-nonnegative-integer' ).isPrimitive;
2424
var isString = require( '@stdlib/assert/is-string' ).isPrimitive;
2525
var format = require( '@stdlib/string/format' );
26-
var builtin = require( './builtin.js' );
26+
var base = require( '@stdlib/string/base/repeat' );
2727

2828

2929
// MAIN //
@@ -57,7 +57,7 @@ function repeat( str, n ) {
5757
if ( !isNonNegativeInteger( n ) ) {
5858
throw new TypeError( format( 'invalid argument. Second argument must be a nonnegative integer. Value: `%s`.', n ) );
5959
}
60-
return builtin.call( str, n );
60+
return base( str, n );
6161
}
6262

6363

lib/node_modules/@stdlib/string/repeat/lib/polyfill.js

-130
This file was deleted.

lib/node_modules/@stdlib/string/repeat/test/test.js

-19
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@
2121
// MODULES //
2222

2323
var tape = require( 'tape' );
24-
var proxyquire = require( 'proxyquire' );
25-
var polyfill = require( './../lib/polyfill.js' );
26-
var main = require( './../lib/main.js' );
2724
var repeat = require( './../lib' );
2825

2926

@@ -35,22 +32,6 @@ tape( 'main export is a function', function test( t ) {
3532
t.end();
3633
});
3734

38-
tape( 'the main export is a polyfill if an environment does not support String.prototype.repeat', function test( t ) {
39-
var repeat = proxyquire( './../lib', {
40-
'./has_builtin.js': false
41-
});
42-
t.equal( repeat, polyfill, 'returns expected value' );
43-
t.end();
44-
});
45-
46-
tape( 'the main export is a wrapper around a builtin if an environment supports String.prototype.repeat', function test( t ) {
47-
var repeat = proxyquire( './../lib', {
48-
'./has_builtin.js': true
49-
});
50-
t.equal( repeat, main, 'returns expected value' );
51-
t.end();
52-
});
53-
5435
tape( 'if the first argument is not a string, the function will throw an error', function test( t ) {
5536
var values;
5637
var i;

lib/node_modules/@stdlib/string/repeat/test/test.main.js

-127
This file was deleted.

0 commit comments

Comments
 (0)