@stdlib/array-base-accessor-setter 0.2.0 → 0.2.2

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/README.md CHANGED
@@ -69,9 +69,9 @@ Returns an accessor function for setting an element in an array-like object supp
69
69
 
70
70
  ```javascript
71
71
  var Complex64Array = require( '@stdlib/array-complex64' );
72
- var Complex64 = require( '@stdlib/complex-float32' );
73
- var realf = require( '@stdlib/complex-realf' );
74
- var imagf = require( '@stdlib/complex-imagf' );
72
+ var Complex64 = require( '@stdlib/complex-float32-ctor' );
73
+ var realf = require( '@stdlib/complex-float32-real' );
74
+ var imagf = require( '@stdlib/complex-float32-imag' );
75
75
 
76
76
  var arr = new Complex64Array( [ 1, 2, 3, 4 ] );
77
77
 
@@ -126,8 +126,8 @@ The returned accessor function accepts the following arguments:
126
126
  ```javascript
127
127
  var Complex128Array = require( '@stdlib/array-complex128' );
128
128
  var Complex64Array = require( '@stdlib/array-complex64' );
129
- var Complex128 = require( '@stdlib/complex-float64' );
130
- var Complex64 = require( '@stdlib/complex-float32' );
129
+ var Complex128 = require( '@stdlib/complex-float64-ctor' );
130
+ var Complex64 = require( '@stdlib/complex-float32-ctor' );
131
131
  var zeroTo = require( '@stdlib/array-base-zero-to' );
132
132
  var dtype = require( '@stdlib/array-dtype' );
133
133
  var accessorSetter = require( '@stdlib/array-base-accessor-setter' );
@@ -210,8 +210,8 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors].
210
210
  [npm-image]: http://img.shields.io/npm/v/@stdlib/array-base-accessor-setter.svg
211
211
  [npm-url]: https://npmjs.org/package/@stdlib/array-base-accessor-setter
212
212
 
213
- [test-image]: https://github.com/stdlib-js/array-base-accessor-setter/actions/workflows/test.yml/badge.svg?branch=v0.2.0
214
- [test-url]: https://github.com/stdlib-js/array-base-accessor-setter/actions/workflows/test.yml?query=branch:v0.2.0
213
+ [test-image]: https://github.com/stdlib-js/array-base-accessor-setter/actions/workflows/test.yml/badge.svg?branch=v0.2.2
214
+ [test-url]: https://github.com/stdlib-js/array-base-accessor-setter/actions/workflows/test.yml?query=branch:v0.2.2
215
215
 
