From f69604878573ef3a2c6c8d4eb60065989b0cfb5c Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 17 Aug 2023 02:30:09 +0000 Subject: [PATCH] Auto-generated commit --- .github/.keepalive | 1 - .github/workflows/productionize.yml | 15 --------------- dist/index.d.ts | 3 +++ dist/index.js | 9 +++++++++ dist/index.js.map | 7 +++++++ docs/types/index.d.ts | 4 ++-- 6 files changed, 21 insertions(+), 18 deletions(-) delete mode 100644 .github/.keepalive create mode 100644 dist/index.d.ts create mode 100644 dist/index.js create mode 100644 dist/index.js.map diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index 874fe84..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2023-08-01T04:18:16.474Z diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml index 334eb59..91f2b93 100644 --- a/.github/workflows/productionize.yml +++ b/.github/workflows/productionize.yml @@ -82,21 +82,6 @@ jobs: id: transform-error-messages uses: stdlib-js/transform-errors-action@main - # Format error messages: - - name: 'Replace double quotes with single quotes in rewritten format string error messages' - run: | - find . -name "*.js" -exec sed -E -i "s/Error\( format\( \"([a-zA-Z0-9]+)\"/Error\( format\( '\1'/g" {} \; - - # Format string literal error messages: - - name: 'Replace double quotes with single quotes in rewritten string literal error messages' - run: | - find . -name "*.js" -exec sed -E -i "s/Error\( format\(\"([a-zA-Z0-9]+)\"\)/Error\( format\( '\1' \)/g" {} \; - - # Format code: - - name: 'Replace double quotes with single quotes in inserted `require` calls' - run: | - find . -name "*.js" -exec sed -E -i "s/require\( ?\"@stdlib\/error-tools-fmtprodmsg\" ?\);/require\( '@stdlib\/error-tools-fmtprodmsg' \);/g" {} \; - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - name: 'Update dependencies in package.json' run: | diff --git a/dist/index.d.ts b/dist/index.d.ts new file mode 100644 index 0000000..bb712d7 --- /dev/null +++ b/dist/index.d.ts @@ -0,0 +1,3 @@ +/// +import fromArray from '../docs/types/index'; +export = fromArray; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js new file mode 100644 index 0000000..59452b6 --- /dev/null +++ b/dist/index.js @@ -0,0 +1,9 @@ +"use strict";var i=function(r,e){return function(){return e||r((e={exports:{}}).exports,e),e.exports}};var o=i(function(k,a){ +var v=require('@stdlib/assert-is-function/dist'),l=require('@stdlib/buffer-ctor/dist'),c=v(l.from);a.exports=c +});var s=i(function(A,t){ +var q=require('@stdlib/assert-is-collection/dist'),m=require('@stdlib/error-tools-fmtprodmsg/dist'),p=require('@stdlib/buffer-ctor/dist');function y(r){if(!q(r))throw new TypeError(m('0GJ2u',r));return p.from(r)}t.exports=y +});var n=i(function(C,f){ +var w=require('@stdlib/assert-is-collection/dist'),b=require('@stdlib/error-tools-fmtprodmsg/dist'),d=require('@stdlib/buffer-ctor/dist');function x(r){if(!w(r))throw new TypeError(b('0GJ2u',r));return new d(r)}f.exports=x +});var h=o(),B=s(),g=n(),u;h?u=B:u=g;module.exports=u; +/** @license Apache-2.0 */ +//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map new file mode 100644 index 0000000..98c2d4f --- /dev/null +++ b/dist/index.js.map @@ -0,0 +1,7 @@ +{ + "version": 3, + "sources": ["../lib/has_from.js", "../lib/main.js", "../lib/polyfill.js", "../lib/index.js"], + "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 isFunction = require( '@stdlib/assert-is-function' );\nvar Buffer = require( '@stdlib/buffer-ctor' );\n\n\n// MAIN //\n\nvar bool = isFunction( Buffer.from );\n\n\n// EXPORTS //\n\nmodule.exports = bool;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 isCollection = require( '@stdlib/assert-is-collection' );\nvar format = require( '@stdlib/string-format' );\nvar Buffer = require( '@stdlib/buffer-ctor' );\n\n\n// MAIN //\n\n/**\n* Allocates a buffer using an octet array.\n*\n* @param {Collection} arr - octet array\n* @throws {TypeError} must provide an array-like object\n* @returns {Buffer} new `Buffer` instance\n*\n* @example\n* var fromArray = require( '@stdlib/buffer-from-array' );\n*\n* var buf = fromArray( [ 1, 2, 3, 4 ] );\n* // returns \n*/\nfunction fromArray( arr ) {\n\tif ( !isCollection( arr ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide an array-like object. Value: `%s`.', arr ) );\n\t}\n\treturn Buffer.from( arr );\n}\n\n\n// EXPORTS //\n\nmodule.exports = fromArray;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 isCollection = require( '@stdlib/assert-is-collection' );\nvar format = require( '@stdlib/string-format' );\nvar Buffer = require( '@stdlib/buffer-ctor' );\n\n\n// MAIN //\n\n/**\n* Allocates a buffer using an octet array.\n*\n* @param {Collection} arr - octet array\n* @throws {TypeError} must provide an array-like object\n* @returns {Buffer} new `Buffer` instance\n*\n* @example\n* var fromArray = require( '@stdlib/buffer-from-array' );\n*\n* var buf = fromArray( [ 1, 2, 3, 4 ] );\n* // returns \n*/\nfunction fromArray( arr ) {\n\tif ( !isCollection( arr ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide an array-like object. Value: `%s`.', arr ) );\n\t}\n\treturn new Buffer( arr ); // eslint-disable-line no-buffer-constructor\n}\n\n\n// EXPORTS //\n\nmodule.exports = fromArray;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Allocate a buffer using an octet array.\n*\n* @module @stdlib/buffer-from-array\n*\n* @example\n* var array2buffer = require( '@stdlib/buffer-from-array' );\n*\n* var buf = array2buffer( [ 1, 2, 3, 4 ] );\n* // returns \n*/\n\n// MODULES //\n\nvar hasFrom = require( './has_from.js' );\nvar main = require( './main.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar array2buffer;\nif ( hasFrom ) {\n\tarray2buffer = main;\n} else {\n\tarray2buffer = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = array2buffer;\n"], + "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAa,QAAS,4BAA6B,EACnDC,EAAS,QAAS,qBAAsB,EAKxCC,EAAOF,EAAYC,EAAO,IAAK,EAKnCF,EAAO,QAAUG,ICjCjB,IAAAC,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAe,QAAS,8BAA+B,EACvDC,EAAS,QAAS,uBAAwB,EAC1CC,EAAS,QAAS,qBAAsB,EAkB5C,SAASC,EAAWC,EAAM,CACzB,GAAK,CAACJ,EAAcI,CAAI,EACvB,MAAM,IAAI,UAAWH,EAAQ,oEAAqEG,CAAI,CAAE,EAEzG,OAAOF,EAAO,KAAME,CAAI,CACzB,CAKAL,EAAO,QAAUI,ICpDjB,IAAAE,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAe,QAAS,8BAA+B,EACvDC,EAAS,QAAS,uBAAwB,EAC1CC,EAAS,QAAS,qBAAsB,EAkB5C,SAASC,EAAWC,EAAM,CACzB,GAAK,CAACJ,EAAcI,CAAI,EACvB,MAAM,IAAI,UAAWH,EAAQ,oEAAqEG,CAAI,CAAE,EAEzG,OAAO,IAAIF,EAAQE,CAAI,CACxB,CAKAL,EAAO,QAAUI,IClBjB,IAAIE,EAAU,IACVC,EAAO,IACPC,EAAW,IAKXC,EACCH,EACJG,EAAeF,EAEfE,EAAeD,EAMhB,OAAO,QAAUC", + "names": ["require_has_from", "__commonJSMin", "exports", "module", "isFunction", "Buffer", "bool", "require_main", "__commonJSMin", "exports", "module", "isCollection", "format", "Buffer", "fromArray", "arr", "require_polyfill", "__commonJSMin", "exports", "module", "isCollection", "format", "Buffer", "fromArray", "arr", "hasFrom", "main", "polyfill", "array2buffer"] +} diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts index 95ba4c6..80d16e4 100644 --- a/docs/types/index.d.ts +++ b/docs/types/index.d.ts @@ -22,7 +22,7 @@ /// import { Buffer } from 'buffer'; -import { Collection } from '@stdlib/types/object'; +import { Collection } from '@stdlib/types/array'; /** * Allocates a buffer using an octet array. @@ -36,7 +36,7 @@ import { Collection } from '@stdlib/types/object'; * var buf = fromArray( [ 1, 2, 3, 4 ] ); * // returns */ -declare function fromArray( arr: Collection ): Buffer; +declare function fromArray( arr: Collection ): Buffer; // EXPORTS //