Socket
Socket
Sign inDemoInstall

@stdlib/buffer-from-string

Package Overview
Dependencies
27
Maintainers
4
Versions
12
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.7 to 0.0.8

5

lib/main.js

@@ -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": {

19

README.md

@@ -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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc