@stdlib/string-dotcase 0.0.2 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE CHANGED
File without changes
package/NOTICE CHANGED
@@ -1 +1 @@
1
- Copyright (c) 2016-2023 The Stdlib Authors.
1
+ Copyright (c) 2016-2023 The Stdlib Authors.
package/README.md CHANGED
@@ -1,31 +1,31 @@
1
- <!--
2
-
3
- @license Apache-2.0
4
-
5
- Copyright (c) 2023 The Stdlib Authors.
6
-
7
- Licensed under the Apache License, Version 2.0 (the "License");
8
- you may not use this file except in compliance with the License.
9
- You may obtain a copy of the License at
10
-
11
- http://www.apache.org/licenses/LICENSE-2.0
12
-
13
- Unless required by applicable law or agreed to in writing, software
14
- distributed under the License is distributed on an "AS IS" BASIS,
15
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
- See the License for the specific language governing permissions and
17
- limitations under the License.
18
-
19
- -->
20
-
21
- # dotcase
22
-
1
+ <!--
2
+
3
+ @license Apache-2.0
4
+
5
+ Copyright (c) 2023 The Stdlib Authors.
6
+
7
+ Licensed under the Apache License, Version 2.0 (the "License");
8
+ you may not use this file except in compliance with the License.
9
+ You may obtain a copy of the License at
10
+
11
+ http://www.apache.org/licenses/LICENSE-2.0
12
+
13
+ Unless required by applicable law or agreed to in writing, software
14
+ distributed under the License is distributed on an "AS IS" BASIS,
15
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ See the License for the specific language governing permissions and
17
+ limitations under the License.
18
+
19
+ -->
20
+
21
+ # dotcase
22
+
23
23
  [![NPM version][npm-image]][npm-url] [![Build Status][test-image]][test-url] [![Coverage Status][coverage-image]][coverage-url] <!-- [![dependencies][dependencies-image]][dependencies-url] -->
24
24
 
25
- > Convert a string to dot case.
26
-
27
- <!-- Package usage documentation. -->
28
-
25
+ > Convert a string to dot case.
26
+
27
+ <!-- Package usage documentation. -->
28
+
29
29
  <section class="installation">
30
30
 
31
31
  ## Installation
@@ -36,79 +36,81 @@ npm install @stdlib/string-dotcase
36
36
 
37
37
  </section>
38
38
 
39
- <section class="usage">
40
-
41
- ## Usage
42
-
43
- ```javascript
44
- var dotcase = require( '@stdlib/string-dotcase' );
45
- ```
46
-
47
- #### dotcase( str )
48
-
49
- Converts a string to dot case.
50
-
51
- ```javascript
52
- var out = dotcase( 'foo bar' );
53
- // returns 'foo.bar'
54
-
55
- out = dotcase( 'IS_MOBILE' );
56
- // returns 'is.mobile'
57
-
58
- out = dotcase( 'Hello World!' );
59
- // returns 'hello.world'
60
-
61
- out = dotcase( '--foo-bar--' );
62
- // returns 'foo.bar'
63
- ```
64
-
65
- </section>
66
-
67
- <!-- /.usage -->
68
-
69
- <!-- Package usage examples. -->
70
-
71
- <section class="examples">
72
-
73
- ## Examples
74
-
75
- ```javascript
76
- var dotcase = require( '@stdlib/string-dotcase' );
77
-
78
- var str = 'Hello World!';
79
- var out = dotcase( str );
80
- // returns 'hello.world'
81
-
82
- str = 'HELLO WORLD!';
83
- out = dotcase( str );
84
- // returns 'hello.world'
85
-
86
- str = 'To be, or not to be: that is the question.';
87
- out = dotcase( str );
88
- // returns 'to.be.or.not.to.be.that.is.the.question'
89
- ```
90
-
91
- </section>
92
-
93
- <!-- /.examples -->
94
-
95
-
96
-
97
- <!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
98
-
39
+ <section class="usage">
40
+
41
+ ## Usage
42
+
43
+ ```javascript
44
+ var dotcase = require( '@stdlib/string-dotcase' );
45
+ ```
46
+
47
+ #### dotcase( str )
48
+
49
+ Converts a string to dot case.
50
+
51
+ ```javascript
52
+ var out = dotcase( 'foo bar' );
53
+ // returns 'foo.bar'
54
+
55
+ out = dotcase( 'IS_MOBILE' );
56
+ // returns 'is.mobile'
57
+
58
+ out = dotcase( 'Hello World!' );
59
+ // returns 'hello.world'
60
+
61
+ out = dotcase( '--foo-bar--' );
62
+ // returns 'foo.bar'
63
+ ```
64
+
65
+ </section>
66
+
67
+ <!-- /.usage -->
68
+
69
+ <!-- Package usage examples. -->
70
+
71
+ <section class="examples">
72
+
73
+ ## Examples
74
+
75
+ ```javascript
76
+ var dotcase = require( '@stdlib/string-dotcase' );
77
+
78
+ var str = 'Hello World!';
79
+ var out = dotcase( str );
80
+ // returns 'hello.world'
81
+
82
+ str = 'HELLO WORLD!';
83
+ out = dotcase( str );
84
+ // returns 'hello.world'
85
+
86
+ str = 'To be, or not to be: that is the question.';
87
+ out = dotcase( str );
88
+ // returns 'to.be.or.not.to.be.that.is.the.question'
89
+ ```
90
+
91
+ </section>
92
+
93
+ <!-- /.examples -->
94
+
95
+ * * *
96
+
97
+
98
+
99
+ <!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
100
+
99
101
  <section class="related">
