diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index 78ea366..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-01-01T05:41:14.712Z diff --git a/NOTICE b/NOTICE index f7aca1b..e6e7482 100644 --- a/NOTICE +++ b/NOTICE @@ -1 +1 @@ -Copyright (c) 2016-2023 The Stdlib Authors. +Copyright (c) 2016-2024 The Stdlib Authors. diff --git a/dist/index.js b/dist/index.js index 0746b8b..0bda32c 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1,5 +1,5 @@ -"use strict";var s=function(a,e){return function(){return e||a((e={exports:{}}).exports,e),e.exports}};var l=s(function(x,t){ -var u=require('@stdlib/complex-float64/dist'),i=require('@stdlib/complex-float32/dist'),n=require('@stdlib/array-full/dist'),o=new u(1,0),v=new i(1,0);function m(a){var e,r;return arguments.length>1?e=arguments[1]:e="float64",e==="complex128"?r=o:e==="complex64"?r=v:r=1,n(a,r,e)}t.exports=m -});var p=l();module.exports=p; +"use strict";var s=function(a,e){return function(){return e||a((e={exports:{}}).exports,e),e.exports}};var u=s(function(q,t){ +var l=require('@stdlib/complex-float64/dist'),i=require('@stdlib/complex-float32/dist'),v=require('@stdlib/array-full/dist'),n=require('@stdlib/array-defaults/dist'),o=new l(1,0),p=new i(1,0),f=n.get("dtypes.default");function m(a){var e,r;return arguments.length>1?e=arguments[1]:e=f,e==="complex128"?r=o:e==="complex64"?r=p:r=1,v(a,r,e)}t.exports=m +});var x=u();module.exports=x; /** @license Apache-2.0 */ //# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map index f2c123c..77451d7 100644 --- a/dist/index.js.map +++ b/dist/index.js.map @@ -1,7 +1,7 @@ { "version": 3, "sources": ["../lib/main.js", "../lib/index.js"], - "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// MODULES //\n\nvar Complex128 = require( '@stdlib/complex-float64' );\nvar Complex64 = require( '@stdlib/complex-float32' );\nvar full = require( '@stdlib/array-full' );\n\n\n// VARIABLES //\n\nvar Z128 = new Complex128( 1.0, 0.0 );\nvar Z64 = new Complex64( 1.0, 0.0 );\n\n\n// MAIN //\n\n/**\n* Creates an array filled with ones and having a specified length.\n*\n* @param {NonNegativeInteger} length - array length\n* @param {string} [dtype=\"float64\"] - data type\n* @throws {TypeError} first argument must be a nonnegative integer\n* @throws {TypeError} second argument must be a recognized data type\n* @returns {(TypedArray|Array|ComplexArray)} array or typed array\n*\n* @example\n* var arr = ones( 2 );\n* // returns [ 1.0, 1.0 ]\n*\n* @example\n* var arr = ones( 2, 'float32' );\n* // returns [ 1.0, 1.0 ]\n*/\nfunction ones( length ) {\n\tvar dtype;\n\tvar value;\n\n\tif ( arguments.length > 1 ) {\n\t\tdtype = arguments[ 1 ];\n\t} else {\n\t\tdtype = 'float64';\n\t}\n\tif ( dtype === 'complex128' ) {\n\t\tvalue = Z128;\n\t} else if ( dtype === 'complex64' ) {\n\t\tvalue = Z64;\n\t} else {\n\t\tvalue = 1;\n\t}\n\treturn full( length, value, dtype );\n}\n\n\n// EXPORTS //\n\nmodule.exports = ones;\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* Create an array filled with ones and having a specified length.\n*\n* @module @stdlib/array-ones\n*\n* @example\n* var ones = require( '@stdlib/array-ones' );\n*\n* var arr = ones( 2 );\n* // returns [ 1.0, 1.0 ]\n*\n* @example\n* var ones = require( '@stdlib/array-ones' );\n*\n* var arr = ones( 2, 'float32' );\n* // returns [ 1.0, 1.0 ]\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAa,QAAS,yBAA0B,EAChDC,EAAY,QAAS,yBAA0B,EAC/CC,EAAO,QAAS,oBAAqB,EAKrCC,EAAO,IAAIH,EAAY,EAAK,CAAI,EAChCI,EAAM,IAAIH,EAAW,EAAK,CAAI,EAsBlC,SAASI,EAAMC,EAAS,CACvB,IAAIC,EACAC,EAEJ,OAAK,UAAU,OAAS,EACvBD,EAAQ,UAAW,CAAE,EAErBA,EAAQ,UAEJA,IAAU,aACdC,EAAQL,EACGI,IAAU,YACrBC,EAAQJ,EAERI,EAAQ,EAEFN,EAAMI,EAAQE,EAAOD,CAAM,CACnC,CAKAR,EAAO,QAAUM,IClCjB,IAAII,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "Complex128", "Complex64", "full", "Z128", "Z64", "ones", "length", "dtype", "value", "main"] + "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// MODULES //\n\nvar Complex128 = require( '@stdlib/complex-float64' );\nvar Complex64 = require( '@stdlib/complex-float32' );\nvar full = require( '@stdlib/array-full' );\nvar defaults = require( '@stdlib/array-defaults' );\n\n\n// VARIABLES //\n\nvar Z128 = new Complex128( 1.0, 0.0 );\nvar Z64 = new Complex64( 1.0, 0.0 );\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.default' );\n\n\n// MAIN //\n\n/**\n* Creates an array filled with ones and having a specified length.\n*\n* @param {NonNegativeInteger} length - array length\n* @param {string} [dtype=\"float64\"] - data type\n* @throws {TypeError} first argument must be a nonnegative integer\n* @throws {TypeError} second argument must be a recognized data type\n* @returns {(TypedArray|Array|ComplexArray)} array or typed array\n*\n* @example\n* var arr = ones( 2 );\n* // returns [ 1.0, 1.0 ]\n*\n* @example\n* var arr = ones( 2, 'float32' );\n* // returns [ 1.0, 1.0 ]\n*/\nfunction ones( length ) {\n\tvar dtype;\n\tvar value;\n\n\tif ( arguments.length > 1 ) {\n\t\tdtype = arguments[ 1 ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tif ( dtype === 'complex128' ) {\n\t\tvalue = Z128;\n\t} else if ( dtype === 'complex64' ) {\n\t\tvalue = Z64;\n\t} else {\n\t\tvalue = 1;\n\t}\n\treturn full( length, value, dtype );\n}\n\n\n// EXPORTS //\n\nmodule.exports = ones;\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* Create an array filled with ones and having a specified length.\n*\n* @module @stdlib/array-ones\n*\n* @example\n* var ones = require( '@stdlib/array-ones' );\n*\n* var arr = ones( 2 );\n* // returns [ 1.0, 1.0 ]\n*\n* @example\n* var ones = require( '@stdlib/array-ones' );\n*\n* var arr = ones( 2, 'float32' );\n* // returns [ 1.0, 1.0 ]\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], + "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAa,QAAS,yBAA0B,EAChDC,EAAY,QAAS,yBAA0B,EAC/CC,EAAO,QAAS,oBAAqB,EACrCC,EAAW,QAAS,wBAAyB,EAK7CC,EAAO,IAAIJ,EAAY,EAAK,CAAI,EAChCK,EAAM,IAAIJ,EAAW,EAAK,CAAI,EAC9BK,EAAgBH,EAAS,IAAK,gBAAiB,EAsBnD,SAASI,EAAMC,EAAS,CACvB,IAAIC,EACAC,EAEJ,OAAK,UAAU,OAAS,EACvBD,EAAQ,UAAW,CAAE,EAErBA,EAAQH,EAEJG,IAAU,aACdC,EAAQN,EACGK,IAAU,YACrBC,EAAQL,EAERK,EAAQ,EAEFR,EAAMM,EAAQE,EAAOD,CAAM,CACnC,CAKAV,EAAO,QAAUQ,ICpCjB,IAAII,EAAO,IAKX,OAAO,QAAUA", + "names": ["require_main", "__commonJSMin", "exports", "module", "Complex128", "Complex64", "full", "defaults", "Z128", "Z64", "DEFAULT_DTYPE", "ones", "length", "dtype", "value", "main"] } diff --git a/lib/main.js b/lib/main.js index e4e6514..c6c3a20 100644 --- a/lib/main.js +++ b/lib/main.js @@ -23,12 +23,14 @@ var Complex128 = require( '@stdlib/complex-float64' ); var Complex64 = require( '@stdlib/complex-float32' ); var full = require( '@stdlib/array-full' ); +var defaults = require( '@stdlib/array-defaults' ); // VARIABLES // var Z128 = new Complex128( 1.0, 0.0 ); var Z64 = new Complex64( 1.0, 0.0 ); +var DEFAULT_DTYPE = defaults.get( 'dtypes.default' ); // MAIN // @@ -57,7 +59,7 @@ function ones( length ) { if ( arguments.length > 1 ) { dtype = arguments[ 1 ]; } else { - dtype = 'float64'; + dtype = DEFAULT_DTYPE; } if ( dtype === 'complex128' ) { value = Z128; diff --git a/package.json b/package.json index 6616155..e5e31c5 100644 --- a/package.json +++ b/package.json @@ -37,6 +37,7 @@ "url": "https://github.com/stdlib-js/stdlib/issues" }, "dependencies": { + "@stdlib/array-defaults": "^0.1.0", "@stdlib/array-full": "^0.1.0", "@stdlib/complex-float32": "^0.1.1", "@stdlib/complex-float64": "^0.1.1",