File tree Expand file tree Collapse file tree 6 files changed +19
-10
lines changed
output-policy-enum2str/lib
output-policy-str2enum/lib Expand file tree Collapse file tree 6 files changed +19
-10
lines changed Original file line number Diff line number Diff line change @@ -675,6 +675,11 @@ A total of 37 issues were closed in this release:
675675
676676<details >
677677
678+ - [ ` 0aeccc2 ` ] ( https://github.com/stdlib-js/stdlib/commit/0aeccc26acf8805e65efec785132deec907dd073 ) - ** refactor:** rename variable _ (by Athan Reines)_
679+ - [ ` d0514f7 ` ] ( https://github.com/stdlib-js/stdlib/commit/d0514f706cd96237b73f6b6cc02539534e5b0a00 ) - ** refactor:** use assertion utility _ (by Athan Reines)_
680+ - [ ` cc057c6 ` ] ( https://github.com/stdlib-js/stdlib/commit/cc057c682563ebf77e7c1b7c7a9168a57fb091e3 ) - ** refactor:** use assertion utility _ (by Athan Reines)_
681+ - [ ` 99a718f ` ] ( https://github.com/stdlib-js/stdlib/commit/99a718fb54e488b1afba8779182e011452096bec ) - ** refactor:** use assertion utility _ (by Athan Reines)_
682+ - [ ` 359bba5 ` ] ( https://github.com/stdlib-js/stdlib/commit/359bba54a7067cf75dd0e191f56cd1817ecc6e59 ) - ** refactor:** use assertion utility _ (by Athan Reines)_
678683- [ ` a412839 ` ] ( https://github.com/stdlib-js/stdlib/commit/a4128395cf4695b457d72d1a665393cae6bd834d ) - ** refactor:** support dtype instances by normalizing dtypes to strings _ (by Athan Reines)_
679684- [ ` cadf4e1 ` ] ( https://github.com/stdlib-js/stdlib/commit/cadf4e1b8d185dd7fe9c48d09651be8681d2f40b ) - ** docs:** update examples _ (by Athan Reines)_
680685- [ ` 7ed84a3 ` ] ( https://github.com/stdlib-js/stdlib/commit/7ed84a377820c9a20047b7329799467e58bd3171 ) - ** docs:** fix examples _ (by Athan Reines)_
Original file line number Diff line number Diff line change 2020
2121// MODULES //
2222
23+ var isNumber = require ( '@stdlib/assert/is-number' ) . isPrimitive ;
2324var strides2offset = require ( './../../../base/strides2offset' ) ;
2425
2526
@@ -43,7 +44,7 @@ function offset( x ) {
4344 var o ;
4445
4546 o = x . offset ;
46- if ( typeof o === 'number' ) {
47+ if ( isNumber ( o ) ) {
4748 return o ;
4849 }
4950 sh = x . shape ;
Original file line number Diff line number Diff line change 2020
2121// MODULES //
2222
23+ var isString = require ( '@stdlib/assert/is-string' ) . isPrimitive ;
2324var objectInverse = require ( '@stdlib/utils/object-inverse' ) ;
2425var enumeration = require ( './../../../output-dtype-policies' ) . enum ;
2526
@@ -50,7 +51,7 @@ var hash = objectInverse( enumeration(), {
5051*/
5152function enum2str ( policy ) {
5253 var v = hash [ policy ] ;
53- return ( typeof v === 'string' ) ? v : null ; // note: we include this guard to prevent walking the prototype chain
54+ return ( isString ( v ) ) ? v : null ; // note: we include this guard to prevent walking the prototype chain
5455}
5556
5657
Original file line number Diff line number Diff line change 2020
2121// MODULES //
2222
23+ var isNumber = require ( '@stdlib/assert/is-number' ) . isPrimitive ;
2324var enumeration = require ( './../../../output-dtype-policies' ) . enum ;
2425
2526
@@ -46,7 +47,7 @@ var ENUM = enumeration();
4647*/
4748function str2enum ( policy ) {
4849 var v = ENUM [ policy ] ;
49- return ( typeof v === 'number' ) ? v : null ; // note: we include this guard to prevent walking the prototype chain
50+ return ( isNumber ( v ) ) ? v : null ; // note: we include this guard to prevent walking the prototype chain
5051}
5152
5253
Original file line number Diff line number Diff line change 2020
2121// MODULES //
2222
23+ var isString = require ( '@stdlib/assert/is-string' ) . isPrimitive ;
2324var shape2strides = require ( './../../../base/shape2strides' ) ;
2425var copyIndexed = require ( '@stdlib/array/base/copy-indexed' ) ;
2526
@@ -56,7 +57,7 @@ function strides( x, copy ) {
5657 return [ 0 ] ;
5758 }
5859 ord = x . order ;
59- if ( typeof ord !== 'string' ) {
60+ if ( ! isString ( ord ) ) {
6061 ord = ROW_MAJOR ;
6162 }
6263 return shape2strides ( sh , ord ) ;
Original file line number Diff line number Diff line change 2222
2323var isFunction = require ( '@stdlib/assert/is-function' ) ;
2424var isTypedArrayLike = require ( '@stdlib/assert/is-typed-array-like' ) ;
25- var resolve = require ( './../../../base/dtype-resolve-enum' ) ;
25+ var resolveEnum = require ( './../../../base/dtype-resolve-enum' ) ;
2626var reinterpretComplex64 = require ( '@stdlib/strided/base/reinterpret-complex64' ) ;
2727var reinterpretComplex128 = require ( '@stdlib/strided/base/reinterpret-complex128' ) ;
2828var reinterpretBoolean = require ( '@stdlib/strided/base/reinterpret-boolean' ) ;
@@ -34,9 +34,9 @@ var format = require( '@stdlib/string/format' );
3434
3535// VARIABLES //
3636
37- var COMPLEX64 = resolve ( 'complex64' ) ;
38- var COMPLEX128 = resolve ( 'complex128' ) ;
39- var BOOLEAN = resolve ( 'bool' ) ;
37+ var COMPLEX64 = resolveEnum ( 'complex64' ) ;
38+ var COMPLEX128 = resolveEnum ( 'complex128' ) ;
39+ var BOOLEAN = resolveEnum ( 'bool' ) ;
4040
4141
4242// MAIN //
@@ -143,8 +143,8 @@ function dispatch( addon, fallback ) {
143143 fallback ( x , y ) ;
144144 return y ;
145145 }
146- dtypeX = resolve ( getDType ( x ) ) ;
147- dtypeY = resolve ( getDType ( y ) ) ;
146+ dtypeX = resolveEnum ( getDType ( x ) ) ;
147+ dtypeY = resolveEnum ( getDType ( y ) ) ;
148148 if ( dtypeX === null || dtypeY === null ) {
149149 throw new TypeError ( 'invalid arguments. Unable to resolve an ndarray function supporting the provided argument data types.' ) ;
150150 }
You can’t perform that action at this time.
0 commit comments