-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4e4fe0c
commit 8115bae
Showing
24 changed files
with
2,944 additions
and
10 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -59,6 +59,30 @@ jobs: | |
steps: ${{ toJson(steps) }} | ||
channel: '#npm-ci' | ||
if: failure() | ||
increment: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout main branch | ||
uses: actions/checkout@v2 | ||
with: | ||
ref: main | ||
- name: Increment version in `package.json` to the version number of the tag | ||
run: | | ||
VERSION=$(echo ${{ github.ref }} | sed -E 's/refs\/tags\/v?([0-9]+.[0-9]+.[0-9]+).*/\1/') | ||
sed -Ei "s/\"version\": \"[^\"]+\"/\"version\": \"$VERSION\"/g" package.json | ||
- name: Configure git | ||
run: | | ||
git config --local user.email "[email protected]" | ||
git config --local user.name "stdlib-bot" | ||
- name: Commit changes | ||
run: | | ||
git add package.json | ||
git commit -m "Auto-generated commit" | ||
- name: Push changes | ||
run: | | ||
SLUG=${{ github.repository }} | ||
echo "Pushing changes to $SLUG..." | ||
git push "https://$GITHUB_ACTOR:[email protected]/$SLUG.git" main | ||
cancel: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 3 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
#/ | ||
# @license Apache-2.0 | ||
# | ||
# Copyright (c) 2022 The Stdlib Authors. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
#/ | ||
|
||
# Workflow name: | ||
name: Test Loading Bundles | ||
|
||
# Workflow triggers: | ||
on: | ||
workflow_run: | ||
workflows: ["bundle"] | ||
types: [completed] | ||
workflow_dispatch: | ||
|
||
# Workflow jobs: | ||
jobs: | ||
test-umd: | ||
runs-on: ubuntu-latest | ||
env: | ||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | ||
steps: | ||
- name: Checkout branch with UMD build | ||
uses: actions/checkout@v2 | ||
with: | ||
ref: umd | ||
- name: Setup Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: 17 | ||
- name: Try loading UMD module | ||
run: | | ||
node --eval "require( './bundle.js' )" || exit $? | ||
- name: Send status to Slack channel in case of failure | ||
uses: act10ns/slack@v1 | ||
with: | ||
status: ${{ job.status }} | ||
steps: ${{ toJson(steps) }} | ||
channel: '#npm-ci' | ||
if: failure() | ||
test-esm: | ||
runs-on: ubuntu-latest | ||
env: | ||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | ||
steps: | ||
- name: Checkout branch with ESM build | ||
uses: actions/checkout@v2 | ||
with: | ||
ref: esm | ||
- name: Setup Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: 17 | ||
- name: Try loading ESM | ||
run: | | ||
node --experimental-network-imports --eval "import( './index.mjs' )" || exit $? | ||
- name: Send status to Slack channel in case of failure | ||
uses: act10ns/slack@v1 | ||
with: | ||
status: ${{ job.status }} | ||
steps: ${{ toJson(steps) }} | ||
channel: '#npm-ci' | ||
if: failure() | ||
test-deno: | ||
runs-on: ubuntu-latest | ||
env: | ||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | ||
steps: | ||
- name: Checkout branch with Deno build | ||
uses: actions/checkout@v2 | ||
with: | ||
ref: deno | ||
- name: Install Deno | ||
uses: denoland/setup-deno@v1 | ||
with: | ||
deno-version: vx.x.x | ||
- name: Try loading Deno build | ||
run: | | ||
deno eval "import main from './mod.js'" || exit $? | ||
- name: Send status to Slack channel in case of failure | ||
uses: act10ns/slack@v1 | ||
with: | ||
status: ${{ job.status }} | ||
steps: ${{ toJson(steps) }} | ||
channel: '#npm-ci' | ||
if: failure() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
<!-- | ||
@license Apache-2.0 | ||
Copyright (c) 2022 The Stdlib Authors. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
--> | ||
|
||
# sprintf | ||
|
||
> Insert supplied variable values into a format string. | ||
<section class="intro"> | ||
|
||
</section> | ||
|
||
<!-- /.intro --> | ||
|
||
<section class="usage"> | ||
|
||
## Usage | ||
|
||
```javascript | ||
var sprintf = require( '@stdlib/string/sprintf' ); | ||
``` | ||
|
||
#### sprintf( str, ...args ) | ||
|
||
Inserts supplied variable values into a format string. | ||
|
||
```javascript | ||
var str = 'Hello, %s! My name is %s.'; | ||
var out = sprintf( str, 'world', 'Bob' ); | ||
// returns 'Hello, world! My name is Bob.' | ||
``` | ||
|
||
The format string is a string literal containing zero or more conversion specifications, each of which results in a string value being inserted to the output string. A conversion specification consists of a percent sign (`%`) followed by one or more of the following flags, width, precision, and conversion type characters: | ||
|
||
| type | description | notes | | ||
| ---- | -------------------------| ------------ | | ||
| s | string | | | ||
| c | character | | | ||
| d | signed decimal integer | | | ||
| i | signed decimal integer | | | ||
| u | unsigned decimal integer | | | ||
| b | unsigned binary integer | | | ||
| o | unsigned octal integer | | | ||
| x | unsigned hexadecimal | | | ||
| X | unsigned hexadecimal | | | ||
| f | floating point | | | ||
| e | floating point | | | ||
| E | floating point | | | ||
| g | floating point | | | ||
| G | floating point | | | ||
|
||
</section> | ||
|
||
<!-- /.usage --> | ||
|
||
<section class="examples"> | ||
|
||
## Examples | ||
|
||
<!-- eslint no-undef: "error" --> | ||
|
||
```javascript | ||
var sprintf = require( '@stdlib/string/sprintf' ); | ||
|
||
var out = sprintf( '%s %s!', 'Hello', 'World' ); | ||
// returns 'Hello World!' | ||
|
||
out = sprintf( 'Pi: ~%.2f', 3.141592653589793 ); | ||
// returns 'Pi: ~3.14' | ||
|
||
out = sprintf( '%-10s %-10s', 'a', 'b' ); | ||
// returns 'a b ' | ||
|
||
out = sprintf( '%10s %10s', 'a', 'b' ); | ||
// returns ' a b' | ||
|
||
out = sprintf( '%2$s %1$s %3$s', 'b', 'a', 'c' ); | ||
// returns 'a b c' | ||
``` | ||
|
||
</section> | ||
|
||
<!-- /.examples --> | ||
|
||
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. --> | ||
|
||
<section class="related"> | ||
|
||
</section> | ||
|
||
<!-- /.related --> | ||
|
||
<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> | ||
|
||
<section class="links"> | ||
|
||
</section> | ||
|
||
<!-- /.links --> |
Oops, something went wrong.