216
216
  [coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/array-base-accessor-setter/main.svg
217
217
  [coverage-url]: https://codecov.io/github/stdlib-js/array-base-accessor-setter?branch=main
package/dist/index.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../lib/main.js", "../lib/index.js"],
4
- "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// VARIABLES //\n\nvar SETTERS = {\n\t'complex128': setComplex128,\n\t'complex64': setComplex64,\n\t'default': setArrayLike\n};\n\n\n// FUNCTIONS //\n\n/**\n* Sets an element in a `Complex128Array`.\n*\n* @private\n* @param {Complex128Array} arr - input array\n* @param {NonNegativeInteger} idx - element index\n* @param {(Collection|Complex|ComplexArray)} value - value(s)\n*\n* @example\n* var Complex128Array = require( '@stdlib/array-complex128' );\n* var Complex128 = require( '@stdlib/complex-float64' );\n* var real = require( '@stdlib/complex-real' );\n* var imag = require( '@stdlib/complex-imag' );\n*\n* var arr = new Complex128Array( [ 1, 2, 3, 4 ] );\n*\n* setComplex128( arr, 1, new Complex128( 10.0, 11.0 ) );\n* var v = arr.get( 1 );\n* // returns <Complex128>\n*\n* var re = real( v );\n* // returns 10.0\n*\n* var im = imag( v );\n* // returns 11.0\n*/\nfunction setComplex128( arr, idx, value ) {\n\tarr.set( value, idx );\n}\n\n/**\n* Sets an element in a `Complex64Array`.\n*\n* @private\n* @param {Complex64Array} arr - input array\n* @param {NonNegativeInteger} idx - element index\n* @param {(Collection|Complex|ComplexArray)} value - value(s)\n*\n* @example\n* var Complex64Array = require( '@stdlib/array-complex64' );\n* var Complex64 = require( '@stdlib/complex-float32' );\n* var realf = require( '@stdlib/complex-realf' );\n* var imagf = require( '@stdlib/complex-imagf' );\n*\n* var arr = new Complex64Array( [ 1, 2, 3, 4 ] );\n*\n* setComplex64( arr, 1, new Complex64( 10.0, 11.0 ) );\n* var v = arr.get( 1 );\n* // returns <Complex64>\n*\n* var re = realf( v );\n* // returns 10.0\n*\n* var im = imagf( v );\n* // returns 11.0\n*/\nfunction setComplex64( arr, idx, value ) {\n\tarr.set( value, idx );\n}\n\n/**\n* Sets an element in an array-like object supporting the get/set protocol.\n*\n* @private\n* @param {Collection} arr - input array\n* @param {NonNegativeInteger} idx - element index\n* @param {(Collection|Complex|ComplexArray)} value - value(s)\n*\n* @example\n* var arr = [ 1, 2, 3, 4 ];\n*\n* function get( idx ) {\n* return arr[ idx ];\n* }\n*\n* function set( value, idx ) {\n* arr[ idx ] = value;\n* }\n*\n* arr.get = get;\n* arr.set = set;\n*\n* setArrayLike( arr, 2, 10 );\n*\n* var v = arr[ 2 ];\n* // returns 10\n*/\nfunction setArrayLike( arr, idx, value ) {\n\tarr.set( value, idx );\n}\n\n\n// MAIN //\n\n/**\n* Returns an accessor function for setting an element in an array-like object supporting the get/set protocol.\n*\n* @param {string} dtype - array dtype\n* @returns {Function} accessor\n*\n* @example\n* var Complex64Array = require( '@stdlib/array-complex64' );\n* var Complex64 = require( '@stdlib/complex-float32' );\n* var realf = require( '@stdlib/complex-realf' );\n* var imagf = require( '@stdlib/complex-imagf' );\n* var dtype = require( '@stdlib/array-dtype' );\n*\n* var arr = new Complex64Array( [ 1, 2, 3, 4 ] );\n*\n* var set = setter( dtype( arr ) );\n* set( arr, 1, new Complex64( 10.0, 11.0 ) );\n*\n* var v = arr.get( 1 );\n* // returns <Complex64>\n*\n* var re = realf( v );\n* // returns 10.0\n*\n* var im = imagf( v );\n* // returns 11.0\n*/\nfunction setter( dtype ) {\n\tvar f = SETTERS[ dtype ];\n\tif ( typeof f === 'function' ) {\n\t\treturn f;\n\t}\n\treturn SETTERS.default;\n}\n\n\n// EXPORTS //\n\nmodule.exports = setter;\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* Return an accessor function for setting an element in an array-like object supporting the get/set protocol.\n*\n* @module @stdlib/array-base-accessor-setter\n*\n* @example\n* var Complex64Array = require( '@stdlib/array-complex64' );\n* var Complex64 = require( '@stdlib/complex-float32' );\n* var realf = require( '@stdlib/complex-realf' );\n* var imagf = require( '@stdlib/complex-imagf' );\n* var dtype = require( '@stdlib/array-dtype' );\n* var setter = require( '@stdlib/array-base-accessor-setter' );\n*\n* var arr = new Complex64Array( [ 1, 2, 3, 4 ] );\n*\n* var set = setter( dtype( arr ) );\n* set( arr, 1, new Complex64( 10.0, 11.0 ) );\n*\n* var v = arr.get( 1 );\n* // returns <Complex64>\n*\n* var re = realf( v );\n* // returns 10.0\n*\n* var im = imagf( v );\n* // returns 11.0\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"],
4
+ "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// VARIABLES //\n\nvar SETTERS = {\n\t'complex128': setComplex128,\n\t'complex64': setComplex64,\n\t'default': setArrayLike\n};\n\n\n// FUNCTIONS //\n\n/**\n* Sets an element in a `Complex128Array`.\n*\n* @private\n* @param {Complex128Array} arr - input array\n* @param {NonNegativeInteger} idx - element index\n* @param {(Collection|Complex|ComplexArray)} value - value(s)\n*\n* @example\n* var Complex128Array = require( '@stdlib/array-complex128' );\n* var Complex128 = require( '@stdlib/complex-float64-ctor' );\n* var real = require( '@stdlib/complex-float64-real' );\n* var imag = require( '@stdlib/complex-float64-imag' );\n*\n* var arr = new Complex128Array( [ 1, 2, 3, 4 ] );\n*\n* setComplex128( arr, 1, new Complex128( 10.0, 11.0 ) );\n* var v = arr.get( 1 );\n* // returns <Complex128>\n*\n* var re = real( v );\n* // returns 10.0\n*\n* var im = imag( v );\n* // returns 11.0\n*/\nfunction setComplex128( arr, idx, value ) {\n\tarr.set( value, idx );\n}\n\n/**\n* Sets an element in a `Complex64Array`.\n*\n* @private\n* @param {Complex64Array} arr - input array\n* @param {NonNegativeInteger} idx - element index\n* @param {(Collection|Complex|ComplexArray)} value - value(s)\n*\n* @example\n* var Complex64Array = require( '@stdlib/array-complex64' );\n* var Complex64 = require( '@stdlib/complex-float32-ctor' );\n* var realf = require( '@stdlib/complex-float32-real' );\n* var imagf = require( '@stdlib/complex-float32-imag' );\n*\n* var arr = new Complex64Array( [ 1, 2, 3, 4 ] );\n*\n* setComplex64( arr, 1, new Complex64( 10.0, 11.0 ) );\n* var v = arr.get( 1 );\n* // returns <Complex64>\n*\n* var re = realf( v );\n* // returns 10.0\n*\n* var im = imagf( v );\n* // returns 11.0\n*/\nfunction setComplex64( arr, idx, value ) {\n\tarr.set( value, idx );\n}\n\n/**\n* Sets an element in an array-like object supporting the get/set protocol.\n*\n* @private\n* @param {Collection} arr - input array\n* @param {NonNegativeInteger} idx - element index\n* @param {(Collection|Complex|ComplexArray)} value - value(s)\n*\n* @example\n* var arr = [ 1, 2, 3, 4 ];\n*\n* function get( idx ) {\n* return arr[ idx ];\n* }\n*\n* function set( value, idx ) {\n* arr[ idx ] = value;\n* }\n*\n* arr.get = get;\n* arr.set = set;\n*\n* setArrayLike( arr, 2, 10 );\n*\n* var v = arr[ 2 ];\n* // returns 10\n*/\nfunction setArrayLike( arr, idx, value ) {\n\tarr.set( value, idx );\n}\n\n\n// MAIN //\n\n/**\n* Returns an accessor function for setting an element in an array-like object supporting the get/set protocol.\n*\n* @param {string} dtype - array dtype\n* @returns {Function} accessor\n*\n* @example\n* var Complex64Array = require( '@stdlib/array-complex64' );\n* var Complex64 = require( '@stdlib/complex-float32-ctor' );\n* var realf = require( '@stdlib/complex-float32-real' );\n* var imagf = require( '@stdlib/complex-float32-imag' );\n* var dtype = require( '@stdlib/array-dtype' );\n*\n* var arr = new Complex64Array( [ 1, 2, 3, 4 ] );\n*\n* var set = setter( dtype( arr ) );\n* set( arr, 1, new Complex64( 10.0, 11.0 ) );\n*\n* var v = arr.get( 1 );\n* // returns <Complex64>\n*\n* var re = realf( v );\n* // returns 10.0\n*\n* var im = imagf( v );\n* // returns 11.0\n*/\nfunction setter( dtype ) {\n\tvar f = SETTERS[ dtype ];\n\tif ( typeof f === 'function' ) {\n\t\treturn f;\n\t}\n\treturn SETTERS.default;\n}\n\n\n// EXPORTS //\n\nmodule.exports = setter;\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* Return an accessor function for setting an element in an array-like object supporting the get/set protocol.\n*\n* @module @stdlib/array-base-accessor-setter\n*\n* @example\n* var Complex64Array = require( '@stdlib/array-complex64' );\n* var Complex64 = require( '@stdlib/complex-float32-ctor' );\n* var realf = require( '@stdlib/complex-float32-real' );\n* var imagf = require( '@stdlib/complex-float32-imag' );\n* var dtype = require( '@stdlib/array-dtype' );\n* var setter = require( '@stdlib/array-base-accessor-setter' );\n*\n* var arr = new Complex64Array( [ 1, 2, 3, 4 ] );\n*\n* var set = setter( dtype( arr ) );\n* set( arr, 1, new Complex64( 10.0, 11.0 ) );\n*\n* var v = arr.get( 1 );\n* // returns <Complex64>\n*\n* var re = realf( v );\n* // returns 10.0\n*\n* var im = imagf( v );\n* // returns 11.0\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"],
5
5
  "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAU,CACb,WAAcC,EACd,UAAaC,EACb,QAAWC,CACZ,EA+BA,SAASF,EAAeG,EAAKC,EAAKC,EAAQ,CACzCF,EAAI,IAAKE,EAAOD,CAAI,CACrB,CA4BA,SAASH,EAAcE,EAAKC,EAAKC,EAAQ,CACxCF,EAAI,IAAKE,EAAOD,CAAI,CACrB,CA6BA,SAASF,EAAcC,EAAKC,EAAKC,EAAQ,CACxCF,EAAI,IAAKE,EAAOD,CAAI,CACrB,CAgCA,SAASE,EAAQC,EAAQ,CACxB,IAAIC,EAAIT,EAASQ,CAAM,EACvB,OAAK,OAAOC,GAAM,WACVA,EAEDT,EAAQ,OAChB,CAKAD,EAAO,QAAUQ,ICjHjB,IAAIG,EAAO,IAKX,OAAO,QAAUA",