100
102
 
101
103
  ## See Also
102
104
 
103
105
  - <span class="package-name">[`@stdlib/string-dotcase-cli`][@stdlib/string-dotcase-cli]</span><span class="delimiter">: </span><span class="description">CLI package for use as a command-line utility.</span>
104
-
105
-
106
- </section>
107
-
108
- <!-- /.related -->
109
-
110
- <!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
111
-
106
+
107
+
108
+ </section>
109
+
110
+ <!-- /.related -->
111
+
112
+ <!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
113
+
112
114
 
113
115
  <section class="main-repo" >
114
116
 
@@ -148,8 +150,8 @@ Copyright &copy; 2016-2023. The Stdlib [Authors][stdlib-authors].
148
150
  [npm-image]: http://img.shields.io/npm/v/@stdlib/string-dotcase.svg
149
151
  [npm-url]: https://npmjs.org/package/@stdlib/string-dotcase
150
152
 
151
- [test-image]: https://github.com/stdlib-js/string-dotcase/actions/workflows/test.yml/badge.svg?branch=v0.0.2
152
- [test-url]: https://github.com/stdlib-js/string-dotcase/actions/workflows/test.yml?query=branch:v0.0.2
153
+ [test-image]: https://github.com/stdlib-js/string-dotcase/actions/workflows/test.yml/badge.svg?branch=v0.0.4
154
+ [test-url]: https://github.com/stdlib-js/string-dotcase/actions/workflows/test.yml?query=branch:v0.0.4
153
155
 
