@stdlib/buffer-from-string
Advanced tools
Comparing version 0.0.7 to 0.0.8
@@ -24,2 +24,3 @@ /** | ||
var isString = require( '@stdlib/assert-is-string' ).isPrimitive; | ||
var format = require( '@stdlib/string-format' ); | ||
var Buffer = require( '@stdlib/buffer-ctor' ); | ||
@@ -46,7 +47,7 @@ | ||
if ( !isString( str ) ) { | ||
throw new TypeError( 'invalid argument. First argument must be a string. Value: `' + str + '`' ); | ||
throw new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) ); | ||
} | ||
if ( arguments.length > 1 ) { | ||
if ( !isString( encoding ) ) { | ||
throw new TypeError( 'invalid argument. Second argument must be a string. Value: `' + encoding + '`' ); | ||
throw new TypeError( format( 'invalid argument. Second argument must be a string. Value: `%s`.', encoding ) ); | ||
} | ||
@@ -53,0 +54,0 @@ return Buffer.from( str, encoding ); |
@@ -24,2 +24,3 @@ /** | ||
var isString = require( '@stdlib/assert-is-string' ).isPrimitive; | ||
var format = require( '@stdlib/string-format' ); | ||
var Buffer = require( '@stdlib/buffer-ctor' ); | ||
@@ -46,7 +47,7 @@ | ||
if ( !isString( str ) ) { | ||
throw new TypeError( 'invalid argument. First argument must be a string. Value: `' + str + '`' ); | ||
throw new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) ); | ||
} | ||
if ( arguments.length > 1 ) { | ||
if ( !isString( encoding ) ) { | ||
throw new TypeError( 'invalid argument. Second argument must be a string. Value: `' + encoding + '`' ); | ||
throw new TypeError( format( 'invalid argument. Second argument must be a string. Value: `%s`.', encoding ) ); | ||
} | ||
@@ -53,0 +54,0 @@ return new Buffer( str, encoding ); // eslint-disable-line no-buffer-constructor |
{ | ||
"name": "@stdlib/buffer-from-string", | ||
"version": "0.0.7", | ||
"version": "0.0.8", | ||
"description": "Allocate a buffer containing a provided string.", | ||
@@ -42,3 +42,4 @@ "license": "Apache-2.0", | ||
"@stdlib/assert-is-string": "^0.0.x", | ||
"@stdlib/buffer-ctor": "^0.0.x" | ||
"@stdlib/buffer-ctor": "^0.0.x", | ||
"@stdlib/string-format": "^0.0.x" | ||
}, | ||
@@ -45,0 +46,0 @@ "devDependencies": { |
@@ -191,4 +191,4 @@ <!-- | ||
[test-image]: https://github.com/stdlib-js/buffer-from-string/actions/workflows/test.yml/badge.svg | ||
[test-url]: https://github.com/stdlib-js/buffer-from-string/actions/workflows/test.yml | ||
[test-image]: https://github.com/stdlib-js/buffer-from-string/actions/workflows/test.yml/badge.svg?branch=v0.0.8 | ||
[test-url]: https://github.com/stdlib-js/buffer-from-string/actions/workflows/test.yml?query=branch:v0.0.8 | ||
@@ -205,2 +205,9 @@ [coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/buffer-from-string/main.svg | ||
[chat-image]: https://img.shields.io/gitter/room/stdlib-js/stdlib.svg | ||
[chat-url]: https://gitter.im/stdlib-js/stdlib/ | ||
[stdlib]: https://github.com/stdlib-js/stdlib | ||
[stdlib-authors]: https://github.com/stdlib-js/stdlib/graphs/contributors | ||
[umd]: https://github.com/umdjs/umd | ||
@@ -212,10 +219,4 @@ [es-module]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules | ||
[esm-url]: https://github.com/stdlib-js/buffer-from-string/tree/esm | ||
[branches-url]: https://github.com/stdlib-js/buffer-from-string/blob/main/branches.md | ||
[chat-image]: https://img.shields.io/gitter/room/stdlib-js/stdlib.svg | ||
[chat-url]: https://gitter.im/stdlib-js/stdlib/ | ||
[stdlib]: https://github.com/stdlib-js/stdlib | ||
[stdlib-authors]: https://github.com/stdlib-js/stdlib/graphs/contributors | ||
[stdlib-license]: https://raw.githubusercontent.com/stdlib-js/buffer-from-string/main/LICENSE | ||
@@ -222,0 +223,0 @@ |
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
253
236
28313
4
1
+ Added@stdlib/string-format@^0.0.x
+ Added@stdlib/string-base-format-interpolate@0.0.4(transitive)
+ Added@stdlib/string-base-format-tokenize@0.0.4(transitive)
+ Added@stdlib/string-format@0.0.3(transitive)