6
6
  "names": ["require_main", "__commonJSMin", "exports", "module", "SETTERS", "setComplex128", "setComplex64", "setArrayLike", "arr", "idx", "value", "setter", "dtype", "f", "main"]
7
7
  }
@@ -58,7 +58,7 @@ type SetArrayLike<T> = ( arr: AccessorArrayLike<T>, idx: number, value: T ) => v
58
58
  *
59
59
  * @example
60
60
  * var Complex128Array = require( '@stdlib/array-complex128' );
61
- * var Complex128 = require( '@stdlib/complex-float64' );
61
+ * var Complex128 = require( '@stdlib/complex-float64-ctor' );
62
62
  * var real = require( '@stdlib/array-real' );
63
63
  * var imag = require( '@stdlib/array-imag' );
64
64
  *
@@ -86,7 +86,7 @@ declare function setter( dtype: 'complex128' ): SetComplex128;
86
86
  *
87
87
  * @example
88
88
  * var Complex64Array = require( '@stdlib/array-complex64' );
89
- * var Complex64 = require( '@stdlib/complex-float32' );
89
+ * var Complex64 = require( '@stdlib/complex-float32-ctor' );
90
90
  * var realf = require( '@stdlib/array-realf' );
91
91
  * var imagf = require( '@stdlib/array-imagf' );