154
156
  [coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/string-dotcase/main.svg
155
157
  [coverage-url]: https://codecov.io/github/stdlib-js/string-dotcase?branch=main
@@ -180,12 +182,12 @@ Copyright &copy; 2016-2023. The Stdlib [Authors][stdlib-authors].
180
182
  [esm-url]: https://github.com/stdlib-js/string-dotcase/tree/esm
181
183
  [branches-url]: https://github.com/stdlib-js/string-dotcase/blob/main/branches.md
182
184
 
183
- [stdlib-license]: https://raw.githubusercontent.com/stdlib-js/string-dotcase/main/LICENSE
184
-
185
- [standard-streams]: https://en.wikipedia.org/wiki/Standard_streams
186
-
187
- [mdn-regexp]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions
188
-
189
- </section>
190
-
191
- <!-- /.links -->
185
+ [stdlib-license]: https://raw.githubusercontent.com/stdlib-js/string-dotcase/main/LICENSE
186
+
187
+ [standard-streams]: https://en.wikipedia.org/wiki/Standard_streams
188
+
189
+ [mdn-regexp]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions
190
+
191
+ </section>
192
+
193
+ <!-- /.links -->
@@ -1,44 +1,44 @@
1
- /*
2
- * @license Apache-2.0
3
- *
4
- * Copyright (c) 2023 The Stdlib Authors.
5
- *
6
- * Licensed under the Apache License, Version 2.0 (the "License");
7
- * you may not use this file except in compliance with the License.
8
- * You may obtain a copy of the License at
9
- *
10
- * http://www.apache.org/licenses/LICENSE-2.0
11
- *
12
- * Unless required by applicable law or agreed to in writing, software
13
- * distributed under the License is distributed on an "AS IS" BASIS,
14
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- * See the License for the specific language governing permissions and
16
- * limitations under the License.
17
- */
18
-
19
- // TypeScript Version: 2.0
20
-
21
- /**
22
- * Converts a string to dot case.
23
- *
24
- * @param str - string to convert
25
- * @returns dot-cased string
26
- *
27
- * @example
28
- * var str = dotcase( 'Hello World!' );
29
- * // returns 'hello.world'
30
- *
31
- * @example
32
- * var str = dotcase( 'foo_bar' );
33
- * // returns 'foo.bar'
34
- *
35
- * @example
36
- * var str = dotcase( 'foo-bar' );
37
- * // returns 'foo.bar'
38
- */
39
- declare function dotcase( str: string ): string;
40
-
41
-
42
- // EXPORTS //
43
-
44
- export = dotcase;
1
+ /*
2
+ * @license Apache-2.0
3
+ *
4
+ * Copyright (c) 2023 The Stdlib Authors.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+
19
+ // TypeScript Version: 2.0
20
+
21
+ /**
22
+ * Converts a string to dot case.
23
+ *
24
+ * @param str - string to convert
25
+ * @returns dot-cased string
26
+ *
27
+ * @example
28
+ * var str = dotcase( 'Hello World!' );
29
+ * // returns 'hello.world'
30
+ *
31
+ * @example
32
+ * var str = dotcase( 'foo_bar' );
33
+ * // returns 'foo.bar'
34
+ *
35
+ * @example
36
+ * var str = dotcase( 'foo-bar' );
37
+ * // returns 'foo.bar'
38
+ */
39
+ declare function dotcase( str: string ): string;
40
+
41
+
42
+ // EXPORTS //
43
+
44
+ export = dotcase;
package/lib/index.js CHANGED
@@ -1,4 +1,20 @@
1
- // Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0
1
+ /**
2
+ * @license Apache-2.0
3
+ *
4
+ * Copyright (c) 2023 The Stdlib Authors.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
2
18
 
3
19
  'use strict';
4
20
 
package/lib/main.js CHANGED
@@ -1,11 +1,27 @@
1
- // Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0
1
+ /**
2
+ * @license Apache-2.0
3
+ *
4
+ * Copyright (c) 2023 The Stdlib Authors.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
2
18
 
3
19
  'use strict';
4
20
 
5
21
  // MODULES //
6
22
 
7
23
  var isString = require( '@stdlib/assert-is-string' ).isPrimitive;
8
- var format = require( '@stdlib/error-tools-fmtprodmsg' );
24
+ var format = require( '@stdlib/string-format' );
9
25
  var base = require( '@stdlib/string-base-dotcase' );
10
26
 
11
27
 
@@ -36,7 +52,7 @@ var base = require( '@stdlib/string-base-dotcase' );
36
52
  */
37
53
  function dotcase( str ) {
38
54
  if ( !isString( str ) ) {
39
- throw new TypeError( format( "1gn3F,Ex", str ) );
55
+ throw new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) );
40
56
  }
41
57
  return base( str );
42
58
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stdlib/string-dotcase",
3
- "version": "0.0.2",
3
+ "version": "0.0.4",
4
4
  "description": "Convert a string to dot case.",
5
5
  "license": "Apache-2.0",
6
6
  "author": {
@@ -39,6 +39,7 @@
39
39
  "dependencies": {
40
40
  "@stdlib/assert-is-string": "^0.0.8",
41
41
  "@stdlib/string-base-dotcase": "^0.0.1",
42
+ "@stdlib/string-format": "^0.0.3",
42
43
  "@stdlib/error-tools-fmtprodmsg": "^0.0.2"
43
44
  },
44
45
  "devDependencies": {