Skip to content

Commit

Permalink
Auto-generated commit
Browse files Browse the repository at this point in the history
  • Loading branch information
stdlib-bot committed Nov 1, 2023
1 parent 86b372e commit 42301e8
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 68 deletions.
1 change: 1 addition & 0 deletions .github/.keepalive
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2023-11-01T00:37:55.975Z
12 changes: 10 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,11 @@ jobs:
fi
# Trim leading and trailing whitespace:
dep=$(echo "$dep" | xargs)
version="^$(npm view $dep version)"
version="$(npm view $dep version)"
if [[ -z "$version" ]]; then
continue
fi
version="^$version"
jq -r --arg dep "$dep" --arg version "$version" '.dependencies[$dep] = $version' package.json > package.json.tmp
mv package.json.tmp package.json
done
Expand All @@ -192,7 +196,11 @@ jobs:
fi
# Trim leading and trailing whitespace:
dep=$(echo "$dep" | xargs)
version="^$(npm view $dep version)"
version="$(npm view $dep version)"
if [[ -z "$version" ]]; then
continue
fi
version="^$version"
jq -r --arg dep "$dep" --arg version "$version" '.devDependencies[$dep] = $version' package.json > package.json.tmp
mv package.json.tmp package.json
done
Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,4 @@ Stephannie Jiménez Gacha <[email protected]>
Yernar Yergaziyev <[email protected]>
orimiles5 <[email protected]>
rei2hu <[email protected]>
Robert Gislason <[email protected]>
69 changes: 3 additions & 66 deletions test/dist/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,76 +21,13 @@
// MODULES //

var tape = require( 'tape' );
var first = require( './../../dist' );
var main = require( './../../dist' );


// TESTS //

tape( 'main export is a function', function test( t ) {
tape( 'main export is defined', function test( t ) {
t.ok( true, __filename );
t.strictEqual( typeof first, 'function', 'main export is a function' );
t.end();
});

tape( 'the function returns an empty string if provided an empty string', function test( t ) {
t.strictEqual( first( '', 1 ), '', 'returns expected value' );
t.strictEqual( first( '', 2 ), '', 'returns expected value' );
t.strictEqual( first( '', 3 ), '', 'returns expected value' );
t.end();
});

tape( 'the function returns an empty string if provided zero as the second argument', function test( t ) {
t.strictEqual( first( 'hello world', 0 ), '', 'returns expected value' );
t.end();
});

tape( 'the function returns the first Unicode code point of a provided string (ascii)', function test( t ) {
var out;

out = first( 'hello world', 1 );
t.strictEqual( out, 'h', 'returns expected value' );

out = first( '!!!', 1 );
t.strictEqual( out, '!', 'returns expected value' );

out = first( 'Hello World', 1 );
t.strictEqual( out, 'H', 'returns expected value' );

t.end();
});

tape( 'the function returns the first Unicode code point of a provided string (Unicode)', function test( t ) {
var out;

out = first( 'अनुच्छेद', 1 );
t.strictEqual( out, 'अ', 'returns expected value' );

out = first( '六书/六書', 1 );
t.strictEqual( out, '六', 'returns expected value' );

t.end();
});

tape( 'the function supports returning the first `n` Unicode code points of a provided string', function test( t ) {
var out;

out = first( 'hello world', 1 );
t.strictEqual( out, 'h', 'returns expected value' );

out = first( 'hello world', 7 );
t.strictEqual( out, 'hello w', 'returns expected value' );

out = first( '!!!', 1 );
t.strictEqual( out, '!', 'returns expected value' );

out = first( '!!!', 2 );
t.strictEqual( out, '!!', 'returns expected value' );

out = first( 'अनुच्छेद', 1 );
t.strictEqual( out, 'अ', 'returns expected value' );

out = first( '六书/六書', 3 );
t.strictEqual( out, '六书/', 'returns expected value' );

t.strictEqual( main !== void 0, true, 'main export is defined' );
t.end();
});

0 comments on commit 42301e8

Please sign in to comment.