92
92
  *
package/lib/index.js CHANGED
@@ -25,9 +25,9 @@
25
25
  *
26
26
  * @example
27
27
  * var Complex64Array = require( '@stdlib/array-complex64' );
28
- * var Complex64 = require( '@stdlib/complex-float32' );
29
- * var realf = require( '@stdlib/complex-realf' );
30
- * var imagf = require( '@stdlib/complex-imagf' );
28
+ * var Complex64 = require( '@stdlib/complex-float32-ctor' );
29
+ * var realf = require( '@stdlib/complex-float32-real' );
30
+ * var imagf = require( '@stdlib/complex-float32-imag' );
31
31
  * var dtype = require( '@stdlib/array-dtype' );
32
32
  * var setter = require( '@stdlib/array-base-accessor-setter' );
33
33
  *
package/lib/main.js CHANGED
@@ -39,9 +39,9 @@ var SETTERS = {
39
39
  *
40
40
  * @example
41
41
  * var Complex128Array = require( '@stdlib/array-complex128' );
42
- * var Complex128 = require( '@stdlib/complex-float64' );
43
- * var real = require( '@stdlib/complex-real' );
44
- * var imag = require( '@stdlib/complex-imag' );
42
+ * var Complex128 = require( '@stdlib/complex-float64-ctor' );
43
+ * var real = require( '@stdlib/complex-float64-real' );
44
+ * var imag = require( '@stdlib/complex-float64-imag' );
45
45
  *
46
46
  * var arr = new Complex128Array( [ 1, 2, 3, 4 ] );
47
47
  *
@@ -69,9 +69,9 @@ function setComplex128( arr, idx, value ) {
69
69
  *
70
70
  * @example
71
71
  * var Complex64Array = require( '@stdlib/array-complex64' );
72
- * var Complex64 = require( '@stdlib/complex-float32' );
73
- * var realf = require( '@stdlib/complex-realf' );
74
- * var imagf = require( '@stdlib/complex-imagf' );
72
+ * var Complex64 = require( '@stdlib/complex-float32-ctor' );
73
+ * var realf = require( '@stdlib/complex-float32-real' );
74
+ * var imagf = require( '@stdlib/complex-float32-imag' );
75
75
  *
76
76
  * var arr = new Complex64Array( [ 1, 2, 3, 4 ] );
77
77
  *
@@ -131,9 +131,9 @@ function setArrayLike( arr, idx, value ) {
131
131
  *
132
132
  * @example
133
133
  * var Complex64Array = require( '@stdlib/array-complex64' );
134
- * var Complex64 = require( '@stdlib/complex-float32' );
135
- * var realf = require( '@stdlib/complex-realf' );
136
- * var imagf = require( '@stdlib/complex-imagf' );
134
+ * var Complex64 = require( '@stdlib/complex-float32-ctor' );
135
+ * var realf = require( '@stdlib/complex-float32-real' );
136
+ * var imagf = require( '@stdlib/complex-float32-imag' );
137
137
  * var dtype = require( '@stdlib/array-dtype' );
138
138
  *
139
139
  * var arr = new Complex64Array( [ 1, 2, 3, 4 ] );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stdlib/array-base-accessor-setter",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "Return an accessor function for setting an element in an array-like object supporting the get/set protocol.",
5
5
  "license": "Apache-2.0",
6
6
  "author": {
@@ -15,19 +15,12 @@
15
15
  ],
16
16
  "main": "./lib",
17
17
  "directories": {
18
- "benchmark": "./benchmark",
19
18
  "doc": "./docs",
20
- "example": "./examples",
21
19
  "lib": "./lib",
22
- "test": "./test"
20
+ "dist": "./dist"
23
21
  },
24
22
  "types": "./docs/types",
25
- "scripts": {
26
- "test": "make test",
27
- "test-cov": "make test-cov",
28
- "examples": "make examples",
29
- "benchmark": "make benchmark"
30
- },
23
+ "scripts": {},
31
24
  "homepage": "https://stdlib.io",
32
25
  "repository": {
33
26
  "type": "git",
@@ -36,31 +29,8 @@
36
29
  "bugs": {
37
30
  "url": "https://github.com/stdlib-js/stdlib/issues"
38
31
  },
39
- "dependencies": {
40
- "@stdlib/types": "^0.3.1"
41
- },
42
- "devDependencies": {
43
- "@stdlib/array-base-zero-to": "^0.1.0",
44
- "@stdlib/array-complex128": "^0.1.0",
45
- "@stdlib/array-complex64": "^0.1.0",
46
- "@stdlib/array-dtype": "^0.1.0",
47
- "@stdlib/array-filled-by": "^0.1.0",
48
- "@stdlib/assert-is-function": "^0.2.0",
49
- "@stdlib/complex-float32": "^0.2.0",
50
- "@stdlib/complex-float64": "^0.2.0",
51
- "@stdlib/complex-imag": "^0.2.0",
52
- "@stdlib/complex-imagf": "^0.2.0",
53
- "@stdlib/complex-real": "^0.2.0",
54
- "@stdlib/complex-realf": "^0.2.0",
55
- "@stdlib/math-base-assert-is-nan": "^0.2.0",
56
- "@stdlib/math-base-assert-is-nanf": "^0.2.0",
57
- "@stdlib/random-base-discrete-uniform": "^0.1.0",
58
- "tape": "git+https://github.com/kgryte/tape.git#fix/globby",
59
- "istanbul": "^0.4.1",
60
- "tap-min": "git+https://github.com/Planeshifter/tap-min.git",
61
- "@stdlib/bench-harness": "^0.2.0",
62
- "@stdlib/bench": "^0.3.1"
63
- },
32
+ "dependencies": {},
33
+ "devDependencies": {},
64
34
  "engines": {
65
35
  "node": ">=0.10.0",
66
36
  "npm": ">2.7.0"