@stdlib/math-tools-unary 0.2.1 → 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.
Files changed (3) hide show
  1. package/README.md +2 -2
  2. package/dist/index.js +18 -14
  3. package/package.json +20 -20
package/README.md CHANGED
@@ -382,8 +382,8 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors].
382
382
  [npm-image]: http://img.shields.io/npm/v/@stdlib/math-tools-unary.svg
383
383
  [npm-url]: https://npmjs.org/package/@stdlib/math-tools-unary
384
384
 
385
- [test-image]: https://github.com/stdlib-js/math-tools-unary/actions/workflows/test.yml/badge.svg?branch=v0.2.1
386
- [test-url]: https://github.com/stdlib-js/math-tools-unary/actions/workflows/test.yml?query=branch:v0.2.1
385
+ [test-image]: https://github.com/stdlib-js/math-tools-unary/actions/workflows/test.yml/badge.svg?branch=v0.2.2
386
+ [test-url]: https://github.com/stdlib-js/math-tools-unary/actions/workflows/test.yml?query=branch:v0.2.2
387
387
 
388
388
  [coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/math-tools-unary/main.svg
389
389
  [coverage-url]: https://codecov.io/github/stdlib-js/math-tools-unary?branch=main
package/dist/index.js CHANGED
@@ -1,15 +1,19 @@
1
- "use strict";var v=function(r,e){return function(){return e||r((e={exports:{}}).exports,e),e.exports}};var b=v(function(Pr,w){
2
- var h=require('@stdlib/ndarray-ctor/dist'),q=require('@stdlib/ndarray-base-buffer/dist'),B=require('@stdlib/ndarray-base-shape2strides/dist'),G=require('@stdlib/ndarray-base-numel/dist'),H=require('@stdlib/array-base-copy-indexed/dist');function J(r,e,u,n){var t,i,d;return t=H(e.shape),t.length===0?(i=q(u,1),d=h(u,i,[],[0],0,n)):(i=q(u,e.length||G(t)),d=h(u,i,t,B(t,n),0,n)),r(e,d),d}w.exports=J
3
- });var T=v(function(jr,E){
4
- var Q=require('@stdlib/error-tools-fmtprodmsg/dist');function W(r,e){switch(e){case"same":return r;case"floating-point":return r==="float64"||r==="float32"||r==="generic"||r==="complex128"||r==="complex64"?r:"float64";case"real floating-point":return r==="float64"||r==="float32"||r==="generic"?r:"float64";case"complex floating-point":return r==="complex128"||r==="complex64"?r:"complex128";default:throw new Error(Q('0gz4W',e))}}E.exports=W
5
- });var O=v(function(_r,X){X.exports={output_dtype_policy:"floating-point"}});var _=v(function(kr,j){
6
- var Z=require('@stdlib/assert-is-plain-object/dist'),$=require('@stdlib/assert-has-own-property/dist'),x=require('@stdlib/assert-is-function/dist'),rr=require('@stdlib/assert-is-null/dist'),er=require('@stdlib/utils-keys/dist'),P=require('@stdlib/error-tools-fmtprodmsg/dist');function ar(r,e){var u,n,t,i;if(!Z(e))return new TypeError(P('0gz4Z',e));for(u=er(r),i=0;i<u.length;i++)if(t=u[i],$(e,t)){if(n=e[t],!x(n)&&!rr(n))return new TypeError(P('0gz4a',t,n));r[t]=n}return null}j.exports=ar
7
- });var k=v(function(Rr,ir){ir.exports=["same","floating-point","real floating-point","complex floating-point"]});var z=v(function(Vr,V){
8
- var nr=require('@stdlib/assert-is-plain-object/dist'),tr=require('@stdlib/assert-has-own-property/dist'),ur=require('@stdlib/assert-contains/dist'),R=require('@stdlib/error-tools-fmtprodmsg/dist'),or=k();function lr(r,e){return nr(e)?tr(e,"output_dtype_policy")&&(r.policy=e.output_dtype_policy,!ur(or,r.policy))?new TypeError(R('0gz4Y',"output_dtype_policy",r.policy)):null:new TypeError(R('0gz2V',e));}V.exports=lr
9
- });var L=v(function(zr,S){
10
- var sr=require('@stdlib/assert-is-plain-object/dist'),C=require('@stdlib/assert-has-own-property/dist'),I=require('@stdlib/assert-contains/dist'),pr=require('@stdlib/ndarray-orders/dist'),vr=require('@stdlib/ndarray-dtypes/dist'),c=require('@stdlib/error-tools-fmtprodmsg/dist'),dr=pr(),fr=vr();function cr(r,e){return sr(e)?C(e,"dtype")&&(r.dtype=e.dtype,!I(fr,r.dtype))?new TypeError(c('0gz4X',"dtype",r.dtype)):C(e,"order")&&(r.order=e.order,!I(dr,r.order))?new TypeError(c('0gz4X',"order",r.order)):null:new TypeError(c('0gz2V',e));}S.exports=cr
11
- });var Y=v(function(Cr,U){
12
- var mr=require('@stdlib/utils-define-nonenumerable-read-only-property/dist'),D=require('@stdlib/assert-is-number/dist').isPrimitive,M=require('@stdlib/assert-is-complex-like/dist'),m=require('@stdlib/assert-is-ndarray-like/dist'),g=require('@stdlib/assert-is-collection/dist'),y=require('@stdlib/ndarray-base-buffer-dtype/dist'),gr=require('@stdlib/ndarray-base-buffer/dist'),N=require('@stdlib/ndarray-base-broadcast-array/dist'),F=require('@stdlib/error-tools-fmtprodmsg/dist'),yr=b(),K=T(),hr=O(),qr=_(),wr=z(),br=L();function Er(r,e){var u,n,t,i;if(i={number:null,complex:null,array:null,ndarray:null},n=qr(i,r),n||(u={policy:hr.output_dtype_policy},arguments.length>1&&(n=wr(u,e),n)))throw n;return t=d,mr(t,"assign",A),t;function d(a){var o,s,l,p,f;if(D(a)){if(i.number)return i.number(a);throw new TypeError(F('0gz0O'))}if(M(a)){if(i.complex)return i.complex(a);throw new TypeError(F('0gz0P'))}if(l={},arguments.length>1&&(p=br(l,arguments[1]),p))throw p;if(m(a)){if(i.ndarray===null)throw new TypeError(F('0gz0Q'));return s=l.dtype||K(a.dtype,u.policy),yr(i.ndarray,a,s,l.order||a.order)}if(g(a)){if(i.array===null)throw new TypeError(F('0gz0R'));return o=y(a)||"generic",s=l.dtype||K(o,u.policy),f=gr(s,a.length),i.array(a.length,o,a,1,s,f,1),f}throw new TypeError(F('0gz4V',a))}function A(a,o){var s,l,p;if(m(a)){if(m(o)){if(s=a.shape,l=o.shape,s.length===l.length){for(p=0;p<s.length;p++)if(s[p]!==l[p]){a=N(a,l);break}}else a=N(a,l);return i.ndarray(a,o),o}throw new TypeError(F('0gz0S'))}if(g(a)){if(g(o)){if(o.length!==a.length)throw new RangeError(F('0gz0T'));return i.array(a.length,y(a)||"generic",a,1,y(o)||"generic",o,1),o}throw new TypeError(F('0gz0U'))}throw D(a)?new TypeError(F('0gz0V')):M(a)?new TypeError(F('0gz0W')):new TypeError(F('0gz4V',a))}}U.exports=Er
13
- });var Tr=Y();module.exports=Tr;
14
- /** @license Apache-2.0 */
1
+ "use strict";var v=function(r,e){return function(){return e||r((e={exports:{}}).exports,e),e.exports}};var b=v(function(Pr,w){"use strict";var h=require("@stdlib/ndarray-ctor"),q=require("@stdlib/ndarray-base-buffer"),B=require("@stdlib/ndarray-base-shape2strides"),G=require("@stdlib/ndarray-base-numel"),H=require("@stdlib/array-base-copy-indexed");function J(r,e,u,n){var t,i,d;return t=H(e.shape),t.length===0?(i=q(u,1),d=h(u,i,[],[0],0,n)):(i=q(u,e.length||G(t)),d=h(u,i,t,B(t,n),0,n)),r(e,d),d}w.exports=J});var T=v(function(jr,E){"use strict";var Q=require("@stdlib/string-format");function W(r,e){switch(e){case"same":return r;case"floating-point":return r==="float64"||r==="float32"||r==="generic"||r==="complex128"||r==="complex64"?r:"float64";case"real floating-point":return r==="float64"||r==="float32"||r==="generic"?r:"float64";case"complex floating-point":return r==="complex128"||r==="complex64"?r:"complex128";default:throw new Error(Q("invalid option. Unsupported policy for determining an output array data type. Option: `%s`.",e))}}E.exports=W});var O=v(function(_r,X){X.exports={output_dtype_policy:"floating-point"}});var _=v(function(kr,j){"use strict";var Z=require("@stdlib/assert-is-plain-object"),$=require("@stdlib/assert-has-own-property"),x=require("@stdlib/assert-is-function"),rr=require("@stdlib/assert-is-null"),er=require("@stdlib/utils-keys"),P=require("@stdlib/string-format");function ar(r,e){var u,n,t,i;if(!Z(e))return new TypeError(P("invalid argument. Resolution table must be an object. Value: `%s`.",e));for(u=er(r),i=0;i<u.length;i++)if(t=u[i],$(e,t)){if(n=e[t],!x(n)&&!rr(n))return new TypeError(P("invalid argument. Resolution table `%s` field value must be either a function or null. Value: `%s`.",t,n));r[t]=n}return null}j.exports=ar});var k=v(function(Rr,ir){ir.exports=["same","floating-point","real floating-point","complex floating-point"]});var z=v(function(Vr,V){"use strict";var nr=require("@stdlib/assert-is-plain-object"),tr=require("@stdlib/assert-has-own-property"),ur=require("@stdlib/assert-contains"),R=require("@stdlib/string-format"),or=k();function lr(r,e){return nr(e)?tr(e,"output_dtype_policy")&&(r.policy=e.output_dtype_policy,!ur(or,r.policy))?new TypeError(R("invalid option. `%s` option must be a recognized/supported output array data type policy. Option: `%s`.","output_dtype_policy",r.policy)):null:new TypeError(R("invalid argument. Options argument must be an object. Value: `%s`.",e))}V.exports=lr});var L=v(function(zr,S){"use strict";var sr=require("@stdlib/assert-is-plain-object"),C=require("@stdlib/assert-has-own-property"),I=require("@stdlib/assert-contains"),pr=require("@stdlib/ndarray-orders"),vr=require("@stdlib/ndarray-dtypes"),c=require("@stdlib/string-format"),dr=pr(),fr=vr();function cr(r,e){return sr(e)?C(e,"dtype")&&(r.dtype=e.dtype,!I(fr,r.dtype))?new TypeError(c("invalid option. `%s` option must be a recognized/supported data type. Option: `%s`.","dtype",r.dtype)):C(e,"order")&&(r.order=e.order,!I(dr,r.order))?new TypeError(c("invalid option. `%s` option must be a recognized/supported data type. Option: `%s`.","order",r.order)):null:new TypeError(c("invalid argument. Options argument must be an object. Value: `%s`.",e))}S.exports=cr});var Y=v(function(Cr,U){"use strict";var mr=require("@stdlib/utils-define-nonenumerable-read-only-property"),D=require("@stdlib/assert-is-number").isPrimitive,M=require("@stdlib/assert-is-complex-like"),m=require("@stdlib/assert-is-ndarray-like"),g=require("@stdlib/assert-is-collection"),y=require("@stdlib/ndarray-base-buffer-dtype"),gr=require("@stdlib/ndarray-base-buffer"),N=require("@stdlib/ndarray-base-broadcast-array"),F=require("@stdlib/string-format"),yr=b(),K=T(),hr=O(),qr=_(),wr=z(),br=L();function Er(r,e){var u,n,t,i;if(i={number:null,complex:null,array:null,ndarray:null},n=qr(i,r),n||(u={policy:hr.output_dtype_policy},arguments.length>1&&(n=wr(u,e),n)))throw n;return t=d,mr(t,"assign",A),t;function d(a){var o,s,l,p,f;if(D(a)){if(i.number)return i.number(a);throw new TypeError("invalid argument. Providing a number is not supported.")}if(M(a)){if(i.complex)return i.complex(a);throw new TypeError("invalid argument. Providing a complex number is not supported.")}if(l={},arguments.length>1&&(p=br(l,arguments[1]),p))throw p;if(m(a)){if(i.ndarray===null)throw new TypeError("invalid argument. Providing an ndarray is not supported.");return s=l.dtype||K(a.dtype,u.policy),yr(i.ndarray,a,s,l.order||a.order)}if(g(a)){if(i.array===null)throw new TypeError("invalid argument. Providing an array-like object is not supported.");return o=y(a)||"generic",s=l.dtype||K(o,u.policy),f=gr(s,a.length),i.array(a.length,o,a,1,s,f,1),f}throw new TypeError(F("invalid argument. Must provide an argument having a supported data type. Value: `%s`.",a))}function A(a,o){var s,l,p;if(m(a)){if(m(o)){if(s=a.shape,l=o.shape,s.length===l.length){for(p=0;p<s.length;p++)if(s[p]!==l[p]){a=N(a,l);break}}else a=N(a,l);return i.ndarray(a,o),o}throw new TypeError("invalid argument. If the first argument is an ndarray, the second argument must be an ndarray.")}if(g(a)){if(g(o)){if(o.length!==a.length)throw new RangeError("invalid argument. Output array must have the same number of elements (i.e., length) as the input array.");return i.array(a.length,y(a)||"generic",a,1,y(o)||"generic",o,1),o}throw new TypeError("invalid argument. If the first argument is an array-like object, the second argument must be an array-like object.")}throw D(a)?new TypeError("invalid argument. Providing a number is not supported. Consider providing a zero-dimensional ndarray containing the numeric value."):M(a)?new TypeError("invalid argument. Providing a complex number is not supported. Consider providing a zero-dimensional ndarray containing the complex number value."):new TypeError(F("invalid argument. Must provide an argument having a supported data type. Value: `%s`.",a))}}U.exports=Er});var Tr=Y();module.exports=Tr;
2
+ /**
3
+ * @license Apache-2.0
4
+ *
5
+ * Copyright (c) 2021 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
+ */
15
19
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stdlib/math-tools-unary",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "Multiple dispatch for unary mathematical functions.",
5
5
  "license": "Apache-2.0",
6
6
  "author": {
@@ -30,28 +30,28 @@
30
30
  "url": "https://github.com/stdlib-js/stdlib/issues"
31
31
  },
32
32
  "dependencies": {
33
- "@stdlib/array-base-copy-indexed": "^0.2.1",
34
- "@stdlib/assert-contains": "^0.2.1",
35
- "@stdlib/assert-has-own-property": "^0.2.1",
36
- "@stdlib/assert-is-collection": "^0.2.1",
37
- "@stdlib/assert-is-complex-like": "^0.2.1",
38
- "@stdlib/assert-is-function": "^0.2.1",
39
- "@stdlib/assert-is-ndarray-like": "^0.2.1",
40
- "@stdlib/assert-is-null": "^0.2.1",
41
- "@stdlib/assert-is-number": "^0.2.1",
42
- "@stdlib/assert-is-plain-object": "^0.2.1",
43
- "@stdlib/ndarray-base-broadcast-array": "^0.2.1",
33
+ "@stdlib/array-base-copy-indexed": "^0.2.2",
34
+ "@stdlib/assert-contains": "^0.2.2",
35
+ "@stdlib/assert-has-own-property": "^0.2.2",
36
+ "@stdlib/assert-is-collection": "^0.2.2",
37
+ "@stdlib/assert-is-complex-like": "^0.2.2",
38
+ "@stdlib/assert-is-function": "^0.2.2",
39
+ "@stdlib/assert-is-ndarray-like": "^0.2.2",
40
+ "@stdlib/assert-is-null": "^0.2.2",
41
+ "@stdlib/assert-is-number": "^0.2.2",
42
+ "@stdlib/assert-is-plain-object": "^0.2.2",
43
+ "@stdlib/ndarray-base-broadcast-array": "^0.2.2",
44
44
  "@stdlib/ndarray-base-buffer": "^0.2.1",
45
45
  "@stdlib/ndarray-base-buffer-dtype": "^0.2.1",
46
- "@stdlib/ndarray-base-numel": "^0.2.1",
47
- "@stdlib/ndarray-base-shape2strides": "^0.2.1",
46
+ "@stdlib/ndarray-base-numel": "^0.2.2",
47
+ "@stdlib/ndarray-base-shape2strides": "^0.2.2",
48
48
  "@stdlib/ndarray-ctor": "^0.2.1",
49
- "@stdlib/ndarray-dtypes": "^0.2.1",
50
- "@stdlib/ndarray-orders": "^0.2.1",
51
- "@stdlib/string-format": "^0.2.1",
52
- "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.1",
53
- "@stdlib/utils-keys": "^0.2.1",
54
- "@stdlib/error-tools-fmtprodmsg": "^0.2.1"
49
+ "@stdlib/ndarray-dtypes": "^0.3.0",
50
+ "@stdlib/ndarray-orders": "^0.2.2",
51
+ "@stdlib/string-format": "^0.2.2",
52
+ "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2",
53
+ "@stdlib/utils-keys": "^0.2.2",
54
+ "@stdlib/error-tools-fmtprodmsg": "^0.2.2"
55
55
  },
56
56
  "devDependencies": {},
57
57
  "engines": {