-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.mjs.map
1 lines (1 loc) · 5.8 KB
/
index.mjs.map
1
{"version":3,"file":"index.mjs","sources":["../lib/main.js","../lib/pop_typed_array.js","../lib/pop_object.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\nimport isArray from '@stdlib/assert-is-array';\nimport isTypedArrayLike from '@stdlib/assert-is-typed-array-like';\nimport isInteger from '@stdlib/assert-is-integer';\nimport format from '@stdlib/error-tools-fmtprodmsg';\nimport popObject from './pop_object.js';\nimport popTypedArray from './pop_typed_array.js';\n\n\n// MAIN //\n\n/**\n* Removes and returns the last element of a collection.\n*\n* @param {(Array|TypedArray|Object)} collection - collection\n* @throws {TypeError} must provide either an array, typed array, or an array-like object\n* @returns {Array} updated collection and the removed element\n*\n* @example\n* var arr = [ 1.0, 2.0, 3.0, 4.0, 5.0 ];\n*\n* var out = pop( arr );\n* // returns [ [ 1.0, 2.0, 3.0, 4.0 ], 5.0 ]\n*\n* @example\n* var arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] );\n* // returns <Float64Array>[ 1.0, 2.0, 3.0, 4.0, 5.0 ]\n*\n* var out = pop( arr );\n* // returns [ <Float64Array>[ 1.0, 2.0, 3.0, 4.0 ], 5.0 ]\n*/\nfunction pop( collection ) {\n\tvar v;\n\tif ( isArray( collection ) ) {\n\t\tv = collection.pop();\n\t\treturn [ collection, v ];\n\t}\n\t// Check for a typed-array-like object, as verifying actual typed arrays is expensive...\n\tif ( isTypedArrayLike( collection ) ) {\n\t\treturn popTypedArray( collection );\n\t}\n\t// Check for an array-like object...\n\tif (\n\t\tcollection !== null &&\n\t\ttypeof collection === 'object' &&\n\t\ttypeof collection.length === 'number' &&\n\t\tisInteger( collection.length ) &&\n\t\tcollection.length >= 0\n\t) {\n\t\treturn popObject( collection );\n\t}\n\tthrow new TypeError( format( '1WlBm', collection ) );\n}\n\n\n// EXPORTS //\n\nexport default pop;\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// MAIN //\n\n/**\n* Removes and returns the last element of a typed array.\n*\n* @private\n* @param {TypedArray} arr - input array\n* @returns {Array} input array and the removed element\n*\n* @example\n* var arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] );\n* // returns <Float64Array>[ 1.0, 2.0, 3.0, 4.0, 5.0 ]\n*\n* var out = pop( arr );\n* // returns [ <Float64Array>[ 1.0, 2.0, 3.0, 4.0 ], 5.0 ]\n*/\nfunction pop( arr ) {\n\tvar view;\n\tvar len;\n\tvar v;\n\tif ( arr.length === 0 ) {\n\t\treturn [ arr, void 0 ];\n\t}\n\tlen = arr.length - 1;\n\tv = arr[ len ];\n\tview = new arr.constructor( arr.buffer, arr.byteOffset, len );\n\treturn [ view, v ];\n}\n\n\n// EXPORTS //\n\nexport default pop;\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// MAIN //\n\n/**\n* Removes and returns the last element of an array-like object.\n*\n* @private\n* @param {Object} obj - input array-like object\n* @returns {Array} input object and the removed element\n*\n* @example\n* var obj = {\n* 'length': 2,\n* '0': 1.0,\n* '1': 2.0\n* };\n*\n* var out = pop( obj );\n* // returns [ { 'length': 1, '0': 1.0 }, 2.0 ]\n*/\nfunction pop( obj ) {\n\tvar len;\n\tvar v;\n\tif ( obj.length === 0 ) {\n\t\treturn [ obj, void 0 ];\n\t}\n\tlen = obj.length - 1;\n\tv = obj[ len ];\n\tdelete obj[ len ];\n\tobj.length = len;\n\treturn [ obj, v ];\n}\n\n\n// EXPORTS //\n\nexport default pop;\n"],"names":["pop","collection","v","isArray","isTypedArrayLike","arr","len","length","constructor","buffer","byteOffset","popTypedArray","isInteger","obj","popObject","TypeError","format"],"mappings":";;4XAoDA,SAASA,EAAKC,GACb,IAAIC,EACJ,GAAKC,EAASF,GAEb,OADAC,EAAID,EAAWD,MACR,CAAEC,EAAYC,GAGtB,GAAKE,EAAkBH,GACtB,OCxBF,SAAcI,GACb,IACIC,EACAJ,EACJ,OAAoB,IAAfG,EAAIE,OACD,CAAEF,OAAK,IAGfH,EAAIG,EADJC,EAAMD,EAAIE,OAAS,GAGZ,CADA,IAAIF,EAAIG,YAAaH,EAAII,OAAQJ,EAAIK,WAAYJ,GACzCJ,GAChB,CDaSS,CAAeV,GAGvB,GACgB,OAAfA,GACsB,iBAAfA,GACsB,iBAAtBA,EAAWM,QAClBK,EAAWX,EAAWM,SACtBN,EAAWM,QAAU,EAErB,OE/BF,SAAcM,GACb,IAAIP,EACAJ,EACJ,OAAoB,IAAfW,EAAIN,OACD,CAAEM,OAAK,IAGfX,EAAIW,EADJP,EAAMO,EAAIN,OAAS,UAEZM,EAAKP,GACZO,EAAIN,OAASD,EACN,CAAEO,EAAKX,GACf,CFoBSY,CAAWb,GAEnB,MAAM,IAAIc,UAAWC,EAAQ,QAASf,GACvC"}