diff --git a/lib/node_modules/@stdlib/string/to-well-formed/README.md b/lib/node_modules/@stdlib/string/to-well-formed/README.md
new file mode 100644
index 000000000000..8472d8da94e5
--- /dev/null
+++ b/lib/node_modules/@stdlib/string/to-well-formed/README.md
@@ -0,0 +1,107 @@
+
+
+# str2wellformed
+
+> Create a new well-formed string.
+
+
+
+## Usage
+
+```javascript
+var str2wellformed = require( '@stdlib/string/to-well-formed' );
+```
+
+#### str2wellformed( str )
+
+Creates a new well-formed string by replacing all lone surrogates with the replacement character `\uFFFD`.
+
+
+
+```javascript
+var result = str2wellformed( '' );
+// returns ''
+
+result = str2wellformed( '\uDBFF' );
+// returns '�'
+
+result = str2wellformed( '\uDBFFFF\uDBFF' );
+// returns '�FF�'
+
+result = str2wellformed( '-5' );
+// returns '-5'
+```
+
+
+
+
+
+
+
+## Examples
+
+
+
+
+
+```javascript
+var str2wellformed = require( '@stdlib/string/to-well-formed' );
+
+var result = str2wellformed( '' );
+// returns ''
+
+result = str2wellformed( '\uDBFF' );
+// returns '�'
+
+result = str2wellformed( '\uDBFF\uDBFF' );
+// returns '��'
+
+result = str2wellformed( '5\uDBFF' );
+// returns '5�'
+
+result = str2wellformed( '-5' );
+// returns '-5'
+```
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/lib/node_modules/@stdlib/string/to-well-formed/benchmark/benchmark.js b/lib/node_modules/@stdlib/string/to-well-formed/benchmark/benchmark.js
new file mode 100644
index 000000000000..9dfeec913ef2
--- /dev/null
+++ b/lib/node_modules/@stdlib/string/to-well-formed/benchmark/benchmark.js
@@ -0,0 +1,59 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2024 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.
+*/
+
+'use strict';
+
+// MODULES //
+
+var bench = require( '@stdlib/bench' );
+var isString = require( '@stdlib/assert/is-string' ).isPrimitive;
+var pkg = require( './../package.json' ).name;
+var str2wellformed = require( './../lib' );
+
+
+// MAIN //
+
+bench( pkg, function benchmark( b ) {
+ var result;
+ var strs;
+ var i;
+
+ strs = [
+ '',
+ '\uDBFF',
+ 'Hello World',
+ '3.14',
+ '\uDBFF\uDBFF',
+ 'foo\uD800bar',
+ 'hello123'
+ ];
+
+ b.tic();
+ for ( i = 0; i < b.iterations; i++ ) {
+ result = str2wellformed( strs[ i % strs.length ] );
+ if ( typeof result !== 'string' ) {
+ b.fail( 'should return a string' );
+ }
+ }
+ b.toc();
+ if ( !isString( result ) ) {
+ b.fail( 'should return a string' );
+ }
+ b.pass( 'benchmark finished' );
+ b.end();
+});
diff --git a/lib/node_modules/@stdlib/string/to-well-formed/docs/repl.txt b/lib/node_modules/@stdlib/string/to-well-formed/docs/repl.txt
new file mode 100644
index 000000000000..026fbb43db50
--- /dev/null
+++ b/lib/node_modules/@stdlib/string/to-well-formed/docs/repl.txt
@@ -0,0 +1,31 @@
+
+{{alias}}( str )
+ Returns a well formed string.
+
+ Parameters
+ ----------
+ str: string
+ Input string.
+
+ Returns
+ -------
+ result: string
+ Well formed string.
+
+ Examples
+ --------
+ > result = {{alias}}( '\uDBFF' )
+ '�'
+
+ > result = {{alias}}( '\uDBFFFF\uDBFF' )
+ '�FF�'
+
+ > result = {{alias}}( '-5' )
+ '-5'
+
+ > result = {{alias}}( '\uDBFFFF\uDBFF' )
+ '�FF�'
+
+ See Also
+ --------
+
diff --git a/lib/node_modules/@stdlib/string/to-well-formed/docs/types/index.d.ts b/lib/node_modules/@stdlib/string/to-well-formed/docs/types/index.d.ts
new file mode 100644
index 000000000000..32f1c9ac5e78
--- /dev/null
+++ b/lib/node_modules/@stdlib/string/to-well-formed/docs/types/index.d.ts
@@ -0,0 +1,44 @@
+/*
+* @license Apache-2.0
+*
+* Copyright (c) 2024 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.
+*/
+
+// TypeScript Version: 4.1
+
+/**
+* Replaces all lone surrogates in order to create a new string which is well formed.
+*
+* @param str - string to test
+* @returns new string which does not contain any lone surrogates
+*
+* @example
+* var result = str2wellformed( '\uDBFF' );
+* // returns �
+*
+* @example
+* var result = str2wellformed( '\uDBFFFF\uDBFF' );
+* // returns �FF�
+*
+* @example
+* var result = str2wellformed( '-5' );
+* // returns -5
+*/
+declare function str2wellformed( str: string ): string;
+
+
+// EXPORTS //
+
+export = str2wellformed;
diff --git a/lib/node_modules/@stdlib/string/to-well-formed/docs/types/test.ts b/lib/node_modules/@stdlib/string/to-well-formed/docs/types/test.ts
new file mode 100644
index 000000000000..ffe9f74fb543
--- /dev/null
+++ b/lib/node_modules/@stdlib/string/to-well-formed/docs/types/test.ts
@@ -0,0 +1,35 @@
+/*
+* @license Apache-2.0
+*
+* Copyright (c) 2024 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.
+*/
+
+import str2wellformed = require( './index' );
+
+
+// TESTS //
+
+// The function returns a string...
+{
+ str2wellformed( '' ); // $ExpectType string
+ str2wellformed( 'Hello' ); // $ExpectType string
+ str2wellformed( '\uDBFFFF\uDBFF' ); // $ExpectType string
+}
+
+// The compiler throws an error if the function is provided an unsupported number of arguments...
+{
+ str2wellformed(); // $ExpectError
+ str2wellformed( '', '\uDBFF' ); // $ExpectError
+}
diff --git a/lib/node_modules/@stdlib/string/to-well-formed/examples/index.js b/lib/node_modules/@stdlib/string/to-well-formed/examples/index.js
new file mode 100644
index 000000000000..1a7a7852370c
--- /dev/null
+++ b/lib/node_modules/@stdlib/string/to-well-formed/examples/index.js
@@ -0,0 +1,41 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2024 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.
+*/
+
+/* eslint-disable no-new-wrappers */
+
+'use strict';
+
+var str2wellformed = require( './../lib' );
+
+console.log( str2wellformed( '' ) );
+// => ''
+
+console.log( str2wellformed( new String( '' ) ) );
+// => ''
+
+console.log( str2wellformed( '\uDFFFab' ) );
+// => '�ab'
+
+console.log( str2wellformed( '\uDBFFFF\uDBFF' ) );
+// => '�FF�'
+
+console.log( str2wellformed( 'ab\uD800' ) );
+// => 'ab�'
+
+console.log( str2wellformed( 'ab\uD83D\uDE04c' ) );
+// => 'ab😄c'
diff --git a/lib/node_modules/@stdlib/string/to-well-formed/lib/index.js b/lib/node_modules/@stdlib/string/to-well-formed/lib/index.js
new file mode 100644
index 000000000000..6520318a2e5f
--- /dev/null
+++ b/lib/node_modules/@stdlib/string/to-well-formed/lib/index.js
@@ -0,0 +1,49 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2024 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.
+*/
+
+'use strict';
+
+/**
+* Convert a string to a well formed string.
+*
+* @module @stdlib/string/to-well-formed
+*
+* @example
+* var str2wellformed = require( '@stdlib/string/to-well-formed' );
+*
+* var str = "ab\uD800";
+* var newStr = str2wellformed( str );
+* // returns ab�
+*
+* str = "ab\uD83D\uDE04c";
+* newStr = str2wellformed( str );
+* // returns ab😄c
+*
+* str = "abc";
+* bool = str2wellformed( str );
+* // returns abc
+*/
+
+// MODULES //
+
+var main = require( './main.js' );
+
+
+// EXPORTS //
+
+module.exports = main;
diff --git a/lib/node_modules/@stdlib/string/to-well-formed/lib/main.js b/lib/node_modules/@stdlib/string/to-well-formed/lib/main.js
new file mode 100644
index 000000000000..2574f4ae1339
--- /dev/null
+++ b/lib/node_modules/@stdlib/string/to-well-formed/lib/main.js
@@ -0,0 +1,75 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2024 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.
+*/
+
+'use strict';
+
+// MODULES //
+
+var isString = require( '@stdlib/assert/is-string' );
+var format = require( '@stdlib/string/format' );
+var isWellFormed = require( '@stdlib/assert/is-well-formed-string' );
+
+
+// VARIABLES //
+
+var RE_UTF16_LOW_SURROGATE = /[\uDC00-\uDFFF]/;
+var RE_UTF16_HIGH_SURROGATE = /[\uD800-\uDBFF]/;
+
+
+// MAIN //
+
+/**
+* Replaces all lone surrogates in order to create a new string which is well formed.
+*
+* @param {string} str - string to convert
+* @throws {TypeError} must provide a string
+* @returns {string} new string which does not contain any lone surrogates
+*
+* @example
+* var str = str2wellformed( 'ab\uD800' );
+* // returns 'ab�'
+*/
+function str2wellformed( str ) {
+ var modifiedString;
+ var i;
+ modifiedString = '';
+
+ if ( !isString( str ) ) {
+ throw new TypeError( format( 'invalid argument. Must provide a string. Value: `%s`.', str ) );
+ }
+ if ( isWellFormed( str ) ) {
+ for ( i = 0; i < str.length; i++ ) {
+ modifiedString += str[i];
+ }
+ return modifiedString;
+ }
+ for ( i = 0; i < str.length; i++ ) {
+ if ( RE_UTF16_LOW_SURROGATE.test( str[ i ] ) || RE_UTF16_HIGH_SURROGATE.test( str[ i ] ) ) {
+ modifiedString += '\uFFFD';
+ }
+ else {
+ modifiedString += str[ i ];
+ }
+ }
+ return modifiedString;
+}
+
+
+// EXPORTS //
+
+module.exports = str2wellformed;
diff --git a/lib/node_modules/@stdlib/string/to-well-formed/package.json b/lib/node_modules/@stdlib/string/to-well-formed/package.json
new file mode 100644
index 000000000000..aa8f97279867
--- /dev/null
+++ b/lib/node_modules/@stdlib/string/to-well-formed/package.json
@@ -0,0 +1,68 @@
+{
+ "name": "@stdlib/string/to-well-formed",
+ "version": "0.0.0",
+ "description": "Convert a string to a well formed string.",
+ "license": "Apache-2.0",
+ "author": {
+ "name": "The Stdlib Authors",
+ "url": "https://github.com/stdlib-js/stdlib/graphs/contributors"
+ },
+ "contributors": [
+ {
+ "name": "The Stdlib Authors",
+ "url": "https://github.com/stdlib-js/stdlib/graphs/contributors"
+ }
+ ],
+ "main": "./lib",
+ "directories": {
+ "benchmark": "./benchmark",
+ "doc": "./docs",
+ "example": "./examples",
+ "lib": "./lib",
+ "test": "./test"
+ },
+ "types": "./docs/types",
+ "scripts": {},
+ "homepage": "https://github.com/stdlib-js/stdlib",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/stdlib-js/stdlib.git"
+ },
+ "bugs": {
+ "url": "https://github.com/stdlib-js/stdlib/issues"
+ },
+ "dependencies": {},
+ "devDependencies": {},
+ "engines": {
+ "node": ">=0.10.0",
+ "npm": ">2.7.0"
+ },
+ "os": [
+ "aix",
+ "darwin",
+ "freebsd",
+ "linux",
+ "macos",
+ "openbsd",
+ "sunos",
+ "win32",
+ "windows"
+ ],
+ "keywords": [
+ "stdlib",
+ "string",
+ "well-formed",
+ "surrogate",
+ "lone-surrogate",
+ "utf-16",
+ "unicode",
+ "replacement",
+ "character",
+ "validation",
+ "sanitization",
+ "conversion",
+ "transform",
+ "utility",
+ "utils"
+ ]
+}
\ No newline at end of file
diff --git a/lib/node_modules/@stdlib/string/to-well-formed/test/test.js b/lib/node_modules/@stdlib/string/to-well-formed/test/test.js
new file mode 100644
index 000000000000..76c914feff27
--- /dev/null
+++ b/lib/node_modules/@stdlib/string/to-well-formed/test/test.js
@@ -0,0 +1,46 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2024 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.
+*/
+
+'use strict';
+
+// MODULES //
+
+var tape = require( 'tape' );
+var str2wellformed = require( './../lib/main.js' );
+
+
+// TESTS //
+
+tape( 'main export is a function', function test( t ) {
+ t.ok( true, __filename );
+ t.strictEqual( typeof str2wellformed, 'function', 'main export is a function' );
+ t.end();
+});
+
+tape( 'the function returns a well-formed string by replacing lone surrogates with Unicode replacement character', function test( t ) {
+ t.equal( str2wellformed(''), '', 'returns an empty string for an empty input' );
+ t.equal( str2wellformed('\uDBFF'), '�', 'replaces lone high surrogate with Unicode replacement character' );
+ t.equal( str2wellformed('\uDBFFFF\uDBFF'), '�FF�', 'replaces multiple lone surrogates with Unicode replacement characters' );
+ t.equal( str2wellformed('Hello \uDBFFWorld'), 'Hello �World', 'replaces lone high surrogate in a string with Unicode replacement character' );
+ t.equal( str2wellformed('\uDBFF'), '�', 'replaces lone high surrogate with Unicode replacement character' );
+ t.equal( str2wellformed('\uDBFFFFF'), '�FFF', 'replaces lone high surrogate with Unicode replacement character' );
+ t.equal( str2wellformed('\uDC00\uDC00'), '��', 'replaces lone low surrogate with Unicode replacement character' );
+ t.equal( str2wellformed('5\uDBFF'), '5�', 'replaces lone high surrogate with Unicode replacement character' );
+
+ t.end();
+});