Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
121 changes: 121 additions & 0 deletions lib/node_modules/@stdlib/symbol/split/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
<!--

@license Apache-2.0

Copyright (c) 2026 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.

-->

# SplitSymbol

> Split [symbol][mdn-symbol] which is used to define a custom string splitting behavior.

<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->

<section class="intro">

</section>

<!-- /.intro -->

<!-- Package usage documentation. -->

<section class="usage">

## Usage

```javascript
var SplitSymbol = require( '@stdlib/symbol/split' );
```

#### SplitSymbol

Split [`symbol`][mdn-symbol] which is used to define a custom string splitting behavior.

```javascript
var s = typeof SplitSymbol;
// e.g., returns 'symbol'
```

</section>

<!-- /.usage -->

<!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->

<section class="notes">

</section>

<!-- /.notes -->

<!-- Package usage examples. -->

<section class="examples">

## Examples

<!-- eslint no-undef: "error" -->

```javascript
var SplitSymbol = require( '@stdlib/symbol/split' );

var str;
var obj;
var parts;

function splitHandler() {
return [ 'beep', 'boop' ];
}

if ( SplitSymbol ) {
str = 'beep-boop';
obj = {};
obj[ SplitSymbol ] = splitHandler;
parts = str.split( obj );
console.log( parts );
// => [ 'beep', 'boop' ]
}
```

</section>

<!-- /.examples -->

<!-- Section to include cited references. If references are cited in the above section, this section should be included. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->

<section class="references">

</section>

<!-- /.references -->

<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated based on metadata in the package.json file. -->

<section class="related">

</section>

<!-- /.related -->

<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->

<section class="links">

[mdn-symbol]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol

</section>

<!-- /.links -->
32 changes: 32 additions & 0 deletions lib/node_modules/@stdlib/symbol/split/docs/types/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* @license Apache-2.0
*
* Copyright (c) 2026 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.
*/

/**
* Split symbol.
*
* @example
* if ( SplitSymbol ) {
* console.log( 'Split symbol is supported' );
* }
*/
declare const SplitSymbol: symbol | null;


// EXPORTS //

export = SplitSymbol;
40 changes: 40 additions & 0 deletions lib/node_modules/@stdlib/symbol/split/examples/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/**
* @license Apache-2.0
*
* Copyright (c) 2026 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 SplitSymbol = require( './../lib' );

var str;
var obj;
var parts;

function splitHandler() {
return [ 'beep', 'boop' ];
}

if ( SplitSymbol ) {
str = 'beep-boop';
obj = {};
obj[ SplitSymbol ] = splitHandler;
parts = str.split( obj );
console.log( parts );
// => [ 'beep', 'boop' ]
} else {
console.log( 'Split symbol is not supported in this environment.' );
}
54 changes: 54 additions & 0 deletions lib/node_modules/@stdlib/symbol/split/lib/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/**
* @license Apache-2.0
*
* Copyright (c) 2026 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';

/**
* Symbol used to define a custom string splitting behavior.
*
* @module @stdlib/symbol/split
*
* @example
* var SplitSymbol = require( '@stdlib/symbol/split' );
*
* var str;
* var obj;
* var parts;
*
* function splitHandler() {
* return [ 'beep', 'boop' ];
* }
*
* if ( SplitSymbol ) {
* str = 'beep-boop';
* obj = {};
* obj[ SplitSymbol ] = splitHandler;
* parts = str.split( obj );
* console.log( parts );
* // => [ 'beep', 'boop' ]
* }
*/

// MAIN //

var main = require( './main.js' );


// EXPORTS //

module.exports = main;
59 changes: 59 additions & 0 deletions lib/node_modules/@stdlib/symbol/split/lib/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/**
* @license Apache-2.0
*
* Copyright (c) 2026 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 hasSplitSymbolSupport = require( '@stdlib/assert/has-split-symbol-support' );


// MAIN //

/**
* Split symbol.
*
* @name SplitSymbol
* @constant
* @type {(symbol|null)}
* @default
*
* @example
* var str;
* var obj;
* var parts;
*
* function splitHandler() {
* return [ 'beep', 'boop' ];
* }
*
* if ( SplitSymbol ) {
* str = 'beep-boop';
* obj = {};
* obj[ SplitSymbol ] = splitHandler;
* parts = str.split( obj );
* console.log( parts );
* // => [ 'beep', 'boop' ]
* }
*/
var SplitSymbol = ( hasSplitSymbolSupport() ) ? Symbol.split : null;


// EXPORTS //

module.exports = SplitSymbol;
57 changes: 57 additions & 0 deletions lib/node_modules/@stdlib/symbol/split/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"name": "@stdlib/symbol/split",
"version": "0.0.0",
"description": "Split symbol.",
"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",
"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",
"symbol",
"sym",
"split",
"string"
]
}
Loading