@stdlib/string-base-right-trim
Advanced tools
Sorry, the diff of this file is not supported yet
| /// <reference path="../docs/types/index.d.ts" /> | ||
| import rtrim from '../docs/types/index'; | ||
| export = rtrim; |
| "use strict";var e=function(r,t){return function(){return t||r((t={exports:{}}).exports,t),t.exports}};var s=e(function(h,u){ | ||
| var c=typeof String.prototype.trimRight!="undefined";u.exports=c | ||
| });var a=e(function(I,o){ | ||
| var l=require('@stdlib/string-base-replace/dist'),m=/[\u0020\f\n\r\t\v\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+$/;function q(r){return l(r,m,"")}o.exports=q | ||
| });var f=e(function(A,n){ | ||
| var x=String.prototype.trimRight;n.exports=x | ||
| });var v=e(function(B,p){ | ||
| var g=f();function y(r){return g.call(r)}p.exports=y | ||
| });var R=s(),S=a(),b=v(),i;R?i=b:i=S;module.exports=i; | ||
| /** @license Apache-2.0 */ | ||
| //# sourceMappingURL=index.js.map |
| { | ||
| "version": 3, | ||
| "sources": ["../lib/has_builtin.js", "../lib/polyfill.js", "../lib/builtin.js", "../lib/main.js", "../lib/index.js"], | ||
| "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\nvar bool = ( typeof String.prototype.trimRight !== 'undefined' );\n\n\n// EXPORTS //\n\nmodule.exports = bool;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar replace = require( '@stdlib/string-base-replace' );\n\n\n// VARIABLES //\n\n// The following regular expression should suffice to polyfill (most?) all environments.\nvar RE = /[\\u0020\\f\\n\\r\\t\\v\\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000\\ufeff]+$/;\n\n\n// MAIN //\n\n/**\n* Trims whitespace from the end of a string.\n*\n* @private\n* @param {string} str - input string\n* @returns {string} trimmed string\n*\n* @example\n* var out = rtrim( ' Whitespace ' );\n* // returns ' Whitespace'\n*\n* @example\n* var out = rtrim( '\\t\\t\\tTabs\\t\\t\\t' );\n* // returns '\\t\\t\\tTabs'\n*\n* @example\n* var out = rtrim( '\\n\\n\\nNew Lines\\n\\n\\n' );\n* // returns '\\n\\n\\nNew Lines'\n*/\nfunction rtrim( str ) {\n\treturn replace( str, RE, '' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = rtrim;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\nvar rtrim = String.prototype.trimRight;\n\n\n// EXPORTS //\n\nmodule.exports = rtrim;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar builtin = require( './builtin.js' );\n\n\n// MAIN //\n\n/**\n* Trims whitespace from the end of a string.\n*\n* @param {string} str - input string\n* @returns {string} trimmed string\n*\n* @example\n* var out = rtrim( ' Whitespace ' );\n* // returns ' Whitespace'\n*\n* @example\n* var out = rtrim( '\\t\\t\\tTabs\\t\\t\\t' );\n* // returns '\\t\\t\\tTabs'\n*\n* @example\n* var out = rtrim( '\\n\\n\\nNew Lines\\n\\n\\n' );\n* // returns '\\n\\n\\nNew Lines'\n*/\nfunction rtrim( str ) {\n\treturn builtin.call( str );\n}\n\n\n// EXPORTS //\n\nmodule.exports = rtrim;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Trim whitespace characters from the end of a string.\n*\n* @module @stdlib/string-base-right-trim\n*\n* @example\n* var rtrim = require( '@stdlib/string-base-right-trim' );\n*\n* var out = rtrim( ' Whitespace ' );\n* // returns ' Whitespace'\n*\n* out = rtrim( '\\t\\t\\tTabs\\t\\t\\t' );\n* // returns '\\t\\t\\tTabs'\n*\n* out = rtrim( '\\n\\n\\nNew Lines\\n\\n\\n' );\n* // returns '\\n\\n\\nNew Lines'\n*/\n\n// MODULES //\n\nvar HAS_BUILTIN = require( './has_builtin.js' );\nvar polyfill = require( './polyfill.js' );\nvar main = require( './main.js' );\n\n\n// MAIN //\n\nvar rtrim;\nif ( HAS_BUILTIN ) {\n\trtrim = main;\n} else {\n\trtrim = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = rtrim;\n"], | ||
| "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAS,OAAO,OAAO,UAAU,WAAc,YAKnDD,EAAO,QAAUC,IC3BjB,IAAAC,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAU,QAAS,6BAA8B,EAMjDC,EAAK,oFAwBT,SAASC,EAAOC,EAAM,CACrB,OAAOH,EAASG,EAAKF,EAAI,EAAG,CAC7B,CAKAF,EAAO,QAAUG,IC3DjB,IAAAE,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAQ,OAAO,UAAU,UAK7BD,EAAO,QAAUC,IC3BjB,IAAAC,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAU,IAuBd,SAASC,EAAOC,EAAM,CACrB,OAAOF,EAAQ,KAAME,CAAI,CAC1B,CAKAH,EAAO,QAAUE,ICZjB,IAAIE,EAAc,IACdC,EAAW,IACXC,EAAO,IAKPC,EACCH,EACJG,EAAQD,EAERC,EAAQF,EAMT,OAAO,QAAUE", | ||
| "names": ["require_has_builtin", "__commonJSMin", "exports", "module", "bool", "require_polyfill", "__commonJSMin", "exports", "module", "replace", "RE", "rtrim", "str", "require_builtin", "__commonJSMin", "exports", "module", "rtrim", "require_main", "__commonJSMin", "exports", "module", "builtin", "rtrim", "str", "HAS_BUILTIN", "polyfill", "main", "rtrim"] | ||
| } |
@@ -19,3 +19,3 @@ /* | ||
| // TypeScript Version: 2.0 | ||
| // TypeScript Version: 4.1 | ||
@@ -22,0 +22,0 @@ /** |
+1
-1
@@ -1,1 +0,1 @@ | ||
| Copyright (c) 2016-2022 The Stdlib Authors. | ||
| Copyright (c) 2016-2023 The Stdlib Authors. |
+7
-7
| { | ||
| "name": "@stdlib/string-base-right-trim", | ||
| "version": "0.0.2", | ||
| "version": "0.1.0", | ||
| "description": "Trim whitespace characters from the end of a string.", | ||
@@ -40,11 +40,11 @@ "license": "Apache-2.0", | ||
| "dependencies": { | ||
| "@stdlib/string-base-replace": "^0.0.x" | ||
| "@stdlib/string-base-replace": "^0.1.0" | ||
| }, | ||
| "devDependencies": { | ||
| "@stdlib/assert-is-string": "^0.0.x", | ||
| "@stdlib/bench": "^0.0.x", | ||
| "@stdlib/assert-is-string": "^0.0.8", | ||
| "@stdlib/bench": "^0.0.12", | ||
| "proxyquire": "^2.0.0", | ||
| "tape": "git+https://github.com/kgryte/tape.git#fix/globby", | ||
| "istanbul": "^0.4.1", | ||
| "tap-spec": "5.x.x" | ||
| "tap-min": "git+https://github.com/Planeshifter/tap-min.git" | ||
| }, | ||
@@ -82,5 +82,5 @@ "engines": { | ||
| "funding": { | ||
| "type": "patreon", | ||
| "url": "https://www.patreon.com/athan" | ||
| "type": "opencollective", | ||
| "url": "https://opencollective.com/stdlib" | ||
| } | ||
| } |
+15
-4
@@ -21,2 +21,13 @@ <!-- | ||
| <details> | ||
| <summary> | ||
| About stdlib... | ||
| </summary> | ||
| <p>We believe in a future in which the web is a preferred environment for numerical computation. To help realize this future, we've built stdlib. stdlib is a standard library, with an emphasis on numerical and scientific computation, written in JavaScript (and C) for execution in browsers and in Node.js.</p> | ||
| <p>The library is fully decomposable, being architected in such a way that you can swap out and mix and match APIs and functionality to cater to your exact preferences and use cases.</p> | ||
| <p>When you use stdlib, you can be absolutely certain that you are using the most thorough, rigorous, well-written, studied, documented, tested, measured, and high-quality code out there.</p> | ||
| <p>To join us in bringing numerical computing to the web, get started by checking us out on <a href="https://github.com/stdlib-js/stdlib">GitHub</a>, and please consider <a href="https://opencollective.com/stdlib">financially supporting stdlib</a>. We greatly appreciate your continued support!</p> | ||
| </details> | ||
| # rtrim | ||
@@ -142,3 +153,3 @@ | ||
| Copyright © 2016-2022. The Stdlib [Authors][stdlib-authors]. | ||
| Copyright © 2016-2023. The Stdlib [Authors][stdlib-authors]. | ||
@@ -156,4 +167,4 @@ </section> | ||
| [test-image]: https://github.com/stdlib-js/string-base-right-trim/actions/workflows/test.yml/badge.svg?branch=v0.0.2 | ||
| [test-url]: https://github.com/stdlib-js/string-base-right-trim/actions/workflows/test.yml?query=branch:v0.0.2 | ||
| [test-image]: https://github.com/stdlib-js/string-base-right-trim/actions/workflows/test.yml/badge.svg?branch=v0.1.0 | ||
| [test-url]: https://github.com/stdlib-js/string-base-right-trim/actions/workflows/test.yml?query=branch:v0.1.0 | ||
@@ -171,3 +182,3 @@ [coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/string-base-right-trim/main.svg | ||
| [chat-image]: https://img.shields.io/gitter/room/stdlib-js/stdlib.svg | ||
| [chat-url]: https://gitter.im/stdlib-js/stdlib/ | ||
| [chat-url]: https://app.gitter.im/#/room/#stdlib-js_stdlib:gitter.im | ||
@@ -174,0 +185,0 @@ [stdlib]: https://github.com/stdlib-js/stdlib |
| {{alias}}( str ) | ||
| Trims whitespace from the end of a string. | ||
| "Whitespace" is defined as the following characters: | ||
| - \f | ||
| - \n | ||
| - \r | ||
| - \t | ||
| - \v | ||
| - \u0020 | ||
| - \u00a0 | ||
| - \u1680 | ||
| - \u2000-\u200a | ||
| - \u2028 | ||
| - \u2029 | ||
| - \u202f | ||
| - \u205f | ||
| - \u3000 | ||
| - \ufeff | ||
| Parameters | ||
| ---------- | ||
| str: string | ||
| Input string. | ||
| Returns | ||
| ------- | ||
| out: string | ||
| Trimmed string. | ||
| Examples | ||
| -------- | ||
| > var out = {{alias}}( ' \t\t\n Beep \r\n\t ' ) | ||
| ' \t\t\n Beep' | ||
| See Also | ||
| -------- | ||
| /* | ||
| * @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 rtrim = require( './index' ); | ||
| // TESTS // | ||
| // The function returns a string... | ||
| { | ||
| rtrim( ' Whitespace ' ); // $ExpectType string | ||
| } | ||
| // The compiler throws an error if the function is provided a value other than a string... | ||
| { | ||
| rtrim( true ); // $ExpectError | ||
| rtrim( false ); // $ExpectError | ||
| rtrim( null ); // $ExpectError | ||
| rtrim( undefined ); // $ExpectError | ||
| rtrim( 5 ); // $ExpectError | ||
| rtrim( [] ); // $ExpectError | ||
| rtrim( {} ); // $ExpectError | ||
| rtrim( ( x: number ): number => x ); // $ExpectError | ||
| } | ||
| // The compiler throws an error if the function is provided insufficient arguments... | ||
| { | ||
| rtrim(); // $ExpectError | ||
| } |
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
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
32592
29.8%14
16.67%200
5.82%236
-9.58%2
100%1
Infinity%+ Added
- Removed