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 Mar 23, 2022
1 parent 9de89e4 commit a763e73
Show file tree
Hide file tree
Showing 22 changed files with 53 additions and 34 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
benchmark:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: actions/setup-node@v2
with:
node-version: 16
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/bundle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ on:
push:
branches:
- main
tags_ignore:
tags-ignore:
- 'v[0-9]+\.[0-9]+\.[0-9]+'

# Workflow jobs:
jobs:
deno:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Copy files to deno directory
run: |
mkdir -p deno
Expand Down Expand Up @@ -92,7 +92,7 @@ jobs:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./deno
publish_branch: deno
keep_files: true
force_orphan: true
user_name: 'stdlib-bot'
user_email: '[email protected]'
commit_message: 'Auto-generated commit'
Expand All @@ -107,7 +107,7 @@ jobs:
umd:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Copy files to umd directory
run: |
mkdir -p umd
Expand Down Expand Up @@ -153,7 +153,7 @@ jobs:
find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "1 while s/<script type=\"text\/javascript\">\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);?/<script type=\"text\/javascript\" src=\"https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/bundle.js\"><\/script>\n<script type=\"text\/javascript\">/g"
# Wrap contents of `<script type="text/javascript">` tag contents in an IIFE:
find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/<script type=\"text\/javascript\">([\s\S]+?)<\/script>/<script type=\"text\/javascript\">\n\(function \(\) {\1}\)\(\)\n<\/script>/g"
find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/<script type=\"text\/javascript\">([\s\S]+?)<\/script>/<script type=\"text\/javascript\">\n\(function \(\) {\1}\)\(\);\n<\/script>/g"
# Create package.json file for umd branch:
jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "main": "./bundle.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./umd/package.json
Expand All @@ -164,7 +164,7 @@ jobs:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./umd
publish_branch: umd
keep_files: true
force_orphan: true
user_name: 'stdlib-bot'
user_email: '[email protected]'
commit_message: 'Auto-generated commit'
Expand All @@ -179,7 +179,7 @@ jobs:
esm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Copy files to umd directory
run: |
mkdir -p esm
Expand Down Expand Up @@ -242,7 +242,7 @@ jobs:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./esm
publish_branch: esm
keep_files: true
force_orphan: true
user_name: 'stdlib-bot'
user_email: '[email protected]'
commit_message: 'Auto-generated commit'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
examples:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: actions/setup-node@v2
with:
node-version: 16
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: actions/setup-node@v2
with:
node-version: 16
Expand Down Expand Up @@ -63,7 +63,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout main branch
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
ref: main
- name: Increment version in `package.json` to the version number of the tag
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: actions/setup-node@v2
with:
node-version: 16
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test_bundles.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
steps:
- name: Checkout branch with UMD build
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
ref: umd
- name: Setup Node.js
Expand All @@ -57,7 +57,7 @@ jobs:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
steps:
- name: Checkout branch with ESM build
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
ref: esm
- name: Setup Node.js
Expand All @@ -80,7 +80,7 @@ jobs:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
steps:
- name: Checkout branch with Deno build
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
ref: deno
- name: Install Deno
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test_coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: actions/setup-node@v2
with:
node-version: 16
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test_install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: actions/setup-node@v2
with:
node-version: 16
Expand Down
19 changes: 19 additions & 0 deletions docs/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ import rtrim = require( './../../right-trim' );
import rtrimN = require( './../../right-trim-n' );
import snakecase = require( './../../snakecase' );
import splitGraphemeClusters = require( './../../split-grapheme-clusters' );
import format = require( './../../format' );
import startcase = require( './../../startcase' );
import startsWith = require( './../../starts-with' );
import substringAfter = require( './../../substring-after' );
Expand Down Expand Up @@ -800,6 +801,24 @@ interface Namespace {
*/
splitGraphemeClusters: typeof splitGraphemeClusters;

/**
* Inserts supplied variable values into a format string.
*
* @param str - input string
* @param ...args - variable values
* @throws invalid flags
* @returns formatted string
*
* @example
* var str = ns.format( 'Hello %s!', 'world' );
* // returns 'Hello world!'
*
* @example
* var str = ns.format( 'Pi: ~%.2f', 3.141592653589793 );
* // returns 'Pi: ~3.14'
*/
format: typeof format;

/**
* Capitalizes the first letter of each word in an input string.
*
Expand Down
2 changes: 1 addition & 1 deletion kebabcase/lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ var RE_CAMEL = /([a-z0-9])([A-Z])/g;
*/
function kebabCase( str ) {
if ( !isString( str ) ) {
throw new TypeError( format( 'invalid argument. Must provide a string primitive. Value: `%s`.', str ) );
throw new TypeError( format( 'invalid argument. Must provide a string. Value: `%s`.', str ) );
}
str = replace( str, RE_SPECIAL, ' ' );
str = replace( str, RE_CAMEL, '$1 $2' );
Expand Down
2 changes: 1 addition & 1 deletion left-trim/lib/left_trim.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ var RE = /^[\u0020\f\n\r\t\v\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3
*/
function ltrim( str ) {
if ( !isString( str ) ) {
throw new TypeError( format( 'invalid argument. Must provide a string primitive. Value: `%s`.', str ) );
throw new TypeError( format( 'invalid argument. Must provide a string. Value: `%s`.', str ) );
}
return replace( str, RE, '' );
}
Expand Down
4 changes: 2 additions & 2 deletions lowercase/lib/lowercase.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ var format = require( './../../format' );
* Converts a string to lowercase.
*
* @param {string} str - string to convert
* @throws {TypeError} must provide a primitive string
* @throws {TypeError} must provide a string
* @returns {string} lowercase string
*
* @example
Expand All @@ -39,7 +39,7 @@ var format = require( './../../format' );
*/
function lowercase( str ) {
if ( !isString( str ) ) {
throw new TypeError( format( 'invalid argument. Must provide a primitive string. Value: `%s`.', str ) );
throw new TypeError( format( 'invalid argument. Must provide a string. Value: `%s`.', str ) );
}
return str.toLowerCase();
}
Expand Down
2 changes: 1 addition & 1 deletion remove-punctuation/lib/remove_punctuation.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ var RE = /[!"'(),–.:;<>?`{}|~\/\\\[\]]/g; // eslint-disable-line no-useless-es
*/
function removePunctuation( str ) {
if ( !isString( str ) ) {
throw new TypeError( format( 'invalid argument. Must provide a string primitive. Value: `%s`.', str ) );
throw new TypeError( format( 'invalid argument. Must provide a string. Value: `%s`.', str ) );
}
return replace( str, RE, '' );
}
Expand Down
2 changes: 1 addition & 1 deletion remove-utf8-bom/lib/remove_utf_8_bom.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ var BOM = 65279;
*/
function removeUTF8BOM( str ) {
if ( !isString( str ) ) {
throw new TypeError( format( 'invalid argument. Must provide a string primitive. Value: `%s`.', str ) );
throw new TypeError( format( 'invalid argument. Must provide a string. Value: `%s`.', str ) );
}
if ( str.charCodeAt( 0 ) === BOM ) {
return str.slice( 1 );
Expand Down
2 changes: 1 addition & 1 deletion right-trim-n/lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ function rtrimN( str, n, chars ) {
var RE;
var i;
if ( !isString( str ) ) {
throw new TypeError( format( 'invalid argument. Must provide a string primitive. Value: `%s`.', str ) );
throw new TypeError( format( 'invalid argument. Must provide a string. Value: `%s`.', str ) );
}
if ( !isNonNegativeInteger( n ) ) {
throw new TypeError( format( 'invalid argument. Must provide a nonnegative integer. Value: `%s`.', n ) );
Expand Down
2 changes: 1 addition & 1 deletion right-trim/lib/right_trim.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ var RE = /[\u0020\f\n\r\t\v\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u30
*/
function rtrim( str ) {
if ( !isString( str ) ) {
throw new TypeError( format( 'invalid argument. Must provide a string primitive. Value: `%s`.', str ) );
throw new TypeError( format( 'invalid argument. Must provide a string. Value: `%s`.', str ) );
}
return replace( str, RE, '' );
}
Expand Down
2 changes: 1 addition & 1 deletion snakecase/lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ var RE_CAMEL = /([a-z0-9])([A-Z])/g;
*/
function snakecase( str ) {
if ( !isString( str ) ) {
throw new TypeError( format( 'invalid argument. Must provide a string primitive. Value: `%s`.', str ) );
throw new TypeError( format( 'invalid argument. Must provide a string. Value: `%s`.', str ) );
}
str = replace( str, RE_SPECIAL, ' ' );
str = replace( str, RE_CAMEL, '$1 $2' );
Expand Down
4 changes: 2 additions & 2 deletions startcase/lib/startcase.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ var format = require( './../../format' );
* Capitalizes the first letter of each word in an input string.
*
* @param {string} str - string to convert
* @throws {TypeError} must provide a primitive string
* @throws {TypeError} must provide a string
* @returns {string} start case string
*
* @example
Expand All @@ -44,7 +44,7 @@ function startcase( str ) {
var ch;
var i;
if ( !isString( str ) ) {
throw new TypeError( format( 'invalid argument. Must provide a primitive string. Value: `%s`.', str ) );
throw new TypeError( format( 'invalid argument. Must provide a string. Value: `%s`.', str ) );
}
cap = true;
out = '';
Expand Down
2 changes: 1 addition & 1 deletion trim/lib/trim.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ var RE = /^[\u0020\f\n\r\t\v\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3
*/
function trim( str ) {
if ( !isString( str ) ) {
throw new TypeError( format( 'invalid argument. Must provide a string primitive. Value: `%s`.', str ) );
throw new TypeError( format( 'invalid argument. Must provide a string. Value: `%s`.', str ) );
}
return replace( str, RE, '$1' );
}
Expand Down
2 changes: 1 addition & 1 deletion truncate-middle/lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ function truncateMiddle( str, len, seq ) {
throw new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) );
}
if ( !isNonNegativeInteger( len ) ) {
throw new TypeError( format( 'invalid argument. Second argument must be a nonnegative integer primitive. Value: `%s`.', len ) );
throw new TypeError( format( 'invalid argument. Second argument must be a nonnegative integer. Value: `%s`.', len ) );
}
if ( arguments.length > 2 ) {
if ( !isString( seq ) ) {
Expand Down
2 changes: 1 addition & 1 deletion truncate/lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ function truncate( str, len, ending ) {
throw new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) );
}
if ( !isNonNegativeInteger( len ) ) {
throw new TypeError( format( 'invalid argument. Second argument must be a nonnegative integer primitive. Value: `%s`.', len ) );
throw new TypeError( format( 'invalid argument. Second argument must be a nonnegative integer. Value: `%s`.', len ) );
}
if ( arguments.length > 2 ) {
if ( !isString( ending ) ) {
Expand Down
4 changes: 2 additions & 2 deletions uppercase/lib/uppercase.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ var format = require( './../../format' );
* Converts a string to uppercase.
*
* @param {string} str - string to convert
* @throws {TypeError} must provide a primitive string
* @throws {TypeError} must provide a string
* @returns {string} uppercase string
*
* @example
Expand All @@ -39,7 +39,7 @@ var format = require( './../../format' );
*/
function uppercase( str ) {
if ( !isString( str ) ) {
throw new TypeError( format( 'invalid argument. Must provide a primitive string. Value: `%s`.', str ) );
throw new TypeError( format( 'invalid argument. Must provide a string. Value: `%s`.', str ) );
}
return str.toUpperCase();
}
Expand Down

0 comments on commit a763e73

Please sign in to comment.