{"_id":"@stdlib/string-base-starts-with","_rev":"3336150","name":"@stdlib/string-base-starts-with","description":"Test if a string starts with the characters of another string.","dist-tags":{"latest":"0.2.1"},"maintainers":[{"name":"kgryte","email":"kgryte@gmail.com"},{"name":"planeshifter","email":"pgb@andrew.cmu.edu"},{"name":"rreusser","email":"rsreusser@gmail.com"},{"name":"stdlib-bot","email":""}],"time":{"modified":"2024-07-10T07:50:15.000Z","created":"2022-09-17T20:37:56.056Z","0.2.1":"2024-02-21T15:11:59.124Z","0.2.0":"2024-02-14T03:21:03.440Z","0.1.1":"2023-10-03T22:42:24.081Z","0.1.0":"2023-09-22T02:59:34.082Z","0.0.2":"2022-09-17T20:37:56.056Z"},"users":{},"author":{"name":"The Stdlib Authors","url":"https://github.com/stdlib-js/stdlib/graphs/contributors"},"repository":{"type":"git","url":"git://github.com/stdlib-js/string-base-starts-with.git"},"versions":{"0.2.1":{"name":"@stdlib/string-base-starts-with","version":"0.2.1","description":"Test if a string starts with the characters of another 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":{"doc":"./docs","lib":"./lib","dist":"./dist"},"types":"./docs/types","scripts":{},"homepage":"https://stdlib.io","repository":{"type":"git","url":"git://github.com/stdlib-js/string-base-starts-with.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","check","begins","begin","starts","start","test","search","match"],"funding":{"type":"opencollective","url":"https://opencollective.com/stdlib"},"gitHead":"64931c5fdb4abc3a339b619658d3b5acc089e556","_id":"@stdlib/string-base-starts-with@0.2.1","_nodeVersion":"16.20.2","_npmVersion":"8.19.4","dist":{"shasum":"4280d18c9fe298c199c65b414fdb236a74624f27","size":9092,"noattachment":false,"key":"/@stdlib/string-base-starts-with/-/@stdlib/string-base-starts-with-0.2.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/@stdlib/string-base-starts-with/download/@stdlib/string-base-starts-with-0.2.1.tgz"},"_npmUser":{"name":"stdlib-bot","email":"kgryte+stdlibbot@gmail.com"},"maintainers":[{"name":"kgryte","email":"kgryte@gmail.com"},{"name":"planeshifter","email":"pgb@andrew.cmu.edu"},{"name":"rreusser","email":"rsreusser@gmail.com"},{"name":"stdlib-bot","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/string-base-starts-with_0.2.1_1708528318937_0.45816086474703477"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2024-02-21T15:11:59.124Z","publish_time":1708528319124,"_source_registry_name":"default","_cnpm_publish_time":1708528319124},"0.2.0":{"name":"@stdlib/string-base-starts-with","version":"0.2.0","description":"Test if a string starts with the characters of another 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":{"test":"make test","test-cov":"make test-cov","examples":"make examples","benchmark":"make benchmark"},"homepage":"https://stdlib.io","repository":{"type":"git","url":"git://github.com/stdlib-js/string-base-starts-with.git"},"bugs":{"url":"https://github.com/stdlib-js/stdlib/issues"},"dependencies":{},"devDependencies":{"@stdlib/assert-is-boolean":"^0.1.1","proxyquire":"^2.0.0","tape":"git+https://github.com/kgryte/tape.git#fix/globby","istanbul":"^0.4.1","tap-min":"git+https://github.com/Planeshifter/tap-min.git","@stdlib/bench-harness":"^0.1.2","@stdlib/bench":"^0.3.1"},"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","check","begins","begin","starts","start","test","search","match"],"funding":{"type":"opencollective","url":"https://opencollective.com/stdlib"},"gitHead":"7137673f0798ef13d7c9fd7becf78e557b1d583b","_id":"@stdlib/string-base-starts-with@0.2.0","_nodeVersion":"16.20.2","_npmVersion":"8.19.4","dist":{"shasum":"b5e7d89c3d12809d91c7590870e52b061a4cfab7","size":9269,"noattachment":false,"key":"/@stdlib/string-base-starts-with/-/@stdlib/string-base-starts-with-0.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/@stdlib/string-base-starts-with/download/@stdlib/string-base-starts-with-0.2.0.tgz"},"_npmUser":{"name":"stdlib-bot","email":"kgryte+stdlibbot@gmail.com"},"maintainers":[{"name":"kgryte","email":"kgryte@gmail.com"},{"name":"planeshifter","email":"pgb@andrew.cmu.edu"},{"name":"rreusser","email":"rsreusser@gmail.com"},{"name":"stdlib-bot","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/string-base-starts-with_0.2.0_1707880863230_0.4148962256512301"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2024-02-14T03:21:03.440Z","publish_time":1707880863440,"_source_registry_name":"default","_cnpm_publish_time":1707880863440},"0.1.1":{"name":"@stdlib/string-base-starts-with","version":"0.1.1","description":"Test if a string starts with the characters of another 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":{"test":"make test","test-cov":"make test-cov","examples":"make examples","benchmark":"make benchmark"},"homepage":"https://stdlib.io","repository":{"type":"git","url":"git://github.com/stdlib-js/string-base-starts-with.git"},"bugs":{"url":"https://github.com/stdlib-js/stdlib/issues"},"dependencies":{},"devDependencies":{"@stdlib/assert-is-boolean":"^0.1.0","@stdlib/bench":"^0.1.0","proxyquire":"^2.0.0","tape":"git+https://github.com/kgryte/tape.git#fix/globby","istanbul":"^0.4.1","tap-min":"git+https://github.com/Planeshifter/tap-min.git"},"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","check","begins","begin","starts","start","test","search","match"],"funding":{"type":"opencollective","url":"https://opencollective.com/stdlib"},"gitHead":"836b37cf688bfa381fcb3cb3a2dd327f0a94ad19","_id":"@stdlib/string-base-starts-with@0.1.1","_nodeVersion":"16.20.2","_npmVersion":"8.19.4","dist":{"shasum":"a8b30f3edb7542e3d665baa26258c5692b5eb602","size":9401,"noattachment":false,"key":"/@stdlib/string-base-starts-with/-/@stdlib/string-base-starts-with-0.1.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/@stdlib/string-base-starts-with/download/@stdlib/string-base-starts-with-0.1.1.tgz"},"_npmUser":{"name":"stdlib-bot","email":"kgryte+stdlibbot@gmail.com"},"maintainers":[{"name":"kgryte","email":"kgryte@gmail.com"},{"name":"planeshifter","email":"pgb@andrew.cmu.edu"},{"name":"rreusser","email":"rsreusser@gmail.com"},{"name":"stdlib-bot","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/string-base-starts-with_0.1.1_1696372943829_0.8953477305823019"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2023-10-03T22:42:24.081Z","publish_time":1696372944081,"_source_registry_name":"default","_cnpm_publish_time":1696372944081},"0.1.0":{"name":"@stdlib/string-base-starts-with","version":"0.1.0","description":"Test if a string starts with the characters of another 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":{"test":"make test","test-cov":"make test-cov","examples":"make examples","benchmark":"make benchmark"},"homepage":"https://stdlib.io","repository":{"type":"git","url":"git://github.com/stdlib-js/string-base-starts-with.git"},"bugs":{"url":"https://github.com/stdlib-js/stdlib/issues"},"dependencies":{},"devDependencies":{"@stdlib/assert-is-boolean":"^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-min":"git+https://github.com/Planeshifter/tap-min.git"},"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","check","begins","begin","starts","start","test","search","match"],"funding":{"type":"opencollective","url":"https://opencollective.com/stdlib"},"gitHead":"4f2310de3494fe36f4b74db309593f63e9d24dcc","_id":"@stdlib/string-base-starts-with@0.1.0","_nodeVersion":"16.20.2","_npmVersion":"8.19.4","dist":{"shasum":"33cf2021f219ab4e9598d06b8d06ab17f78be810","size":9407,"noattachment":false,"key":"/@stdlib/string-base-starts-with/-/@stdlib/string-base-starts-with-0.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/@stdlib/string-base-starts-with/download/@stdlib/string-base-starts-with-0.1.0.tgz"},"_npmUser":{"name":"stdlib-bot","email":"kgryte+stdlibbot@gmail.com"},"maintainers":[{"name":"kgryte","email":"kgryte@gmail.com"},{"name":"planeshifter","email":"pgb@andrew.cmu.edu"},{"name":"rreusser","email":"rsreusser@gmail.com"},{"name":"stdlib-bot","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/string-base-starts-with_0.1.0_1695351573877_0.2459329341978589"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2023-09-22T02:59:34.082Z","publish_time":1695351574082,"_source_registry_name":"default","_cnpm_publish_time":1695351574082},"0.0.2":{"name":"@stdlib/string-base-starts-with","version":"0.0.2","description":"Test if a string starts with the characters of another 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":{"test":"make test","test-cov":"make test-cov","examples":"make examples","benchmark":"make benchmark"},"homepage":"https://stdlib.io","repository":{"type":"git","url":"git://github.com/stdlib-js/string-base-starts-with.git"},"bugs":{"url":"https://github.com/stdlib-js/stdlib/issues"},"dependencies":{},"devDependencies":{"@stdlib/assert-is-boolean":"^0.0.x","@stdlib/bench":"^0.0.x","proxyquire":"^2.0.0","tape":"git+https://github.com/kgryte/tape.git#fix/globby","istanbul":"^0.4.1","tap-spec":"5.x.x"},"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","check","begins","begin","starts","start","test","search","match"],"funding":{"type":"patreon","url":"https://www.patreon.com/athan"},"gitHead":"e7551b6e596cafb8221a2610550d52755a37b39c","_id":"@stdlib/string-base-starts-with@0.0.2","_nodeVersion":"16.17.0","_npmVersion":"8.15.0","dist":{"shasum":"905d2b648a0eba803dc788612706e3c0dc50dc66","size":7761,"noattachment":false,"key":"/@stdlib/string-base-starts-with/-/@stdlib/string-base-starts-with-0.0.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/@stdlib/string-base-starts-with/download/@stdlib/string-base-starts-with-0.0.2.tgz"},"_npmUser":{"name":"kgryte","email":"kgryte@gmail.com"},"maintainers":[{"name":"kgryte","email":"kgryte@gmail.com"},{"name":"planeshifter","email":"pgb@andrew.cmu.edu"},{"name":"rreusser","email":"rsreusser@gmail.com"},{"name":"stdlib-bot","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/string-base-starts-with_0.0.2_1663447075880_0.06678702276213189"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-09-17T20:38:50.345Z","publish_time":1663447076056,"_cnpm_publish_time":1663447076056}},"readme":"<!--\n\n@license Apache-2.0\n\nCopyright (c) 2022 The Stdlib Authors.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n   http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n\n-->\n\n\n<details>\n  <summary>\n    About stdlib...\n  </summary>\n  <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>\n  <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>\n  <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>\n  <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>\n</details>\n\n# startsWith\n\n[![NPM version][npm-image]][npm-url] [![Build Status][test-image]][test-url] [![Coverage Status][coverage-image]][coverage-url] <!-- [![dependencies][dependencies-image]][dependencies-url] -->\n\n> Test if a string starts with the characters of another string.\n\n<section class=\"intro\">\n\n</section>\n\n<!-- /.intro -->\n\n<section class=\"installation\">\n\n## Installation\n\n```bash\nnpm install @stdlib/string-base-starts-with\n```\n\n</section>\n\n<section class=\"usage\">\n\n## Usage\n\n```javascript\nvar startsWith = require( '@stdlib/string-base-starts-with' );\n```\n\n#### startsWith( str, search, position )\n\nTests if a string starts with the characters of another string.\n\n```javascript\nvar str = 'To be, or not to be, that is the question.';\n\nvar bool = startsWith( str, 'To be', 0 );\n// returns true\n\nbool = startsWith( str, 'to be', 0 );\n// returns false\n```\n\nTo search from a specific character index, provide a `position` value (zero-based). If provided a negative `position`, the start index is determined relative to the string end (i.e., `pos = str.length + position`).\n\n```javascript\nvar str = 'Remember the story I used to tell you when you were a boy?';\n\nvar bool = startsWith( str, 'the story', 0 );\n// returns false\n\nbool = startsWith( str, 'the story', 9 );\n// returns true\n\nbool = startsWith( str, 'you', -15 );\n// returns true\n```\n\nIf provided an empty `search` string, the function **always** returns `true`.\n\n```javascript\nvar str = 'beep boop';\n\nvar bool = startsWith( str, '', 0 );\n// returns true\n```\n\n</section>\n\n<!-- /.usage -->\n\n<section class=\"notes\">\n\n## Notes\n\n-   This function differs from [`String.prototype.startsWith`][mdn-string-startswith] in the following ways:\n\n    -   The function assumes string values for the first and second arguments and assumes that the `position` argument is an integer value.\n    -   The function does **not** clamp negative `position` values. Instead, when provided a negative `position`, the function resolves the starting search position relative to the end of the string.\n    -   Except when provided an empty `search` string, the function **always** returns `false` if a `position` resolves to a starting search position which exceeds the bounds of the input string.\n\n</section>\n\n<!-- /.notes -->\n\n<section class=\"examples\">\n\n## Examples\n\n<!-- eslint no-undef: \"error\" -->\n\n```javascript\nvar startsWith = require( '@stdlib/string-base-starts-with' );\n\nvar str = 'Fair is foul, and foul is fair, hover through fog and filthy air';\n\nvar bool = startsWith( str, 'Fair', 0 );\n// returns true\n\nbool = startsWith( str, 'fair', 0 );\n// returns false\n\nbool = startsWith( str, 'foul', 8 );\n// returns true\n\nbool = startsWith( str, 'filthy', -10 );\n// returns true\n```\n\n</section>\n\n<!-- /.examples -->\n\n<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->\n\n<section class=\"related\">\n\n</section>\n\n<!-- /.related -->\n\n<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->\n\n\n<section class=\"main-repo\" >\n\n* * *\n\n## Notice\n\nThis package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more.\n\nFor more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib].\n\n#### Community\n\n[![Chat][chat-image]][chat-url]\n\n---\n\n## License\n\nSee [LICENSE][stdlib-license].\n\n\n## Copyright\n\nCopyright &copy; 2016-2024. The Stdlib [Authors][stdlib-authors].\n\n</section>\n\n<!-- /.stdlib -->\n\n<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->\n\n<section class=\"links\">\n\n[npm-image]: http://img.shields.io/npm/v/@stdlib/string-base-starts-with.svg\n[npm-url]: https://npmjs.org/package/@stdlib/string-base-starts-with\n\n[test-image]: https://github.com/stdlib-js/string-base-starts-with/actions/workflows/test.yml/badge.svg?branch=v0.2.1\n[test-url]: https://github.com/stdlib-js/string-base-starts-with/actions/workflows/test.yml?query=branch:v0.2.1\n\n[coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/string-base-starts-with/main.svg\n[coverage-url]: https://codecov.io/github/stdlib-js/string-base-starts-with?branch=main\n\n<!--\n\n[dependencies-image]: https://img.shields.io/david/stdlib-js/string-base-starts-with.svg\n[dependencies-url]: https://david-dm.org/stdlib-js/string-base-starts-with/main\n\n-->\n\n[chat-image]: https://img.shields.io/gitter/room/stdlib-js/stdlib.svg\n[chat-url]: https://app.gitter.im/#/room/#stdlib-js_stdlib:gitter.im\n\n[stdlib]: https://github.com/stdlib-js/stdlib\n\n[stdlib-authors]: https://github.com/stdlib-js/stdlib/graphs/contributors\n\n[umd]: https://github.com/umdjs/umd\n[es-module]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules\n\n[deno-url]: https://github.com/stdlib-js/string-base-starts-with/tree/deno\n[deno-readme]: https://github.com/stdlib-js/string-base-starts-with/blob/deno/README.md\n[umd-url]: https://github.com/stdlib-js/string-base-starts-with/tree/umd\n[umd-readme]: https://github.com/stdlib-js/string-base-starts-with/blob/umd/README.md\n[esm-url]: https://github.com/stdlib-js/string-base-starts-with/tree/esm\n[esm-readme]: https://github.com/stdlib-js/string-base-starts-with/blob/esm/README.md\n[branches-url]: https://github.com/stdlib-js/string-base-starts-with/blob/main/branches.md\n\n[stdlib-license]: https://raw.githubusercontent.com/stdlib-js/string-base-starts-with/main/LICENSE\n\n[mdn-string-startswith]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith\n\n</section>\n\n<!-- /.links -->\n","_attachments":{},"homepage":"https://stdlib.io","bugs":{"url":"https://github.com/stdlib-js/stdlib/issues"},"license":"Apache-2.0"}