From 4cab1561f0b59e5888f538322dcf876ed7a9cb00 Mon Sep 17 00:00:00 2001 From: Anudeep Sanapala <71971574+anudeeps0306@users.noreply.github.com> Date: Sat, 2 Mar 2024 11:07:23 +0000 Subject: [PATCH 01/27] feat(string): implement stickycase Implemented the stickycase function. This commit adds the stickycase function to the string module, which converts a string to 'sticky caps' case. BREAKING CHANGE: None --- .../@stdlib/string/base/stickycase/README.md | 101 ++++++++++++++++++ .../base/stickycase/benchmark/benchmark.js | 55 ++++++++++ .../string/base/stickycase/docs/repl.txt | 26 +++++ .../base/stickycase/docs/types/index.d.ts | 48 +++++++++ .../string/base/stickycase/docs/types/test.ts | 50 +++++++++ .../string/base/stickycase/examples/index.js | 46 ++++++++ .../string/base/stickycase/lib/index.js | 49 +++++++++ .../string/base/stickycase/lib/main.js | 76 +++++++++++++ .../string/base/stickycase/package.json | 66 ++++++++++++ .../string/base/stickycase/test/test.js | 79 ++++++++++++++ 10 files changed, 596 insertions(+) create mode 100644 lib/node_modules/@stdlib/string/base/stickycase/README.md create mode 100644 lib/node_modules/@stdlib/string/base/stickycase/benchmark/benchmark.js create mode 100644 lib/node_modules/@stdlib/string/base/stickycase/docs/repl.txt create mode 100644 lib/node_modules/@stdlib/string/base/stickycase/docs/types/index.d.ts create mode 100644 lib/node_modules/@stdlib/string/base/stickycase/docs/types/test.ts create mode 100644 lib/node_modules/@stdlib/string/base/stickycase/examples/index.js create mode 100644 lib/node_modules/@stdlib/string/base/stickycase/lib/index.js create mode 100644 lib/node_modules/@stdlib/string/base/stickycase/lib/main.js create mode 100644 lib/node_modules/@stdlib/string/base/stickycase/package.json create mode 100644 lib/node_modules/@stdlib/string/base/stickycase/test/test.js diff --git a/lib/node_modules/@stdlib/string/base/stickycase/README.md b/lib/node_modules/@stdlib/string/base/stickycase/README.md new file mode 100644 index 000000000000..0e42cc055788 --- /dev/null +++ b/lib/node_modules/@stdlib/string/base/stickycase/README.md @@ -0,0 +1,101 @@ + + +# stickycase + +> Convert a string to sticky case. + + + +
+ +## Usage + +```javascript +var stickycase = require( '@stdlib/string/base/stickycase' ); +``` + +#### constantcase( str, int ) + +Converts a string to sticky case. + +```javascript +var str = 'hello world'; +out = stickycase( 'hello world', 0.5 ); +// returns + +str = 'welcome!'; +out = stickycase( 'welcome!', 0.2 ); +// returns + +str = 'good morning'; +out = stickycase( 'good morning', 0.8 ); +// returns +``` + +
+ + + + + +
+ +## Examples + +```javascript +var stickycase = require( '@stdlib/string/base/stickycase' ); + +var str = 'Bright'; +out = stickycase( 'Bright', 0.8 ); +// returns + +str = 'hello world'; +out = stickycase( 'hello world', 0.5 ); +// returns + +str = 'welcome!'; +out = stickycase( 'welcome!', 0.2 ); +// returns + +str = 'good morning'; +out = stickycase( 'good morning', 0.8 ); +// returns +``` + +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/string/base/stickycase/benchmark/benchmark.js b/lib/node_modules/@stdlib/string/base/stickycase/benchmark/benchmark.js new file mode 100644 index 000000000000..96a5f9e9dc2c --- /dev/null +++ b/lib/node_modules/@stdlib/string/base/stickycase/benchmark/benchmark.js @@ -0,0 +1,55 @@ +/** +* @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. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var isString = require( '@stdlib/assert/is-string' ).isPrimitive; +var pkg = require( '@stdlib/string/base/stickycase/package.json' ).name; +var stickycase = require( '@stdlib/string/base/stickycase/lib' ); + + +// MAIN // + +bench( pkg, function benchmark( b ) { + var values; + var out; + var i; + + values = [ + 'hello world', + 'lorem ipsum dolor sit amet', + 'quick brown fox jumps over the lazy dog' + ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + out = stickycase( values[ i%values.length ] ); + if ( typeof out !== 'string' ) { + b.fail( 'should return a string' ); + } + } + b.toc(); + if ( !isString( out ) ) { + b.fail( 'should return a string' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/string/base/stickycase/docs/repl.txt b/lib/node_modules/@stdlib/string/base/stickycase/docs/repl.txt new file mode 100644 index 000000000000..e9c50ab28e27 --- /dev/null +++ b/lib/node_modules/@stdlib/string/base/stickycase/docs/repl.txt @@ -0,0 +1,26 @@ + +{{alias}}( str ) + Converts a string to sticky case. + + Parameters + ---------- + str: string + Input string. + int : integer + Probability parameter p for Bernoulli distribution. + + Returns + ------- + out: string + Constant-cased string. + + Examples + -------- + > var out = {{alias}}( 'Hello World!' ) + + + > var out = {{alias}}( 'I am a tiny little teapot' ) + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/string/base/stickycase/docs/types/index.d.ts b/lib/node_modules/@stdlib/string/base/stickycase/docs/types/index.d.ts new file mode 100644 index 000000000000..0f035a93f70e --- /dev/null +++ b/lib/node_modules/@stdlib/string/base/stickycase/docs/types/index.d.ts @@ -0,0 +1,48 @@ +/* +* @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. +*/ + +// TypeScript Version: 4.1 + +/** + * Converts a string to "sticky caps" case. + * + * @param str - input string + * @param p - probability of capitalization (between 0 and 1) + * @returns sticky case string + * + * @example + * var str = stickycase( 'hello world' ); + * // returns + * + * @example + * var str = stickycase( 'hello world', 0.2 ); + * // returns + * + * @example + * var str = stickycase( 'hello world', 0.8 ); + * // returns + * + * @example + * var str = stickycase( 'hello world', '0.5' ); + * // throws TypeError + */ +declare function stickycase( str: string, p?: number ): string; + +// EXPORTS // + +export = stickycase; diff --git a/lib/node_modules/@stdlib/string/base/stickycase/docs/types/test.ts b/lib/node_modules/@stdlib/string/base/stickycase/docs/types/test.ts new file mode 100644 index 000000000000..50d3341281f7 --- /dev/null +++ b/lib/node_modules/@stdlib/string/base/stickycase/docs/types/test.ts @@ -0,0 +1,50 @@ +/* +* @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. +*/ + +import stickycase from './index'; + +// TESTS // + +// The function returns a string... +{ + stickycase( 'hello world' ); // $ExpectType any +} + +// The compiler throws an error if the function is provided a value other than a string... +{ + // eslint-disable-next-line expect-type/expect + stickycase( true ); // $ExpectError + // eslint-disable-next-line expect-type/expect + stickycase( false ); // $ExpectError + // eslint-disable-next-line expect-type/expect + stickycase( undefined ); // $ExpectError + // eslint-disable-next-line expect-type/expect + stickycase( 5 ); // $ExpectError + // eslint-disable-next-line expect-type/expect + stickycase( [] ); // $ExpectError + // eslint-disable-next-line expect-type/expect + stickycase( {} ); // $ExpectError + // eslint-disable-next-line expect-type/expect + stickycase( ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the function is provided insufficient arguments... +{ + // eslint-disable-next-line expect-type/expect + stickycase(); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/string/base/stickycase/examples/index.js b/lib/node_modules/@stdlib/string/base/stickycase/examples/index.js new file mode 100644 index 000000000000..4363139848fd --- /dev/null +++ b/lib/node_modules/@stdlib/string/base/stickycase/examples/index.js @@ -0,0 +1,46 @@ +/** +* @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. +*/ + +'use strict'; + +var stickycase = require( './../lib' ); + +var str = 'Hello World!'; +var out = stickycase(str); +console.log(typeof out === 'string'); +// => true + +str = 'I am a tiny little teapot'; +out = stickycase(str); +console.log(typeof out === 'string'); +// => true + +str = 'with big problems'; +out = stickycase(str); +console.log(typeof out === 'string'); +// => true + +str = 'To be, or not to be: that is the question.'; +out = stickycase(str); +console.log(typeof out === 'string'); +// => true + +str = 'isMobile'; +out = stickycase(str); +console.log(typeof out === 'string'); +// => true diff --git a/lib/node_modules/@stdlib/string/base/stickycase/lib/index.js b/lib/node_modules/@stdlib/string/base/stickycase/lib/index.js new file mode 100644 index 000000000000..8d72f81f5aaa --- /dev/null +++ b/lib/node_modules/@stdlib/string/base/stickycase/lib/index.js @@ -0,0 +1,49 @@ +/** +* @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. +*/ + +'use strict'; + +/** +* Convert a string to stickycase case. +* +* @module @stdlib/string/base/stickycase +* +* @example +* var stickycase = require( '@stdlib/string/base/stickycase' ); +* var str = stickycase( 'hello world' ); +* // returns +* +* @example +* var stickycase = require( '@stdlib/string/base/stickycase' ); +* var str = stickycase( 'hello world', 0.2 ); +* // returns +* +* @example +* var stickycase = require( '@stdlib/string/base/stickycase' ); +* var str = stickycase( 'hello world', 0.8 ); +* // returns +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/string/base/stickycase/lib/main.js b/lib/node_modules/@stdlib/string/base/stickycase/lib/main.js new file mode 100644 index 000000000000..0733741496d6 --- /dev/null +++ b/lib/node_modules/@stdlib/string/base/stickycase/lib/main.js @@ -0,0 +1,76 @@ +/** +* @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. +*/ + +'use strict'; + +// MODULES // + +var bernoulli = require( '@stdlib/random/base/bernoulli' ); + + +// MAIN // + +/** +* Converts a string to "sticky caps" case. +* +* @param {string} str - input string +* @param {number} [p=0.5] - probability of capitalization (between 0 and 1) +* @throws {TypeError} input must be a string +* @returns {string} converted string +* +* @example +* var str = stickycase( 'hello world' ); +* // returns +* +* @example +* var str = stickycase( 'hello world', 0.2 ); +* // returns +* +* @example +* var str = stickycase( 'hello world', 0.8 ); +* // returns +* +* @example +* var str = stickycase( 'hello world', '0.5' ); +* // returns +*/ +function stickycase( str, p ) { + var result = ''; + var char; + var i; + if ( typeof str !== 'string' ) { + throw new TypeError( 'You need to input a String' ); + } + p = ( typeof p === 'number' && p >= 0 && p <= 1 ) ? p : 0.5; + + for ( i = 0; i < str.length; i++ ) { + char = str.charAt( i ); + if ( bernoulli( p ) ) { + char = char.toUpperCase(); + } else { + char = char.toLowerCase(); + } + result += char; + } + return result; +} + + +// EXPORTS // + +module.exports = stickycase; diff --git a/lib/node_modules/@stdlib/string/base/stickycase/package.json b/lib/node_modules/@stdlib/string/base/stickycase/package.json new file mode 100644 index 000000000000..260a26d0676c --- /dev/null +++ b/lib/node_modules/@stdlib/string/base/stickycase/package.json @@ -0,0 +1,66 @@ +{ + "name": "@stdlib/string/base/stickycase", + "version": "0.0.0", + "description": "Convert a string to sticky case. converting a string to sticky caps case ", + "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", + "stdstring", + "utilities", + "utility", + "utils", + "util", + "base", + "string", + "str", + "case", + "constant", + "convert" + ], + "__stdlib__": {} +} \ No newline at end of file diff --git a/lib/node_modules/@stdlib/string/base/stickycase/test/test.js b/lib/node_modules/@stdlib/string/base/stickycase/test/test.js new file mode 100644 index 000000000000..f5c601f09dc6 --- /dev/null +++ b/lib/node_modules/@stdlib/string/base/stickycase/test/test.js @@ -0,0 +1,79 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2021 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 stickycase = require( '@stdlib/string/base/stickycase/lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof stickycase, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function throws an error if not provided a string', function test( t ) { + var values; + var i; + + values = [ + 5, + NaN, + true, + false, + null, + void 0, + [], + {}, + function noop() {} + ]; + + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[i] ), TypeError, 'throws a type error when provided '+values[i] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + stickycase( value ); + }; + } +}); + +tape('the function converts a string to sticky caps case', function test(t) { + var actual; + + // Test with default probability (p=0.5) + actual = stickycase('hello world'); + t.equal(typeof actual, 'string', 'returns a string'); + + // Test with lower probability (p=0.2) + actual = stickycase('hello world', 0.2); + t.equal(typeof actual, 'string', 'returns a string'); + + // Test with higher probability (p=0.8) + actual = stickycase('hello world', 0.8); + t.equal(typeof actual, 'string', 'returns a string'); + + t.end(); +}); From 37e746e776d474362e8e56129acd231ba093aefa Mon Sep 17 00:00:00 2001 From: Anudeep Sanapala <71971574+anudeeps0306@users.noreply.github.com> Date: Sat, 2 Mar 2024 11:18:21 +0000 Subject: [PATCH 02/27] fix: correct JavaScript example in README.md Corrected the JavaScript example in the README.md file to define the 'out' variable before assignment, preventing an 'out is not defined' error. Now the example runs correctly. No breaking changes introduced. --- lib/node_modules/@stdlib/string/base/stickycase/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/string/base/stickycase/README.md b/lib/node_modules/@stdlib/string/base/stickycase/README.md index 0e42cc055788..96c543b68401 100644 --- a/lib/node_modules/@stdlib/string/base/stickycase/README.md +++ b/lib/node_modules/@stdlib/string/base/stickycase/README.md @@ -38,7 +38,7 @@ Converts a string to sticky case. ```javascript var str = 'hello world'; -out = stickycase( 'hello world', 0.5 ); +var out = stickycase( 'hello world', 0.5 ); // returns str = 'welcome!'; @@ -64,7 +64,7 @@ out = stickycase( 'good morning', 0.8 ); var stickycase = require( '@stdlib/string/base/stickycase' ); var str = 'Bright'; -out = stickycase( 'Bright', 0.8 ); +var out = stickycase( 'Bright', 0.8 ); // returns str = 'hello world'; From b8e84a7ddaa69c3835a6072c00de16fe81caa4b2 Mon Sep 17 00:00:00 2001 From: stdlib-bot <82920195+stdlib-bot@users.noreply.github.com> Date: Sat, 2 Mar 2024 20:28:51 +0000 Subject: [PATCH 03/27] chore: update copyright years --- lib/node_modules/@stdlib/string/base/stickycase/README.md | 2 +- .../@stdlib/string/base/stickycase/benchmark/benchmark.js | 2 +- .../@stdlib/string/base/stickycase/docs/types/index.d.ts | 2 +- .../@stdlib/string/base/stickycase/docs/types/test.ts | 2 +- .../@stdlib/string/base/stickycase/examples/index.js | 2 +- lib/node_modules/@stdlib/string/base/stickycase/lib/index.js | 2 +- lib/node_modules/@stdlib/string/base/stickycase/lib/main.js | 2 +- lib/node_modules/@stdlib/string/base/stickycase/test/test.js | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/node_modules/@stdlib/string/base/stickycase/README.md b/lib/node_modules/@stdlib/string/base/stickycase/README.md index 96c543b68401..bc9d338b96f0 100644 --- a/lib/node_modules/@stdlib/string/base/stickycase/README.md +++ b/lib/node_modules/@stdlib/string/base/stickycase/README.md @@ -2,7 +2,7 @@ @license Apache-2.0 -Copyright (c) 2022 The Stdlib Authors. +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. diff --git a/lib/node_modules/@stdlib/string/base/stickycase/benchmark/benchmark.js b/lib/node_modules/@stdlib/string/base/stickycase/benchmark/benchmark.js index 96a5f9e9dc2c..ffeedd9ef872 100644 --- a/lib/node_modules/@stdlib/string/base/stickycase/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/string/base/stickycase/benchmark/benchmark.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2022 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/string/base/stickycase/docs/types/index.d.ts b/lib/node_modules/@stdlib/string/base/stickycase/docs/types/index.d.ts index 0f035a93f70e..349287af0820 100644 --- a/lib/node_modules/@stdlib/string/base/stickycase/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/string/base/stickycase/docs/types/index.d.ts @@ -1,7 +1,7 @@ /* * @license Apache-2.0 * -* Copyright (c) 2022 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/string/base/stickycase/docs/types/test.ts b/lib/node_modules/@stdlib/string/base/stickycase/docs/types/test.ts index 50d3341281f7..a5939517db2f 100644 --- a/lib/node_modules/@stdlib/string/base/stickycase/docs/types/test.ts +++ b/lib/node_modules/@stdlib/string/base/stickycase/docs/types/test.ts @@ -1,7 +1,7 @@ /* * @license Apache-2.0 * -* Copyright (c) 2022 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/string/base/stickycase/examples/index.js b/lib/node_modules/@stdlib/string/base/stickycase/examples/index.js index 4363139848fd..4c327fddff2e 100644 --- a/lib/node_modules/@stdlib/string/base/stickycase/examples/index.js +++ b/lib/node_modules/@stdlib/string/base/stickycase/examples/index.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2022 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/string/base/stickycase/lib/index.js b/lib/node_modules/@stdlib/string/base/stickycase/lib/index.js index 8d72f81f5aaa..742a1d6a8516 100644 --- a/lib/node_modules/@stdlib/string/base/stickycase/lib/index.js +++ b/lib/node_modules/@stdlib/string/base/stickycase/lib/index.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2022 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/string/base/stickycase/lib/main.js b/lib/node_modules/@stdlib/string/base/stickycase/lib/main.js index 0733741496d6..60b1885a3592 100644 --- a/lib/node_modules/@stdlib/string/base/stickycase/lib/main.js +++ b/lib/node_modules/@stdlib/string/base/stickycase/lib/main.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2022 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/string/base/stickycase/test/test.js b/lib/node_modules/@stdlib/string/base/stickycase/test/test.js index f5c601f09dc6..75c2e35a5e71 100644 --- a/lib/node_modules/@stdlib/string/base/stickycase/test/test.js +++ b/lib/node_modules/@stdlib/string/base/stickycase/test/test.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2021 The Stdlib Authors. +* 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. From c2ed8716704c2b6ef5b45972c8e0bf5ec14153b7 Mon Sep 17 00:00:00 2001 From: Anudeep Sanapala <71971574+anudeeps0306@users.noreply.github.com> Date: Mon, 4 Mar 2024 09:14:34 +0530 Subject: [PATCH 04/27] Update lib/node_modules/@stdlib/string/base/stickycase/README.md Co-authored-by: Philipp Burckhardt Signed-off-by: Anudeep Sanapala <71971574+anudeeps0306@users.noreply.github.com> --- lib/node_modules/@stdlib/string/base/stickycase/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/string/base/stickycase/README.md b/lib/node_modules/@stdlib/string/base/stickycase/README.md index bc9d338b96f0..3697f1df4f5a 100644 --- a/lib/node_modules/@stdlib/string/base/stickycase/README.md +++ b/lib/node_modules/@stdlib/string/base/stickycase/README.md @@ -32,7 +32,7 @@ limitations under the License. var stickycase = require( '@stdlib/string/base/stickycase' ); ``` -#### constantcase( str, int ) +#### stickycase( str\[, p] ) Converts a string to sticky case. From a1c0dfb7dc96d42156d741b4ddf0c5a4a40b503f Mon Sep 17 00:00:00 2001 From: Anudeep Sanapala <71971574+anudeeps0306@users.noreply.github.com> Date: Mon, 4 Mar 2024 09:15:02 +0530 Subject: [PATCH 05/27] Update lib/node_modules/@stdlib/string/base/stickycase/README.md Co-authored-by: Philipp Burckhardt Signed-off-by: Anudeep Sanapala <71971574+anudeeps0306@users.noreply.github.com> --- lib/node_modules/@stdlib/string/base/stickycase/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/string/base/stickycase/README.md b/lib/node_modules/@stdlib/string/base/stickycase/README.md index 3697f1df4f5a..01c85eff3b6c 100644 --- a/lib/node_modules/@stdlib/string/base/stickycase/README.md +++ b/lib/node_modules/@stdlib/string/base/stickycase/README.md @@ -38,7 +38,7 @@ Converts a string to sticky case. ```javascript var str = 'hello world'; -var out = stickycase( 'hello world', 0.5 ); +var out = stickycase( 'hello world' ); // returns str = 'welcome!'; From d9aad63de3aab09e2b8fef6bc9ac36bc6c2761df Mon Sep 17 00:00:00 2001 From: Anudeep Sanapala <71971574+anudeeps0306@users.noreply.github.com> Date: Mon, 4 Mar 2024 09:17:50 +0530 Subject: [PATCH 06/27] Update lib/node_modules/@stdlib/string/base/stickycase/docs/repl.txt Co-authored-by: Philipp Burckhardt Signed-off-by: Anudeep Sanapala <71971574+anudeeps0306@users.noreply.github.com> --- .../@stdlib/string/base/stickycase/docs/repl.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/string/base/stickycase/docs/repl.txt b/lib/node_modules/@stdlib/string/base/stickycase/docs/repl.txt index e9c50ab28e27..4b2b98493c6d 100644 --- a/lib/node_modules/@stdlib/string/base/stickycase/docs/repl.txt +++ b/lib/node_modules/@stdlib/string/base/stickycase/docs/repl.txt @@ -6,8 +6,9 @@ ---------- str: string Input string. - int : integer - Probability parameter p for Bernoulli distribution. + + p: number + Probability of capitalization. Returns ------- From 74de9026bcadaae8e4e39618061e983080d315f1 Mon Sep 17 00:00:00 2001 From: Anudeep Sanapala <71971574+anudeeps0306@users.noreply.github.com> Date: Mon, 4 Mar 2024 09:18:09 +0530 Subject: [PATCH 07/27] Update lib/node_modules/@stdlib/string/base/stickycase/docs/repl.txt Co-authored-by: Philipp Burckhardt Signed-off-by: Anudeep Sanapala <71971574+anudeeps0306@users.noreply.github.com> --- lib/node_modules/@stdlib/string/base/stickycase/docs/repl.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/string/base/stickycase/docs/repl.txt b/lib/node_modules/@stdlib/string/base/stickycase/docs/repl.txt index 4b2b98493c6d..2e7fcf617463 100644 --- a/lib/node_modules/@stdlib/string/base/stickycase/docs/repl.txt +++ b/lib/node_modules/@stdlib/string/base/stickycase/docs/repl.txt @@ -1,5 +1,5 @@ -{{alias}}( str ) +{{alias}}( str[, p] ) Converts a string to sticky case. Parameters From 8b40e50f9fffbba2892644ff2d6bc564b4015010 Mon Sep 17 00:00:00 2001 From: Anudeep Sanapala <71971574+anudeeps0306@users.noreply.github.com> Date: Mon, 4 Mar 2024 09:18:20 +0530 Subject: [PATCH 08/27] Update lib/node_modules/@stdlib/string/base/stickycase/docs/repl.txt Co-authored-by: Philipp Burckhardt Signed-off-by: Anudeep Sanapala <71971574+anudeeps0306@users.noreply.github.com> --- lib/node_modules/@stdlib/string/base/stickycase/docs/repl.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/string/base/stickycase/docs/repl.txt b/lib/node_modules/@stdlib/string/base/stickycase/docs/repl.txt index 2e7fcf617463..7fa386e462a0 100644 --- a/lib/node_modules/@stdlib/string/base/stickycase/docs/repl.txt +++ b/lib/node_modules/@stdlib/string/base/stickycase/docs/repl.txt @@ -13,7 +13,7 @@ Returns ------- out: string - Constant-cased string. + Sticky-cased string. Examples -------- From 8b21dc2e055951ed57d9ca5d0bf7a0d863e8cd6a Mon Sep 17 00:00:00 2001 From: Anudeep Sanapala <71971574+anudeeps0306@users.noreply.github.com> Date: Mon, 4 Mar 2024 09:18:33 +0530 Subject: [PATCH 09/27] Update lib/node_modules/@stdlib/string/base/stickycase/docs/repl.txt Co-authored-by: Philipp Burckhardt Signed-off-by: Anudeep Sanapala <71971574+anudeeps0306@users.noreply.github.com> --- .../@stdlib/string/base/stickycase/docs/repl.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/node_modules/@stdlib/string/base/stickycase/docs/repl.txt b/lib/node_modules/@stdlib/string/base/stickycase/docs/repl.txt index 7fa386e462a0..285e7d40b8e0 100644 --- a/lib/node_modules/@stdlib/string/base/stickycase/docs/repl.txt +++ b/lib/node_modules/@stdlib/string/base/stickycase/docs/repl.txt @@ -18,10 +18,10 @@ Examples -------- > var out = {{alias}}( 'Hello World!' ) + - - > var out = {{alias}}( 'I am a tiny little teapot' ) - + > out = {{alias}}( 'I am a tiny little teapot' ) + See Also -------- From ae888a0c61b0da97e31a4991acfc22ae6fe2ea4d Mon Sep 17 00:00:00 2001 From: Anudeep Sanapala <71971574+anudeeps0306@users.noreply.github.com> Date: Mon, 4 Mar 2024 09:18:58 +0530 Subject: [PATCH 10/27] Update lib/node_modules/@stdlib/string/base/stickycase/docs/types/index.d.ts Co-authored-by: Philipp Burckhardt Signed-off-by: Anudeep Sanapala <71971574+anudeeps0306@users.noreply.github.com> --- .../@stdlib/string/base/stickycase/docs/types/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/node_modules/@stdlib/string/base/stickycase/docs/types/index.d.ts b/lib/node_modules/@stdlib/string/base/stickycase/docs/types/index.d.ts index 349287af0820..90a7d2ea0397 100644 --- a/lib/node_modules/@stdlib/string/base/stickycase/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/string/base/stickycase/docs/types/index.d.ts @@ -43,6 +43,7 @@ */ declare function stickycase( str: string, p?: number ): string; + // EXPORTS // export = stickycase; From 379a18633f586b79c6cda44df6fd3e625c06f40c Mon Sep 17 00:00:00 2001 From: Anudeep Sanapala <71971574+anudeeps0306@users.noreply.github.com> Date: Mon, 4 Mar 2024 09:19:17 +0530 Subject: [PATCH 11/27] Update lib/node_modules/@stdlib/string/base/stickycase/docs/types/test.ts Co-authored-by: Philipp Burckhardt Signed-off-by: Anudeep Sanapala <71971574+anudeeps0306@users.noreply.github.com> --- .../@stdlib/string/base/stickycase/docs/types/test.ts | 7 ------- 1 file changed, 7 deletions(-) diff --git a/lib/node_modules/@stdlib/string/base/stickycase/docs/types/test.ts b/lib/node_modules/@stdlib/string/base/stickycase/docs/types/test.ts index a5939517db2f..3bb477ce937a 100644 --- a/lib/node_modules/@stdlib/string/base/stickycase/docs/types/test.ts +++ b/lib/node_modules/@stdlib/string/base/stickycase/docs/types/test.ts @@ -27,19 +27,12 @@ import stickycase from './index'; // The compiler throws an error if the function is provided a value other than a string... { - // eslint-disable-next-line expect-type/expect stickycase( true ); // $ExpectError - // eslint-disable-next-line expect-type/expect stickycase( false ); // $ExpectError - // eslint-disable-next-line expect-type/expect stickycase( undefined ); // $ExpectError - // eslint-disable-next-line expect-type/expect stickycase( 5 ); // $ExpectError - // eslint-disable-next-line expect-type/expect stickycase( [] ); // $ExpectError - // eslint-disable-next-line expect-type/expect stickycase( {} ); // $ExpectError - // eslint-disable-next-line expect-type/expect stickycase( ( x: number ): number => x ); // $ExpectError } From 0583e0074fe35b0c492daa949012ad7a9ca9e091 Mon Sep 17 00:00:00 2001 From: Anudeep Sanapala <71971574+anudeeps0306@users.noreply.github.com> Date: Mon, 4 Mar 2024 09:19:27 +0530 Subject: [PATCH 12/27] Update lib/node_modules/@stdlib/string/base/stickycase/test/test.js Co-authored-by: Philipp Burckhardt Signed-off-by: Anudeep Sanapala <71971574+anudeeps0306@users.noreply.github.com> --- .../@stdlib/string/base/stickycase/test/test.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/node_modules/@stdlib/string/base/stickycase/test/test.js b/lib/node_modules/@stdlib/string/base/stickycase/test/test.js index 75c2e35a5e71..255b96f3ade9 100644 --- a/lib/node_modules/@stdlib/string/base/stickycase/test/test.js +++ b/lib/node_modules/@stdlib/string/base/stickycase/test/test.js @@ -64,16 +64,16 @@ tape('the function converts a string to sticky caps case', function test(t) { var actual; // Test with default probability (p=0.5) - actual = stickycase('hello world'); - t.equal(typeof actual, 'string', 'returns a string'); + actual = stickycase( 'hello world' ); + t.strictEqual( typeof actual, 'string', 'returns a string' ); - // Test with lower probability (p=0.2) - actual = stickycase('hello world', 0.2); - t.equal(typeof actual, 'string', 'returns a string'); + // Test with lower probability (p=0.2): + actual = stickycase( 'hello world', 0.2 ); + t.strictEqual( typeof actual, 'string', 'returns a string' ); - // Test with higher probability (p=0.8) - actual = stickycase('hello world', 0.8); - t.equal(typeof actual, 'string', 'returns a string'); + // Test with higher probability (p=0.8): + actual = stickycase( 'hello world', 0.8 ); + t.strictEqual( typeof actual, 'string', 'returns a string' ); t.end(); }); From d92a91eddd61019fab0c258bb7315e08ee1878bc Mon Sep 17 00:00:00 2001 From: Anudeep Sanapala <71971574+anudeeps0306@users.noreply.github.com> Date: Mon, 4 Mar 2024 09:19:44 +0530 Subject: [PATCH 13/27] Update lib/node_modules/@stdlib/string/base/stickycase/lib/main.js Co-authored-by: Philipp Burckhardt Signed-off-by: Anudeep Sanapala <71971574+anudeeps0306@users.noreply.github.com> --- lib/node_modules/@stdlib/string/base/stickycase/lib/main.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/lib/node_modules/@stdlib/string/base/stickycase/lib/main.js b/lib/node_modules/@stdlib/string/base/stickycase/lib/main.js index 60b1885a3592..41d78d32cfae 100644 --- a/lib/node_modules/@stdlib/string/base/stickycase/lib/main.js +++ b/lib/node_modules/@stdlib/string/base/stickycase/lib/main.js @@ -53,9 +53,6 @@ function stickycase( str, p ) { var result = ''; var char; var i; - if ( typeof str !== 'string' ) { - throw new TypeError( 'You need to input a String' ); - } p = ( typeof p === 'number' && p >= 0 && p <= 1 ) ? p : 0.5; for ( i = 0; i < str.length; i++ ) { From 842f85ce4701b32649630e8dd3660db81353c271 Mon Sep 17 00:00:00 2001 From: Anudeep Sanapala <71971574+anudeeps0306@users.noreply.github.com> Date: Mon, 4 Mar 2024 09:19:57 +0530 Subject: [PATCH 14/27] Update lib/node_modules/@stdlib/string/base/stickycase/lib/main.js Co-authored-by: Philipp Burckhardt Signed-off-by: Anudeep Sanapala <71971574+anudeeps0306@users.noreply.github.com> --- lib/node_modules/@stdlib/string/base/stickycase/lib/main.js | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/node_modules/@stdlib/string/base/stickycase/lib/main.js b/lib/node_modules/@stdlib/string/base/stickycase/lib/main.js index 41d78d32cfae..fe5c0483fbff 100644 --- a/lib/node_modules/@stdlib/string/base/stickycase/lib/main.js +++ b/lib/node_modules/@stdlib/string/base/stickycase/lib/main.js @@ -30,7 +30,6 @@ var bernoulli = require( '@stdlib/random/base/bernoulli' ); * * @param {string} str - input string * @param {number} [p=0.5] - probability of capitalization (between 0 and 1) -* @throws {TypeError} input must be a string * @returns {string} converted string * * @example From 98ffb4326c5f30db6abd50af3a95e2014eb7ddf6 Mon Sep 17 00:00:00 2001 From: Anudeep Sanapala <71971574+anudeeps0306@users.noreply.github.com> Date: Mon, 4 Mar 2024 09:20:09 +0530 Subject: [PATCH 15/27] Update lib/node_modules/@stdlib/string/base/stickycase/docs/types/index.d.ts Co-authored-by: Philipp Burckhardt Signed-off-by: Anudeep Sanapala <71971574+anudeeps0306@users.noreply.github.com> --- .../@stdlib/string/base/stickycase/docs/types/index.d.ts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lib/node_modules/@stdlib/string/base/stickycase/docs/types/index.d.ts b/lib/node_modules/@stdlib/string/base/stickycase/docs/types/index.d.ts index 90a7d2ea0397..97fbf9f0f750 100644 --- a/lib/node_modules/@stdlib/string/base/stickycase/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/string/base/stickycase/docs/types/index.d.ts @@ -36,10 +36,6 @@ * @example * var str = stickycase( 'hello world', 0.8 ); * // returns - * - * @example - * var str = stickycase( 'hello world', '0.5' ); - * // throws TypeError */ declare function stickycase( str: string, p?: number ): string; From 7d61c0d645168058d4d536f32e9e280fb52dc655 Mon Sep 17 00:00:00 2001 From: Anudeep Sanapala <71971574+anudeeps0306@users.noreply.github.com> Date: Mon, 4 Mar 2024 09:20:36 +0530 Subject: [PATCH 16/27] Update lib/node_modules/@stdlib/string/base/stickycase/docs/types/index.d.ts Co-authored-by: Philipp Burckhardt Signed-off-by: Anudeep Sanapala <71971574+anudeeps0306@users.noreply.github.com> --- .../@stdlib/string/base/stickycase/docs/types/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/string/base/stickycase/docs/types/index.d.ts b/lib/node_modules/@stdlib/string/base/stickycase/docs/types/index.d.ts index 97fbf9f0f750..dbba044b3f34 100644 --- a/lib/node_modules/@stdlib/string/base/stickycase/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/string/base/stickycase/docs/types/index.d.ts @@ -22,7 +22,7 @@ * Converts a string to "sticky caps" case. * * @param str - input string - * @param p - probability of capitalization (between 0 and 1) + * @param p - probability of capitalization (default: 0.5) * @returns sticky case string * * @example From 5410b1888ba5d0c8999b643e8a660af97365a69f Mon Sep 17 00:00:00 2001 From: Anudeep Sanapala <71971574+anudeeps0306@users.noreply.github.com> Date: Mon, 4 Mar 2024 09:24:36 +0530 Subject: [PATCH 17/27] Update lib/node_modules/@stdlib/string/base/stickycase/docs/types/test.ts Co-authored-by: Philipp Burckhardt Signed-off-by: Anudeep Sanapala <71971574+anudeeps0306@users.noreply.github.com> --- .../@stdlib/string/base/stickycase/docs/types/test.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/string/base/stickycase/docs/types/test.ts b/lib/node_modules/@stdlib/string/base/stickycase/docs/types/test.ts index 3bb477ce937a..1d2ea1df49ff 100644 --- a/lib/node_modules/@stdlib/string/base/stickycase/docs/types/test.ts +++ b/lib/node_modules/@stdlib/string/base/stickycase/docs/types/test.ts @@ -22,7 +22,8 @@ import stickycase from './index'; // The function returns a string... { - stickycase( 'hello world' ); // $ExpectType any + stickycase( 'hello world' ); // $ExpectType string + stickycase( 'hello world', 0.3 ); // $ExpectType string } // The compiler throws an error if the function is provided a value other than a string... From 03449544a22051ff397a24582eae1bc65d1ed66a Mon Sep 17 00:00:00 2001 From: Anudeep Sanapala <71971574+anudeeps0306@users.noreply.github.com> Date: Mon, 4 Mar 2024 09:24:53 +0530 Subject: [PATCH 18/27] Update lib/node_modules/@stdlib/string/base/stickycase/examples/index.js Co-authored-by: Philipp Burckhardt Signed-off-by: Anudeep Sanapala <71971574+anudeeps0306@users.noreply.github.com> --- .../string/base/stickycase/examples/index.js | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/lib/node_modules/@stdlib/string/base/stickycase/examples/index.js b/lib/node_modules/@stdlib/string/base/stickycase/examples/index.js index 4c327fddff2e..2feff8be1e04 100644 --- a/lib/node_modules/@stdlib/string/base/stickycase/examples/index.js +++ b/lib/node_modules/@stdlib/string/base/stickycase/examples/index.js @@ -21,26 +21,26 @@ var stickycase = require( './../lib' ); var str = 'Hello World!'; -var out = stickycase(str); -console.log(typeof out === 'string'); -// => true +var out = stickycase( str ); +console.log( out ); +// => str = 'I am a tiny little teapot'; -out = stickycase(str); -console.log(typeof out === 'string'); -// => true +out = stickycase( str ); +console.log( out ); +// => str = 'with big problems'; -out = stickycase(str); -console.log(typeof out === 'string'); -// => true +out = stickycase( str, 0.1 ); +console.log( out ); +// => str = 'To be, or not to be: that is the question.'; -out = stickycase(str); -console.log(typeof out === 'string'); -// => true +out = stickycase( str, 0.9 ); +console.log( out ); +// => str = 'isMobile'; -out = stickycase(str); -console.log(typeof out === 'string'); -// => true +out = stickycase( str, 0.5 ); +console.log( out ); +// => From d2f97c520b8a855cd6017711da4847a95ddb07ba Mon Sep 17 00:00:00 2001 From: Anudeep Sanapala <71971574+anudeeps0306@users.noreply.github.com> Date: Mon, 4 Mar 2024 09:25:14 +0530 Subject: [PATCH 19/27] Update lib/node_modules/@stdlib/string/base/stickycase/README.md Co-authored-by: Philipp Burckhardt Signed-off-by: Anudeep Sanapala <71971574+anudeeps0306@users.noreply.github.com> --- .../@stdlib/string/base/stickycase/README.md | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/lib/node_modules/@stdlib/string/base/stickycase/README.md b/lib/node_modules/@stdlib/string/base/stickycase/README.md index 01c85eff3b6c..599d08310538 100644 --- a/lib/node_modules/@stdlib/string/base/stickycase/README.md +++ b/lib/node_modules/@stdlib/string/base/stickycase/README.md @@ -63,20 +63,23 @@ out = stickycase( 'good morning', 0.8 ); ```javascript var stickycase = require( '@stdlib/string/base/stickycase' ); -var str = 'Bright'; -var out = stickycase( 'Bright', 0.8 ); +var out = stickycase( str ); // returns -str = 'hello world'; -out = stickycase( 'hello world', 0.5 ); +str = 'I am a tiny little teapot'; +out = stickycase( str ); // returns -str = 'welcome!'; -out = stickycase( 'welcome!', 0.2 ); +str = 'with big problems'; +out = stickycase( str, 0.1 ); // returns -str = 'good morning'; -out = stickycase( 'good morning', 0.8 ); +str = 'To be, or not to be: that is the question.'; +out = stickycase( str, 0.9 ); +// returns + +str = 'isMobile'; +out = stickycase( str ); // returns ``` From d820594a8d50cd7ccc5dc0aaf214fea3407f13b9 Mon Sep 17 00:00:00 2001 From: Anudeep Sanapala <71971574+anudeeps0306@users.noreply.github.com> Date: Mon, 4 Mar 2024 09:25:27 +0530 Subject: [PATCH 20/27] Update lib/node_modules/@stdlib/string/base/stickycase/lib/index.js Co-authored-by: Philipp Burckhardt Signed-off-by: Anudeep Sanapala <71971574+anudeeps0306@users.noreply.github.com> --- lib/node_modules/@stdlib/string/base/stickycase/lib/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/string/base/stickycase/lib/index.js b/lib/node_modules/@stdlib/string/base/stickycase/lib/index.js index 742a1d6a8516..e387ae723b89 100644 --- a/lib/node_modules/@stdlib/string/base/stickycase/lib/index.js +++ b/lib/node_modules/@stdlib/string/base/stickycase/lib/index.js @@ -19,7 +19,7 @@ 'use strict'; /** -* Convert a string to stickycase case. +* Convert a string to "sticky caps" case. * * @module @stdlib/string/base/stickycase * From 24bcb873522ca612442ce07fe4c5081241ee68f4 Mon Sep 17 00:00:00 2001 From: Anudeep Sanapala <71971574+anudeeps0306@users.noreply.github.com> Date: Mon, 4 Mar 2024 09:25:40 +0530 Subject: [PATCH 21/27] Update lib/node_modules/@stdlib/string/base/stickycase/package.json Co-authored-by: Philipp Burckhardt Signed-off-by: Anudeep Sanapala <71971574+anudeeps0306@users.noreply.github.com> --- lib/node_modules/@stdlib/string/base/stickycase/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/string/base/stickycase/package.json b/lib/node_modules/@stdlib/string/base/stickycase/package.json index 260a26d0676c..7a4b744ce94a 100644 --- a/lib/node_modules/@stdlib/string/base/stickycase/package.json +++ b/lib/node_modules/@stdlib/string/base/stickycase/package.json @@ -1,7 +1,7 @@ { "name": "@stdlib/string/base/stickycase", "version": "0.0.0", - "description": "Convert a string to sticky case. converting a string to sticky caps case ", + "description": "Convert a string to sticky case.", "license": "Apache-2.0", "author": { "name": "The Stdlib Authors", From 0437efb304bf9a482eaae2a28c98185226768156 Mon Sep 17 00:00:00 2001 From: Anudeep Sanapala <71971574+anudeeps0306@users.noreply.github.com> Date: Mon, 4 Mar 2024 09:25:54 +0530 Subject: [PATCH 22/27] Update lib/node_modules/@stdlib/string/base/stickycase/package.json Co-authored-by: Philipp Burckhardt Signed-off-by: Anudeep Sanapala <71971574+anudeeps0306@users.noreply.github.com> --- lib/node_modules/@stdlib/string/base/stickycase/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/string/base/stickycase/package.json b/lib/node_modules/@stdlib/string/base/stickycase/package.json index 7a4b744ce94a..0f50a57d8c14 100644 --- a/lib/node_modules/@stdlib/string/base/stickycase/package.json +++ b/lib/node_modules/@stdlib/string/base/stickycase/package.json @@ -59,7 +59,7 @@ "string", "str", "case", - "constant", + "sticky", "convert" ], "__stdlib__": {} From 03b65c421cbf54fbeedc7e955d9a41e4a1a34223 Mon Sep 17 00:00:00 2001 From: Anudeep Sanapala <71971574+anudeeps0306@users.noreply.github.com> Date: Mon, 4 Mar 2024 09:30:14 +0530 Subject: [PATCH 23/27] Update test.ts Refactor test cases and add additional parameter validation Signed-off-by: Anudeep Sanapala <71971574+anudeeps0306@users.noreply.github.com> --- .../string/base/stickycase/docs/types/test.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/string/base/stickycase/docs/types/test.ts b/lib/node_modules/@stdlib/string/base/stickycase/docs/types/test.ts index 1d2ea1df49ff..1170791a0ca1 100644 --- a/lib/node_modules/@stdlib/string/base/stickycase/docs/types/test.ts +++ b/lib/node_modules/@stdlib/string/base/stickycase/docs/types/test.ts @@ -37,8 +37,18 @@ import stickycase from './index'; stickycase( ( x: number ): number => x ); // $ExpectError } +// The compiler throws an error if the second parameter is not a number... +{ + stickycase('hello world', true); // $ExpectError + stickycase('hello world', false); // $ExpectError + stickycase('hello world', undefined); // $ExpectError + stickycase('hello world', 'test'); // $ExpectError + stickycase('hello world', []); // $ExpectError + stickycase('hello world', {}); // $ExpectError + stickycase('hello world', (x: number): number => x); // $ExpectError +} + // The compiler throws an error if the function is provided insufficient arguments... { - // eslint-disable-next-line expect-type/expect stickycase(); // $ExpectError } From 22d647ef0e1c48644808fd5ff230ee14725c9dc4 Mon Sep 17 00:00:00 2001 From: Philipp Burckhardt Date: Tue, 5 Mar 2024 09:48:36 -0500 Subject: [PATCH 24/27] Update lib/node_modules/@stdlib/string/base/stickycase/test/test.js Signed-off-by: Philipp Burckhardt --- .../string/base/stickycase/test/test.js | 28 ------------------- 1 file changed, 28 deletions(-) diff --git a/lib/node_modules/@stdlib/string/base/stickycase/test/test.js b/lib/node_modules/@stdlib/string/base/stickycase/test/test.js index 255b96f3ade9..27a2919829ad 100644 --- a/lib/node_modules/@stdlib/string/base/stickycase/test/test.js +++ b/lib/node_modules/@stdlib/string/base/stickycase/test/test.js @@ -32,34 +32,6 @@ tape( 'main export is a function', function test( t ) { t.end(); }); -tape( 'the function throws an error if not provided a string', function test( t ) { - var values; - var i; - - values = [ - 5, - NaN, - true, - false, - null, - void 0, - [], - {}, - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws a type error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - stickycase( value ); - }; - } -}); - tape('the function converts a string to sticky caps case', function test(t) { var actual; From 70674ae2fd3ea9ad466a8b5f1caaf507001843f9 Mon Sep 17 00:00:00 2001 From: Philipp Burckhardt Date: Tue, 5 Mar 2024 09:49:39 -0500 Subject: [PATCH 25/27] Update lib/node_modules/@stdlib/string/base/stickycase/README.md Signed-off-by: Philipp Burckhardt --- lib/node_modules/@stdlib/string/base/stickycase/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/node_modules/@stdlib/string/base/stickycase/README.md b/lib/node_modules/@stdlib/string/base/stickycase/README.md index 599d08310538..c8de625fd4be 100644 --- a/lib/node_modules/@stdlib/string/base/stickycase/README.md +++ b/lib/node_modules/@stdlib/string/base/stickycase/README.md @@ -63,8 +63,10 @@ out = stickycase( 'good morning', 0.8 ); ```javascript var stickycase = require( '@stdlib/string/base/stickycase' ); +var str = 'Hello World!'; var out = stickycase( str ); // returns +// returns str = 'I am a tiny little teapot'; out = stickycase( str ); From c6fab685ad5a923fd7a8b2ae00335f392b860382 Mon Sep 17 00:00:00 2001 From: Philipp Burckhardt Date: Tue, 5 Mar 2024 09:54:44 -0500 Subject: [PATCH 26/27] Update lib/node_modules/@stdlib/string/base/stickycase/README.md Signed-off-by: Philipp Burckhardt --- lib/node_modules/@stdlib/string/base/stickycase/README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/string/base/stickycase/README.md b/lib/node_modules/@stdlib/string/base/stickycase/README.md index c8de625fd4be..fac2d757c0a7 100644 --- a/lib/node_modules/@stdlib/string/base/stickycase/README.md +++ b/lib/node_modules/@stdlib/string/base/stickycase/README.md @@ -34,13 +34,17 @@ var stickycase = require( '@stdlib/string/base/stickycase' ); #### stickycase( str\[, p] ) -Converts a string to sticky case. +Converts a string to sticky case, where each character in the input string is randomly converted to either uppercase or lowercase. ```javascript var str = 'hello world'; var out = stickycase( 'hello world' ); // returns +``` + +By default, the probability for any character to be capitalized is `0.5`. To set a different probability, provide a `p` argument. +```javascript str = 'welcome!'; out = stickycase( 'welcome!', 0.2 ); // returns From 56006e23534c40450fedc23a17b7da2386fee629 Mon Sep 17 00:00:00 2001 From: Philipp Burckhardt Date: Tue, 5 Mar 2024 09:57:02 -0500 Subject: [PATCH 27/27] Update lib/node_modules/@stdlib/string/base/stickycase/README.md Signed-off-by: Philipp Burckhardt --- lib/node_modules/@stdlib/string/base/stickycase/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/string/base/stickycase/README.md b/lib/node_modules/@stdlib/string/base/stickycase/README.md index fac2d757c0a7..6c4953d90fd9 100644 --- a/lib/node_modules/@stdlib/string/base/stickycase/README.md +++ b/lib/node_modules/@stdlib/string/base/stickycase/README.md @@ -45,8 +45,8 @@ var out = stickycase( 'hello world' ); By default, the probability for any character to be capitalized is `0.5`. To set a different probability, provide a `p` argument. ```javascript -str = 'welcome!'; -out = stickycase( 'welcome!', 0.2 ); +var str = 'welcome!'; +var out = stickycase( 'welcome!', 0.2 ); // returns str = 'good morning';