@stdlib/number-int8-base-identity 0.1.0

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 ADDED
@@ -0,0 +1,177 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
package/NOTICE ADDED
@@ -0,0 +1 @@
1
+ Copyright (c) 2016-2026 The Stdlib Authors.
package/README.md ADDED
@@ -0,0 +1,299 @@
1
+ <!--
2
+
3
+ @license Apache-2.0
4
+
5
+ Copyright (c) 2025 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
+
22
+ <details>
23
+ <summary>
24
+ About stdlib...
25
+ </summary>
26
+ <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>
27
+ <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>
28
+ <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>
29
+ <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>
30
+ </details>
31
+
32
+ # Identity Function
33
+
34
+ [![NPM version][npm-image]][npm-url] [![Build Status][test-image]][test-url] [![Coverage Status][coverage-image]][coverage-url] <!-- [![dependencies][dependencies-image]][dependencies-url] -->
35
+
36
+ > Evaluate the [identity function][identity-function] of a signed 8-bit integer.
37
+
38
+ <section class="intro">
39
+
40
+ The [identity-function][identity-function] is defined as
41
+
42
+ <!-- <equation class="equation" label="eq:identity_function" align="center" raw="f(x) = x" alt="Identity function"> -->
43
+
44
+ <div class="equation" align="center" data-raw-text="f(x) = x" data-equation="eq:identity_function">
45
+ <img src="https://cdn.jsdelivr.net/gh/stdlib-js/stdlib@ad7afa5d7ec1b1596f8a4828153d8c2e87a90161/lib/node_modules/@stdlib/number/int8/base/identity/docs/img/equation_identity_function.svg" alt="Identity function">
46
+ <br>
47
+ </div>
48
+
49
+ <!-- </equation> -->
50
+
51
+ for all `x`.
52
+
53
+ </section>
54
+
55
+ <!-- /.intro -->
56
+
57
+ <section class="installation">
58
+
59
+ ## Installation
60
+
61
+ ```bash
62
+ npm install @stdlib/number-int8-base-identity
63
+ ```
64
+
65
+ </section>
66
+
67
+ <section class="usage">
68
+
69
+ ## Usage
70
+
71
+ ```javascript
72
+ var identity = require( '@stdlib/number-int8-base-identity' );
73
+ ```
74
+
75
+ #### identity( x )
76
+
77
+ Evaluates the [identity function][identity-function] for a signed 8-bit integer.
78
+
79
+ ```javascript
80
+ var v = identity( 1 );
81
+ // returns 1
82
+
83
+ v = identity( 2 );
84
+ // returns 2
85
+
86
+ v = identity( 0 );
87
+ // returns 0
88
+
89
+ v = identity( 127 );
90
+ // returns 127
91
+ ```
92
+
93
+ </section>
94
+
95
+ <!-- /.usage -->
96
+
97
+ <section class="examples">
98
+
99
+ ## Examples
100
+
101
+ <!-- eslint no-undef: "error" -->
102
+
103
+ ```javascript
104
+ var discreteUniform = require( '@stdlib/random-array-discrete-uniform' );
105
+ var logEachMap = require( '@stdlib/console-log-each-map' );
106
+ var identity = require( '@stdlib/number-int8-base-identity' );
107
+
108
+ var opts = {
109
+ 'dtype': 'int8'
110
+ };
111
+
112
+ // Create an array of random values:
113
+ var x = discreteUniform( 100, 0, 50, opts );
114
+
115
+ // Perform element-wise operation:
116
+ logEachMap( 'identity(%d) = %d', x, identity );
117
+ ```
118
+
119
+ </section>
120
+
121
+ <!-- /.examples -->
122
+
123
+ <!-- C interface documentation. -->
124
+
125
+ * * *
126
+
127
+ <section class="c">
128
+
129
+ ## C APIs
130
+
131
+ <!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
132
+
133
+ <section class="intro">
134
+
135
+ </section>
136
+
137
+ <!-- /.intro -->
138
+
139
+ <!-- C usage documentation. -->
140
+
141
+ <section class="usage">
142
+
143
+ ### Usage
144
+
145
+ ```c
146
+ #include "stdlib/number/int8/base/identity.h"
147
+ ```
148
+
149
+ #### stdlib_base_int8_identity( x )
150
+
151
+ Evaluates the identity function for a signed 8-bit integer.
152
+
153
+ ```c
154
+ #include <stdint.h>
155
+
156
+ int8_t y = stdlib_base_int8_identity( 2 );
157
+ // returns 2
158
+ ```
159
+
160
+ The function accepts the following arguments:
161
+
162
+ - **x**: `[in] int8_t` input value.
163
+
164
+ ```c
165
+ int8_t stdlib_base_int8_identity( const int8_t x );
166
+ ```
167
+
168
+ </section>
169
+
170
+ <!-- /.usage -->
171
+
172
+ <!-- C API usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
173
+
174
+ <section class="notes">
175
+
176
+ </section>
177
+
178
+ <!-- /.notes -->
179
+
180
+ <!-- C API usage examples. -->
181
+
182
+ <section class="examples">
183
+
184
+ ### Examples
185
+
186
+ ```c
187
+ #include "stdlib/number/int8/base/identity.h"
188
+ #include <stdint.h>
189
+ #include <stdio.h>
190
+
191
+ int main( void ) {
192
+ const int8_t x[] = { 3, 5, 10, 12 };
193
+
194
+ int8_t y;
195
+ int i;
196
+ for ( i = 0; i < 4; i++ ) {
197
+ y = stdlib_base_int8_identity( x[ i ] );
198
+ printf( "f(%d) = %d\n", x[ i ], y );
199
+ }
200
+ }
201
+ ```
202
+
203
+ </section>
204
+
205
+ <!-- /.examples -->
206
+
207
+ </section>
208
+
209
+ <!-- /.c -->
210
+
211
+ <!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
212
+
213
+ <section class="related">
214
+
215
+ </section>
216
+
217
+ <!-- /.related -->
218
+
219
+ <!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
220
+
221
+
222
+ <section class="main-repo" >
223
+
224
+ * * *
225
+
226
+ ## Notice
227
+
228
+ This 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.
229
+
230
+ For 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].
231
+
232
+ #### Community
233
+
234
+ [![Chat][chat-image]][chat-url]
235
+
236
+ ---
237
+
238
+ ## License
239
+
240
+ See [LICENSE][stdlib-license].
241
+
242
+
243
+ ## Copyright
244
+
245
+ Copyright &copy; 2016-2026. The Stdlib [Authors][stdlib-authors].
246
+
247
+ </section>
248
+
249
+ <!-- /.stdlib -->
250
+
251
+ <!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
252
+
253
+ <section class="links">
254
+
255
+ [npm-image]: http://img.shields.io/npm/v/@stdlib/number-int8-base-identity.svg
256
+ [npm-url]: https://npmjs.org/package/@stdlib/number-int8-base-identity
257
+
258
+ [test-image]: https://github.com/stdlib-js/number-int8-base-identity/actions/workflows/test.yml/badge.svg?branch=v0.1.0
259
+ [test-url]: https://github.com/stdlib-js/number-int8-base-identity/actions/workflows/test.yml?query=branch:v0.1.0
260
+
261
+ [coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/number-int8-base-identity/main.svg
262
+ [coverage-url]: https://codecov.io/github/stdlib-js/number-int8-base-identity?branch=main
263
+
264
+ <!--
265
+
266
+ [dependencies-image]: https://img.shields.io/david/stdlib-js/number-int8-base-identity.svg
267
+ [dependencies-url]: https://david-dm.org/stdlib-js/number-int8-base-identity/main
268
+
269
+ -->
270
+
271
+ [chat-image]: https://img.shields.io/badge/zulip-join_chat-brightgreen.svg
272
+ [chat-url]: https://stdlib.zulipchat.com
273
+
274
+ [stdlib]: https://github.com/stdlib-js/stdlib
275
+
276
+ [stdlib-authors]: https://github.com/stdlib-js/stdlib/graphs/contributors
277
+
278
+ [umd]: https://github.com/umdjs/umd
279
+ [es-module]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules
280
+
281
+ [deno-url]: https://github.com/stdlib-js/number-int8-base-identity/tree/deno
282
+ [deno-readme]: https://github.com/stdlib-js/number-int8-base-identity/blob/deno/README.md
283
+ [umd-url]: https://github.com/stdlib-js/number-int8-base-identity/tree/umd
284
+ [umd-readme]: https://github.com/stdlib-js/number-int8-base-identity/blob/umd/README.md
285
+ [esm-url]: https://github.com/stdlib-js/number-int8-base-identity/tree/esm
286
+ [esm-readme]: https://github.com/stdlib-js/number-int8-base-identity/blob/esm/README.md
287
+ [branches-url]: https://github.com/stdlib-js/number-int8-base-identity/blob/main/branches.md
288
+
289
+ [stdlib-license]: https://raw.githubusercontent.com/stdlib-js/number-int8-base-identity/main/LICENSE
290
+
291
+ [identity-function]: https://en.wikipedia.org/wiki/Identity_function
292
+
293
+ <!-- <related-links> -->
294
+
295
+ <!-- </related-links> -->
296
+
297
+ </section>
298
+
299
+ <!-- /.links -->
package/SECURITY.md ADDED
@@ -0,0 +1,5 @@
1
+ # Security
2
+
3
+ > Policy for reporting security vulnerabilities.
4
+
5
+ See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security).
@@ -0,0 +1,3 @@
1
+ /// <reference path="../docs/types/index.d.ts" />
2
+ import identity from '../docs/types/index';
3
+ export = identity;
package/dist/index.js ADDED
@@ -0,0 +1,5 @@
1
+ "use strict";var s=function(r,t){return function(){return t||r((t={exports:{}}).exports,t),t.exports}};var i=s(function(o,e){
2
+ function n(r){return r}e.exports=n
3
+ });var u=i();module.exports=u;
4
+ /** @license Apache-2.0 */
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../lib/main.js", "../lib/index.js"],
4
+ "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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* Evaluates the identity function for a signed 8-bit integer `x`.\n*\n* @param {integer} x - input value\n* @returns {integer} input value\n*\n* @example\n* var v = identity( 1 );\n* // returns 1\n*\n* @example\n* var v = identity( 2 );\n* // returns 2\n*\n* @example\n* var v = identity( 0 );\n* // returns 0\n*\n* @example\n* var v = identity( 127 );\n* // returns 127\n*/\nfunction identity( x ) {\n\treturn x;\n}\n\n\n// EXPORTS //\n\nmodule.exports = identity;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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* Evaluate the identity function for a signed 8-bit integer.\n*\n* @module @stdlib/number-int8-base-identity\n*\n* @example\n* var identity = require( '@stdlib/number-int8-base-identity' );\n*\n* var v = identity( 1 );\n* // returns 1\n*\n* v = identity( 2 );\n* // returns 2\n*\n* v = identity( 0 );\n* // returns 0\n*\n* v = identity( 127 );\n* // returns 127\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"],
5
+ "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cA0CA,SAASC,EAAUC,EAAI,CACtB,OAAOA,CACR,CAKAF,EAAO,QAAUC,ICNjB,IAAIE,EAAO,IAKX,OAAO,QAAUA",
6
+ "names": ["require_main", "__commonJSMin", "exports", "module", "identity", "x", "main"]
7
+ }
@@ -0,0 +1,18 @@
1
+ <svg xmlns:xlink="http://www.w3.org/1999/xlink" width="8.846ex" height="2.843ex" style="vertical-align: -0.838ex;" viewBox="0 -863.1 3808.6 1223.9" role="img" focusable="false" xmlns="http://www.w3.org/2000/svg" aria-labelledby="MathJax-SVG-1-Title">
2
+ <title id="MathJax-SVG-1-Title">f left-parenthesis x right-parenthesis equals x</title>
3
+ <defs aria-hidden="true">
4
+ <path stroke-width="1" id="E1-MJMATHI-66" d="M118 -162Q120 -162 124 -164T135 -167T147 -168Q160 -168 171 -155T187 -126Q197 -99 221 27T267 267T289 382V385H242Q195 385 192 387Q188 390 188 397L195 425Q197 430 203 430T250 431Q298 431 298 432Q298 434 307 482T319 540Q356 705 465 705Q502 703 526 683T550 630Q550 594 529 578T487 561Q443 561 443 603Q443 622 454 636T478 657L487 662Q471 668 457 668Q445 668 434 658T419 630Q412 601 403 552T387 469T380 433Q380 431 435 431Q480 431 487 430T498 424Q499 420 496 407T491 391Q489 386 482 386T428 385H372L349 263Q301 15 282 -47Q255 -132 212 -173Q175 -205 139 -205Q107 -205 81 -186T55 -132Q55 -95 76 -78T118 -61Q162 -61 162 -103Q162 -122 151 -136T127 -157L118 -162Z"></path>
5
+ <path stroke-width="1" id="E1-MJMAIN-28" d="M94 250Q94 319 104 381T127 488T164 576T202 643T244 695T277 729T302 750H315H319Q333 750 333 741Q333 738 316 720T275 667T226 581T184 443T167 250T184 58T225 -81T274 -167T316 -220T333 -241Q333 -250 318 -250H315H302L274 -226Q180 -141 137 -14T94 250Z"></path>
6
+ <path stroke-width="1" id="E1-MJMATHI-78" d="M52 289Q59 331 106 386T222 442Q257 442 286 424T329 379Q371 442 430 442Q467 442 494 420T522 361Q522 332 508 314T481 292T458 288Q439 288 427 299T415 328Q415 374 465 391Q454 404 425 404Q412 404 406 402Q368 386 350 336Q290 115 290 78Q290 50 306 38T341 26Q378 26 414 59T463 140Q466 150 469 151T485 153H489Q504 153 504 145Q504 144 502 134Q486 77 440 33T333 -11Q263 -11 227 52Q186 -10 133 -10H127Q78 -10 57 16T35 71Q35 103 54 123T99 143Q142 143 142 101Q142 81 130 66T107 46T94 41L91 40Q91 39 97 36T113 29T132 26Q168 26 194 71Q203 87 217 139T245 247T261 313Q266 340 266 352Q266 380 251 392T217 404Q177 404 142 372T93 290Q91 281 88 280T72 278H58Q52 284 52 289Z"></path>
7
+ <path stroke-width="1" id="E1-MJMAIN-29" d="M60 749L64 750Q69 750 74 750H86L114 726Q208 641 251 514T294 250Q294 182 284 119T261 12T224 -76T186 -143T145 -194T113 -227T90 -246Q87 -249 86 -250H74Q66 -250 63 -250T58 -247T55 -238Q56 -237 66 -225Q221 -64 221 250T66 725Q56 737 55 738Q55 746 60 749Z"></path>
8
+ <path stroke-width="1" id="E1-MJMAIN-3D" d="M56 347Q56 360 70 367H707Q722 359 722 347Q722 336 708 328L390 327H72Q56 332 56 347ZM56 153Q56 168 72 173H708Q722 163 722 153Q722 140 707 133H70Q56 140 56 153Z"></path>
9
+ </defs>
10
+ <g stroke="currentColor" fill="currentColor" stroke-width="0" transform="matrix(1 0 0 -1 0 0)" aria-hidden="true">
11
+ <use xlink:href="#E1-MJMATHI-66" x="0" y="0"></use>
12
+ <use xlink:href="#E1-MJMAIN-28" x="550" y="0"></use>
13
+ <use xlink:href="#E1-MJMATHI-78" x="940" y="0"></use>
14
+ <use xlink:href="#E1-MJMAIN-29" x="1512" y="0"></use>
15
+ <use xlink:href="#E1-MJMAIN-3D" x="2179" y="0"></use>
16
+ <use xlink:href="#E1-MJMATHI-78" x="3236" y="0"></use>
17
+ </g>
18
+ </svg>
@@ -0,0 +1,48 @@
1
+ /*
2
+ * @license Apache-2.0
3
+ *
4
+ * Copyright (c) 2025 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: 4.1
20
+
21
+ /**
22
+ * Evaluates the identity function for a signed 8-bit integer `x`.
23
+ *
24
+ * @param x - input value
25
+ * @returns input value
26
+ *
27
+ * @example
28
+ * var v = identity( 1 );
29
+ * // returns 1
30
+ *
31
+ * @example
32
+ * var v = identity( 2 );
33
+ * // returns 2
34
+ *
35
+ * @example
36
+ * var v = identity( 0 );
37
+ * // returns 0
38
+ *
39
+ * @example
40
+ * var v = identity( 127 );
41
+ * // returns 127
42
+ */
43
+ declare function identity( x: number ): number;
44
+
45
+
46
+ // EXPORTS //
47
+
48
+ export = identity;
@@ -0,0 +1,40 @@
1
+ /**
2
+ * @license Apache-2.0
3
+ *
4
+ * Copyright (c) 2025 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
+ #ifndef STDLIB_NUMBER_INT8_BASE_IDENTITY_H
20
+ #define STDLIB_NUMBER_INT8_BASE_IDENTITY_H
21
+
22
+ #include <stdint.h>
23
+
24
+ /*
25
+ * If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler.
26
+ */
27
+ #ifdef __cplusplus
28
+ extern "C" {
29
+ #endif
30
+
31
+ /**
32
+ * Evaluates the identity function for a signed 8-bit integer.
33
+ */
34
+ int8_t stdlib_base_int8_identity( const int8_t x );
35
+
36
+ #ifdef __cplusplus
37
+ }
38
+ #endif
39
+
40
+ #endif // !STDLIB_NUMBER_INT8_BASE_IDENTITY_H
package/lib/index.js ADDED
@@ -0,0 +1,49 @@
1
+ /**
2
+ * @license Apache-2.0
3
+ *
4
+ * Copyright (c) 2025 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
+ 'use strict';
20
+
21
+ /**
22
+ * Evaluate the identity function for a signed 8-bit integer.
23
+ *
24
+ * @module @stdlib/number-int8-base-identity
25
+ *
26
+ * @example
27
+ * var identity = require( '@stdlib/number-int8-base-identity' );
28
+ *
29
+ * var v = identity( 1 );
30
+ * // returns 1
31
+ *
32
+ * v = identity( 2 );
33
+ * // returns 2
34
+ *
35
+ * v = identity( 0 );
36
+ * // returns 0
37
+ *
38
+ * v = identity( 127 );
39
+ * // returns 127
40
+ */
41
+
42
+ // MODULES //
43
+
44
+ var main = require( './main.js' );
45
+
46
+
47
+ // EXPORTS //
48
+
49
+ module.exports = main;
package/lib/main.js ADDED
@@ -0,0 +1,50 @@
1
+ /**
2
+ * @license Apache-2.0
3
+ *
4
+ * Copyright (c) 2025 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
+ 'use strict';
20
+
21
+ /**
22
+ * Evaluates the identity function for a signed 8-bit integer `x`.
23
+ *
24
+ * @param {integer} x - input value
25
+ * @returns {integer} input value
26
+ *
27
+ * @example
28
+ * var v = identity( 1 );
29
+ * // returns 1
30
+ *
31
+ * @example
32
+ * var v = identity( 2 );
33
+ * // returns 2
34
+ *
35
+ * @example
36
+ * var v = identity( 0 );
37
+ * // returns 0
38
+ *
39
+ * @example
40
+ * var v = identity( 127 );
41
+ * // returns 127
42
+ */
43
+ function identity( x ) {
44
+ return x;
45
+ }
46
+
47
+
48
+ // EXPORTS //
49
+
50
+ module.exports = identity;
package/lib/native.js ADDED
@@ -0,0 +1,58 @@
1
+ /**
2
+ * @license Apache-2.0
3
+ *
4
+ * Copyright (c) 2025 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
+ 'use strict';
20
+
21
+ // MODULES //
22
+
23
+ var addon = require( './../src/addon.node' );
24
+
25
+
26
+ // MAIN //
27
+
28
+ /**
29
+ * Evaluates the identity function for a signed 8-bit integer `x`.
30
+ *
31
+ * @private
32
+ * @param {integer} x - input value
33
+ * @returns {integer} input value
34
+ *
35
+ * @example
36
+ * var v = identity( 1 );
37
+ * // returns 1
38
+ *
39
+ * @example
40
+ * var v = identity( 2 );
41
+ * // returns 2
42
+ *
43
+ * @example
44
+ * var v = identity( 0 );
45
+ * // returns 0
46
+ *
47
+ * @example
48
+ * var v = identity( 127 );
49
+ * // returns 127
50
+ */
51
+ function identity( x ) {
52
+ return addon( x );
53
+ }
54
+
55
+
56
+ // EXPORTS //
57
+
58
+ module.exports = identity;
package/manifest.json ADDED
@@ -0,0 +1,67 @@
1
+ {
2
+ "options": {
3
+ "task": "build"
4
+ },
5
+ "fields": [
6
+ {
7
+ "field": "src",
8
+ "resolve": true,
9
+ "relative": true
10
+ },
11
+ {
12
+ "field": "include",
13
+ "resolve": true,
14
+ "relative": true
15
+ },
16
+ {
17
+ "field": "libraries",
18
+ "resolve": false,
19
+ "relative": false
20
+ },
21
+ {
22
+ "field": "libpath",
23
+ "resolve": true,
24
+ "relative": false
25
+ }
26
+ ],
27
+ "confs": [
28
+ {
29
+ "task": "build",
30
+ "src": [
31
+ "./src/main.c"
32
+ ],
33
+ "include": [
34
+ "./include"
35
+ ],
36
+ "libraries": [],
37
+ "libpath": [],
38
+ "dependencies": [
39
+ "@stdlib/math-base-napi-unary"
40
+ ]
41
+ },
42
+ {
43
+ "task": "benchmark",
44
+ "src": [
45
+ "./src/main.c"
46
+ ],
47
+ "include": [
48
+ "./include"
49
+ ],
50
+ "libraries": [],
51
+ "libpath": [],
52
+ "dependencies": []
53
+ },
54
+ {
55
+ "task": "examples",
56
+ "src": [
57
+ "./src/main.c"
58
+ ],
59
+ "include": [
60
+ "./include"
61
+ ],
62
+ "libraries": [],
63
+ "libpath": [],
64
+ "dependencies": []
65
+ }
66
+ ]
67
+ }
package/package.json ADDED
@@ -0,0 +1,70 @@
1
+ {
2
+ "name": "@stdlib/number-int8-base-identity",
3
+ "version": "0.1.0",
4
+ "description": "Evaluate the identity function for a signed 8-bit integer.",
5
+ "license": "Apache-2.0",
6
+ "author": {
7
+ "name": "The Stdlib Authors",
8
+ "url": "https://github.com/stdlib-js/stdlib/graphs/contributors"
9
+ },
10
+ "contributors": [
11
+ {
12
+ "name": "The Stdlib Authors",
13
+ "url": "https://github.com/stdlib-js/stdlib/graphs/contributors"
14
+ }
15
+ ],
16
+ "main": "./lib",
17
+ "gypfile": false,
18
+ "directories": {
19
+ "doc": "./docs",
20
+ "include": "./include",
21
+ "lib": "./lib",
22
+ "src": "./src",
23
+ "dist": "./dist"
24
+ },
25
+ "types": "./docs/types",
26
+ "scripts": {},
27
+ "homepage": "https://stdlib.io",
28
+ "repository": {
29
+ "type": "git",
30
+ "url": "git://github.com/stdlib-js/number-int8-base-identity.git"
31
+ },
32
+ "bugs": {
33
+ "url": "https://github.com/stdlib-js/stdlib/issues"
34
+ },
35
+ "dependencies": {
36
+ "@stdlib/math-base-napi-unary": "^0.2.3",
37
+ "@stdlib/utils-library-manifest": "^0.2.2"
38
+ },
39
+ "devDependencies": {},
40
+ "engines": {
41
+ "node": ">=0.10.0",
42
+ "npm": ">2.7.0"
43
+ },
44
+ "os": [
45
+ "aix",
46
+ "darwin",
47
+ "freebsd",
48
+ "linux",
49
+ "macos",
50
+ "openbsd",
51
+ "sunos",
52
+ "win32",
53
+ "windows"
54
+ ],
55
+ "keywords": [
56
+ "stdlib",
57
+ "stdmath",
58
+ "mathematics",
59
+ "math",
60
+ "identity",
61
+ "signed",
62
+ "int8",
63
+ "integer"
64
+ ],
65
+ "__stdlib__": {},
66
+ "funding": {
67
+ "type": "opencollective",
68
+ "url": "https://opencollective.com/stdlib"
69
+ }
70
+ }
package/src/addon.c ADDED
@@ -0,0 +1,22 @@
1
+ /**
2
+ * @license Apache-2.0
3
+ *
4
+ * Copyright (c) 2025 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
+ #include "stdlib/number/int8/base/identity.h"
20
+ #include "stdlib/math/base/napi/unary.h"
21
+
22
+ STDLIB_MATH_BASE_NAPI_MODULE_S_S( stdlib_base_int8_identity )
package/src/main.c ADDED
@@ -0,0 +1,36 @@
1
+ /**
2
+ * @license Apache-2.0
3
+ *
4
+ * Copyright (c) 2025 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
+ #include "stdlib/number/int8/base/identity.h"
20
+ #include <stdint.h>
21
+
22
+ /**
23
+ * Evaluates the identity function for a signed 8-bit integer.
24
+ *
25
+ * @param x number
26
+ * @return input value
27
+ *
28
+ * @example
29
+ * #include <stdint.h>
30
+ *
31
+ * int8_t y = stdlib_base_int8_identity( 3 );
32
+ * // returns 3
33
+ */
34
+ int8_t stdlib_base_int8_identity( const int8_t x ) {
35
+ return x;
36
+ }