@ohos-ports/stdlib-complex-real 0.0.0-stage → 0.2.1-beta.1
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.
- package/LICENSE +177 -0
- package/NOTICE +1 -0
- package/README.md +320 -2
- package/SECURITY.md +5 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +7 -0
- package/docs/types/index.d.ts +44 -0
- package/include/stdlib/complex/real.h +40 -0
- package/lib/index.js +43 -0
- package/lib/main.js +42 -0
- package/manifest.json +40 -0
- package/node_modules/@stdlib/array-float32/LICENSE +177 -0
- package/node_modules/@stdlib/array-float32/NOTICE +1 -0
- package/node_modules/@stdlib/array-float32/README.md +1577 -0
- package/node_modules/@stdlib/array-float32/SECURITY.md +5 -0
- package/node_modules/@stdlib/array-float32/dist/index.d.ts +3 -0
- package/node_modules/@stdlib/array-float32/dist/index.js +19 -0
- package/node_modules/@stdlib/array-float32/dist/index.js.map +7 -0
- package/node_modules/@stdlib/array-float32/docs/types/index.d.ts +26 -0
- package/node_modules/@stdlib/array-float32/lib/index.js +52 -0
- package/node_modules/@stdlib/array-float32/lib/main.js +28 -0
- package/node_modules/@stdlib/array-float32/lib/polyfill.js +37 -0
- package/node_modules/@stdlib/array-float32/package.json +72 -0
- package/node_modules/@stdlib/assert-has-float32array-support/LICENSE +177 -0
- package/node_modules/@stdlib/assert-has-float32array-support/NOTICE +1 -0
- package/node_modules/@stdlib/assert-has-float32array-support/README.md +187 -0
- package/node_modules/@stdlib/assert-has-float32array-support/SECURITY.md +5 -0
- package/node_modules/@stdlib/assert-has-float32array-support/dist/index.d.ts +3 -0
- package/node_modules/@stdlib/assert-has-float32array-support/dist/index.js +7 -0
- package/node_modules/@stdlib/assert-has-float32array-support/dist/index.js.map +7 -0
- package/node_modules/@stdlib/assert-has-float32array-support/docs/types/index.d.ts +35 -0
- package/node_modules/@stdlib/assert-has-float32array-support/lib/float32array.js +28 -0
- package/node_modules/@stdlib/assert-has-float32array-support/lib/index.js +40 -0
- package/node_modules/@stdlib/assert-has-float32array-support/lib/main.js +65 -0
- package/node_modules/@stdlib/assert-has-float32array-support/package.json +77 -0
- package/node_modules/@stdlib/assert-has-own-property/LICENSE +177 -0
- package/node_modules/@stdlib/assert-has-own-property/NOTICE +1 -0
- package/node_modules/@stdlib/assert-has-own-property/README.md +263 -0
- package/node_modules/@stdlib/assert-has-own-property/SECURITY.md +5 -0
- package/node_modules/@stdlib/assert-has-own-property/dist/index.d.ts +3 -0
- package/node_modules/@stdlib/assert-has-own-property/dist/index.js +5 -0
- package/node_modules/@stdlib/assert-has-own-property/dist/index.js.map +7 -0
- package/node_modules/@stdlib/assert-has-own-property/docs/types/index.d.ts +49 -0
- package/node_modules/@stdlib/assert-has-own-property/lib/index.js +47 -0
- package/node_modules/@stdlib/assert-has-own-property/lib/main.js +64 -0
- package/node_modules/@stdlib/assert-has-own-property/package.json +73 -0
- package/node_modules/@stdlib/assert-has-symbol-support/LICENSE +177 -0
- package/node_modules/@stdlib/assert-has-symbol-support/NOTICE +1 -0
- package/node_modules/@stdlib/assert-has-symbol-support/README.md +193 -0
- package/node_modules/@stdlib/assert-has-symbol-support/SECURITY.md +5 -0
- package/node_modules/@stdlib/assert-has-symbol-support/dist/index.d.ts +3 -0
- package/node_modules/@stdlib/assert-has-symbol-support/dist/index.js +5 -0
- package/node_modules/@stdlib/assert-has-symbol-support/dist/index.js.map +7 -0
- package/node_modules/@stdlib/assert-has-symbol-support/docs/types/index.d.ts +35 -0
- package/node_modules/@stdlib/assert-has-symbol-support/lib/index.js +40 -0
- package/node_modules/@stdlib/assert-has-symbol-support/lib/main.js +42 -0
- package/node_modules/@stdlib/assert-has-symbol-support/package.json +72 -0
- package/node_modules/@stdlib/assert-has-tostringtag-support/LICENSE +177 -0
- package/node_modules/@stdlib/assert-has-tostringtag-support/NOTICE +1 -0
- package/node_modules/@stdlib/assert-has-tostringtag-support/README.md +187 -0
- package/node_modules/@stdlib/assert-has-tostringtag-support/SECURITY.md +5 -0
- package/node_modules/@stdlib/assert-has-tostringtag-support/dist/index.d.ts +3 -0
- package/node_modules/@stdlib/assert-has-tostringtag-support/dist/index.js +5 -0
- package/node_modules/@stdlib/assert-has-tostringtag-support/dist/index.js.map +7 -0
- package/node_modules/@stdlib/assert-has-tostringtag-support/docs/types/index.d.ts +35 -0
- package/node_modules/@stdlib/assert-has-tostringtag-support/lib/index.js +40 -0
- package/node_modules/@stdlib/assert-has-tostringtag-support/lib/main.js +49 -0
- package/node_modules/@stdlib/assert-has-tostringtag-support/package.json +78 -0
- package/node_modules/@stdlib/assert-is-float32array/LICENSE +177 -0
- package/node_modules/@stdlib/assert-is-float32array/NOTICE +1 -0
- package/node_modules/@stdlib/assert-is-float32array/README.md +229 -0
- package/node_modules/@stdlib/assert-is-float32array/SECURITY.md +5 -0
- package/node_modules/@stdlib/assert-is-float32array/dist/index.d.ts +3 -0
- package/node_modules/@stdlib/assert-is-float32array/dist/index.js +5 -0
- package/node_modules/@stdlib/assert-is-float32array/dist/index.js.map +7 -0
- package/node_modules/@stdlib/assert-is-float32array/docs/types/index.d.ts +42 -0
- package/node_modules/@stdlib/assert-is-float32array/lib/index.js +44 -0
- package/node_modules/@stdlib/assert-is-float32array/lib/main.js +59 -0
- package/node_modules/@stdlib/assert-is-float32array/package.json +81 -0
- package/node_modules/@stdlib/assert-is-number/LICENSE +177 -0
- package/node_modules/@stdlib/assert-is-number/NOTICE +1 -0
- package/node_modules/@stdlib/assert-is-number/README.md +231 -0
- package/node_modules/@stdlib/assert-is-number/SECURITY.md +5 -0
- package/node_modules/@stdlib/assert-is-number/dist/index.d.ts +3 -0
- package/node_modules/@stdlib/assert-is-number/dist/index.js +13 -0
- package/node_modules/@stdlib/assert-is-number/dist/index.js.map +7 -0
- package/node_modules/@stdlib/assert-is-number/docs/types/index.d.ts +121 -0
- package/node_modules/@stdlib/assert-is-number/lib/index.js +79 -0
- package/node_modules/@stdlib/assert-is-number/lib/main.js +58 -0
- package/node_modules/@stdlib/assert-is-number/lib/object.js +66 -0
- package/node_modules/@stdlib/assert-is-number/lib/primitive.js +46 -0
- package/node_modules/@stdlib/assert-is-number/lib/tostring.js +34 -0
- package/node_modules/@stdlib/assert-is-number/lib/try2serialize.js +47 -0
- package/node_modules/@stdlib/assert-is-number/package.json +80 -0
- package/node_modules/@stdlib/complex-float32/LICENSE +177 -0
- package/node_modules/@stdlib/complex-float32/NOTICE +1 -0
- package/node_modules/@stdlib/complex-float32/README.md +629 -0
- package/node_modules/@stdlib/complex-float32/SECURITY.md +5 -0
- package/node_modules/@stdlib/complex-float32/dist/index.d.ts +3 -0
- package/node_modules/@stdlib/complex-float32/dist/index.js +9 -0
- package/node_modules/@stdlib/complex-float32/dist/index.js.map +7 -0
- package/node_modules/@stdlib/complex-float32/docs/types/index.d.ts +111 -0
- package/node_modules/@stdlib/complex-float32/lib/index.js +40 -0
- package/node_modules/@stdlib/complex-float32/lib/main.js +159 -0
- package/node_modules/@stdlib/complex-float32/lib/tojson.js +39 -0
- package/node_modules/@stdlib/complex-float32/lib/tostring.js +42 -0
- package/node_modules/@stdlib/complex-float32/manifest.json +38 -0
- package/node_modules/@stdlib/complex-float32/package.json +76 -0
- package/node_modules/@stdlib/complex-float64/LICENSE +177 -0
- package/node_modules/@stdlib/complex-float64/NOTICE +1 -0
- package/node_modules/@stdlib/complex-float64/README.md +699 -0
- package/node_modules/@stdlib/complex-float64/SECURITY.md +5 -0
- package/node_modules/@stdlib/complex-float64/dist/index.d.ts +3 -0
- package/node_modules/@stdlib/complex-float64/dist/index.js +9 -0
- package/node_modules/@stdlib/complex-float64/dist/index.js.map +7 -0
- package/node_modules/@stdlib/complex-float64/docs/types/index.d.ts +111 -0
- package/node_modules/@stdlib/complex-float64/lib/index.js +40 -0
- package/node_modules/@stdlib/complex-float64/lib/main.js +158 -0
- package/node_modules/@stdlib/complex-float64/lib/tojson.js +39 -0
- package/node_modules/@stdlib/complex-float64/lib/tostring.js +42 -0
- package/node_modules/@stdlib/complex-float64/manifest.json +40 -0
- package/node_modules/@stdlib/complex-float64/package.json +75 -0
- package/node_modules/@stdlib/constants-float64-pinf/LICENSE +177 -0
- package/node_modules/@stdlib/constants-float64-pinf/NOTICE +1 -0
- package/node_modules/@stdlib/constants-float64-pinf/README.md +238 -0
- package/node_modules/@stdlib/constants-float64-pinf/SECURITY.md +5 -0
- package/node_modules/@stdlib/constants-float64-pinf/dist/index.d.ts +3 -0
- package/node_modules/@stdlib/constants-float64-pinf/dist/index.js +3 -0
- package/node_modules/@stdlib/constants-float64-pinf/dist/index.js.map +7 -0
- package/node_modules/@stdlib/constants-float64-pinf/docs/types/index.d.ts +33 -0
- package/node_modules/@stdlib/constants-float64-pinf/lib/index.js +56 -0
- package/node_modules/@stdlib/constants-float64-pinf/manifest.json +36 -0
- package/node_modules/@stdlib/constants-float64-pinf/package.json +71 -0
- package/node_modules/@stdlib/error-tools-fmtprodmsg/LICENSE +177 -0
- package/node_modules/@stdlib/error-tools-fmtprodmsg/NOTICE +1 -0
- package/node_modules/@stdlib/error-tools-fmtprodmsg/README.md +182 -0
- package/node_modules/@stdlib/error-tools-fmtprodmsg/SECURITY.md +5 -0
- package/node_modules/@stdlib/error-tools-fmtprodmsg/dist/index.d.ts +3 -0
- package/node_modules/@stdlib/error-tools-fmtprodmsg/dist/index.js +5 -0
- package/node_modules/@stdlib/error-tools-fmtprodmsg/dist/index.js.map +7 -0
- package/node_modules/@stdlib/error-tools-fmtprodmsg/docs/types/index.d.ts +39 -0
- package/node_modules/@stdlib/error-tools-fmtprodmsg/lib/index.js +40 -0
- package/node_modules/@stdlib/error-tools-fmtprodmsg/lib/main.js +48 -0
- package/node_modules/@stdlib/error-tools-fmtprodmsg/package.json +70 -0
- package/node_modules/@stdlib/number-ctor/LICENSE +177 -0
- package/node_modules/@stdlib/number-ctor/NOTICE +1 -0
- package/node_modules/@stdlib/number-ctor/README.md +212 -0
- package/node_modules/@stdlib/number-ctor/SECURITY.md +5 -0
- package/node_modules/@stdlib/number-ctor/dist/index.d.ts +3 -0
- package/node_modules/@stdlib/number-ctor/dist/index.js +5 -0
- package/node_modules/@stdlib/number-ctor/dist/index.js.map +7 -0
- package/node_modules/@stdlib/number-ctor/docs/types/index.d.ts +30 -0
- package/node_modules/@stdlib/number-ctor/lib/index.js +40 -0
- package/node_modules/@stdlib/number-ctor/lib/main.js +23 -0
- package/node_modules/@stdlib/number-ctor/package.json +62 -0
- package/node_modules/@stdlib/number-float64-base-to-float32/LICENSE +177 -0
- package/node_modules/@stdlib/number-float64-base-to-float32/NOTICE +1 -0
- package/node_modules/@stdlib/number-float64-base-to-float32/README.md +191 -0
- package/node_modules/@stdlib/number-float64-base-to-float32/SECURITY.md +5 -0
- package/node_modules/@stdlib/number-float64-base-to-float32/dist/index.d.ts +3 -0
- package/node_modules/@stdlib/number-float64-base-to-float32/dist/index.js +19 -0
- package/node_modules/@stdlib/number-float64-base-to-float32/dist/index.js.map +7 -0
- package/node_modules/@stdlib/number-float64-base-to-float32/docs/types/index.d.ts +36 -0
- package/node_modules/@stdlib/number-float64-base-to-float32/lib/index.js +51 -0
- package/node_modules/@stdlib/number-float64-base-to-float32/lib/main.js +28 -0
- package/node_modules/@stdlib/number-float64-base-to-float32/lib/polyfill.js +51 -0
- package/node_modules/@stdlib/number-float64-base-to-float32/package.json +76 -0
- package/node_modules/@stdlib/string-base-format-interpolate/LICENSE +177 -0
- package/node_modules/@stdlib/string-base-format-interpolate/NOTICE +1 -0
- package/node_modules/@stdlib/string-base-format-interpolate/README.md +219 -0
- package/node_modules/@stdlib/string-base-format-interpolate/SECURITY.md +5 -0
- package/node_modules/@stdlib/string-base-format-interpolate/dist/index.d.ts +3 -0
- package/node_modules/@stdlib/string-base-format-interpolate/dist/index.js +17 -0
- package/node_modules/@stdlib/string-base-format-interpolate/dist/index.js.map +7 -0
- package/node_modules/@stdlib/string-base-format-interpolate/docs/types/index.d.ts +71 -0
- package/node_modules/@stdlib/string-base-format-interpolate/lib/format_double.js +103 -0
- package/node_modules/@stdlib/string-base-format-interpolate/lib/format_integer.js +115 -0
- package/node_modules/@stdlib/string-base-format-interpolate/lib/index.js +41 -0
- package/node_modules/@stdlib/string-base-format-interpolate/lib/is_number.js +46 -0
- package/node_modules/@stdlib/string-base-format-interpolate/lib/is_string.js +42 -0
- package/node_modules/@stdlib/string-base-format-interpolate/lib/main.js +243 -0
- package/node_modules/@stdlib/string-base-format-interpolate/lib/space_pad.js +65 -0
- package/node_modules/@stdlib/string-base-format-interpolate/lib/zero_pad.js +84 -0
- package/node_modules/@stdlib/string-base-format-interpolate/package.json +71 -0
- package/node_modules/@stdlib/string-base-format-tokenize/LICENSE +177 -0
- package/node_modules/@stdlib/string-base-format-tokenize/NOTICE +1 -0
- package/node_modules/@stdlib/string-base-format-tokenize/README.md +203 -0
- package/node_modules/@stdlib/string-base-format-tokenize/SECURITY.md +5 -0
- package/node_modules/@stdlib/string-base-format-tokenize/dist/index.d.ts +3 -0
- package/node_modules/@stdlib/string-base-format-tokenize/dist/index.js +5 -0
- package/node_modules/@stdlib/string-base-format-tokenize/dist/index.js.map +7 -0
- package/node_modules/@stdlib/string-base-format-tokenize/docs/types/index.d.ts +68 -0
- package/node_modules/@stdlib/string-base-format-tokenize/lib/index.js +41 -0
- package/node_modules/@stdlib/string-base-format-tokenize/lib/main.js +95 -0
- package/node_modules/@stdlib/string-base-format-tokenize/package.json +69 -0
- package/node_modules/@stdlib/string-format/LICENSE +177 -0
- package/node_modules/@stdlib/string-format/NOTICE +1 -0
- package/node_modules/@stdlib/string-format/README.md +341 -0
- package/node_modules/@stdlib/string-format/SECURITY.md +5 -0
- package/node_modules/@stdlib/string-format/dist/index.d.ts +3 -0
- package/node_modules/@stdlib/string-format/dist/index.js +7 -0
- package/node_modules/@stdlib/string-format/dist/index.js.map +7 -0
- package/node_modules/@stdlib/string-format/docs/types/index.d.ts +42 -0
- package/node_modules/@stdlib/string-format/lib/index.js +43 -0
- package/node_modules/@stdlib/string-format/lib/is_string.js +42 -0
- package/node_modules/@stdlib/string-format/lib/main.js +64 -0
- package/node_modules/@stdlib/string-format/package.json +72 -0
- package/node_modules/@stdlib/symbol-ctor/LICENSE +177 -0
- package/node_modules/@stdlib/symbol-ctor/NOTICE +1 -0
- package/node_modules/@stdlib/symbol-ctor/README.md +234 -0
- package/node_modules/@stdlib/symbol-ctor/SECURITY.md +5 -0
- package/node_modules/@stdlib/symbol-ctor/dist/index.d.ts +3 -0
- package/node_modules/@stdlib/symbol-ctor/dist/index.js +5 -0
- package/node_modules/@stdlib/symbol-ctor/dist/index.js.map +7 -0
- package/node_modules/@stdlib/symbol-ctor/docs/types/index.d.ts +34 -0
- package/node_modules/@stdlib/symbol-ctor/lib/index.js +40 -0
- package/node_modules/@stdlib/symbol-ctor/lib/main.js +28 -0
- package/node_modules/@stdlib/symbol-ctor/package.json +62 -0
- package/node_modules/@stdlib/types/LICENSE +177 -0
- package/node_modules/@stdlib/types/NOTICE +1 -0
- package/node_modules/@stdlib/types/README.md +212 -0
- package/node_modules/@stdlib/types/SECURITY.md +5 -0
- package/node_modules/@stdlib/types/index.d.ts +3923 -0
- package/node_modules/@stdlib/types/lib/browser.js +28 -0
- package/node_modules/@stdlib/types/lib/index.js +39 -0
- package/node_modules/@stdlib/types/lib/main.js +40 -0
- package/node_modules/@stdlib/types/package.json +67 -0
- package/node_modules/@stdlib/types/test.ts +734 -0
- package/node_modules/@stdlib/utils-define-nonenumerable-read-only-property/LICENSE +177 -0
- package/node_modules/@stdlib/utils-define-nonenumerable-read-only-property/NOTICE +1 -0
- package/node_modules/@stdlib/utils-define-nonenumerable-read-only-property/README.md +216 -0
- package/node_modules/@stdlib/utils-define-nonenumerable-read-only-property/SECURITY.md +5 -0
- package/node_modules/@stdlib/utils-define-nonenumerable-read-only-property/dist/index.d.ts +3 -0
- package/node_modules/@stdlib/utils-define-nonenumerable-read-only-property/dist/index.js +31 -0
- package/node_modules/@stdlib/utils-define-nonenumerable-read-only-property/dist/index.js.map +7 -0
- package/node_modules/@stdlib/utils-define-nonenumerable-read-only-property/dist/main.js +58 -0
- package/node_modules/@stdlib/utils-define-nonenumerable-read-only-property/docs/types/index.d.ts +52 -0
- package/node_modules/@stdlib/utils-define-nonenumerable-read-only-property/lib/index.js +47 -0
- package/node_modules/@stdlib/utils-define-nonenumerable-read-only-property/lib/main.js +58 -0
- package/node_modules/@stdlib/utils-define-nonenumerable-read-only-property/package.json +92 -0
- package/node_modules/@stdlib/utils-define-property/LICENSE +177 -0
- package/node_modules/@stdlib/utils-define-property/NOTICE +1 -0
- package/node_modules/@stdlib/utils-define-property/README.md +228 -0
- package/node_modules/@stdlib/utils-define-property/SECURITY.md +5 -0
- package/node_modules/@stdlib/utils-define-property/dist/index.d.ts +3 -0
- package/node_modules/@stdlib/utils-define-property/dist/index.js +36 -0
- package/node_modules/@stdlib/utils-define-property/dist/index.js.map +7 -0
- package/node_modules/@stdlib/utils-define-property/docs/types/index.d.ts +52 -0
- package/node_modules/@stdlib/utils-define-property/lib/builtin.js +61 -0
- package/node_modules/@stdlib/utils-define-property/lib/define_property.js +28 -0
- package/node_modules/@stdlib/utils-define-property/lib/has_define_property_support.js +51 -0
- package/node_modules/@stdlib/utils-define-property/lib/index.js +58 -0
- package/node_modules/@stdlib/utils-define-property/lib/polyfill.js +122 -0
- package/node_modules/@stdlib/utils-define-property/package.json +74 -0
- package/node_modules/@stdlib/utils-native-class/LICENSE +177 -0
- package/node_modules/@stdlib/utils-native-class/NOTICE +1 -0
- package/node_modules/@stdlib/utils-native-class/README.md +349 -0
- package/node_modules/@stdlib/utils-native-class/SECURITY.md +5 -0
- package/node_modules/@stdlib/utils-native-class/dist/index.d.ts +3 -0
- package/node_modules/@stdlib/utils-native-class/dist/index.js +11 -0
- package/node_modules/@stdlib/utils-native-class/dist/index.js.map +7 -0
- package/node_modules/@stdlib/utils-native-class/docs/types/index.d.ts +51 -0
- package/node_modules/@stdlib/utils-native-class/lib/index.js +61 -0
- package/node_modules/@stdlib/utils-native-class/lib/main.js +56 -0
- package/node_modules/@stdlib/utils-native-class/lib/polyfill.js +81 -0
- package/node_modules/@stdlib/utils-native-class/lib/tostring.js +28 -0
- package/node_modules/@stdlib/utils-native-class/lib/tostringtag.js +33 -0
- package/node_modules/@stdlib/utils-native-class/package.json +83 -0
- package/package.json +71 -3
- package/src/main.c +42 -0
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Copyright (c) 2016-2026 The Stdlib Authors.
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
|
|
3
|
+
@license Apache-2.0
|
|
4
|
+
|
|
5
|
+
Copyright (c) 2022 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
|
+
|
|
19
|
+
-->
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
<details>
|
|
23
|
+
<summary>
|
|
24
|
+
About stdlib...
|
|
25
|
+
</summary>
|
|
26
|
+
<p>We believe in a future in which the web is a preferred environment for numerical computation. To help realize this future, we've built stdlib. stdlib is a standard library, with an emphasis on numerical and scientific computation, written in JavaScript (and C) for execution in browsers and in Node.js.</p>
|
|
27
|
+
<p>The library is fully decomposable, being architected in such a way that you can swap out and mix and match APIs and functionality to cater to your exact preferences and use cases.</p>
|
|
28
|
+
<p>When you use stdlib, you can be absolutely certain that you are using the most thorough, rigorous, well-written, studied, documented, tested, measured, and high-quality code out there.</p>
|
|
29
|
+
<p>To join us in bringing numerical computing to the web, get started by checking us out on <a href="https://github.com/stdlib-js/stdlib">GitHub</a>, and please consider <a href="https://opencollective.com/stdlib">financially supporting stdlib</a>. We greatly appreciate your continued support!</p>
|
|
30
|
+
</details>
|
|
31
|
+
|
|
32
|
+
# formatInterpolate
|
|
33
|
+
|
|
34
|
+
[![NPM version][npm-image]][npm-url] [![Build Status][test-image]][test-url] [![Coverage Status][coverage-image]][coverage-url] <!-- [![dependencies][dependencies-image]][dependencies-url] -->
|
|
35
|
+
|
|
36
|
+
> Generate string from a token array by interpolating values.
|
|
37
|
+
|
|
38
|
+
<section class="intro">
|
|
39
|
+
|
|
40
|
+
</section>
|
|
41
|
+
|
|
42
|
+
<!-- /.intro -->
|
|
43
|
+
|
|
44
|
+
<section class="installation">
|
|
45
|
+
|
|
46
|
+
## Installation
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
npm install @stdlib/string-base-format-interpolate
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
</section>
|
|
53
|
+
|
|
54
|
+
<section class="usage">
|
|
55
|
+
|
|
56
|
+
## Usage
|
|
57
|
+
|
|
58
|
+
```javascript
|
|
59
|
+
var formatInterpolate = require( '@stdlib/string-base-format-interpolate' );
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
#### formatInterpolate( tokens, ...args )
|
|
63
|
+
|
|
64
|
+
Generates string from a token array by interpolating values.
|
|
65
|
+
|
|
66
|
+
```javascript
|
|
67
|
+
var formatTokenize = require( '@stdlib/string-base-format-tokenize' );
|
|
68
|
+
|
|
69
|
+
var str = 'Hello, %s! My name is %s.';
|
|
70
|
+
var tokens = formatTokenize( str );
|
|
71
|
+
var out = formatInterpolate( tokens, 'World', 'Bob' );
|
|
72
|
+
// returns 'Hello, World! My name is Bob.'
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
The array of `tokens` should contain string parts and format identifier objects.
|
|
76
|
+
|
|
77
|
+
```javascript
|
|
78
|
+
var tokens = [ 'beep ', { 'specifier': 's' } ];
|
|
79
|
+
var out = formatInterpolate( tokens, 'boop' );
|
|
80
|
+
// returns 'beep boop'
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Format identifier objects can have the following properties:
|
|
84
|
+
|
|
85
|
+
| property | description |
|
|
86
|
+
| --------- | --------------------------------------------------------------------------------------------------- |
|
|
87
|
+
| specifier | format specifier (one of 's', 'c', 'd', 'i', 'u', 'b', 'o', 'x', 'X', 'e', 'E', 'f', 'F', 'g', 'G') |
|
|
88
|
+
| flags | format flags (string with any of '0', ' ', '+', '-', '#') |
|
|
89
|
+
| width | minimum field width (integer or `'*'`) |
|
|
90
|
+
| precision | precision (integer or `'*'`) |
|
|
91
|
+
| mapping | positional mapping from format specifier to argument index |
|
|
92
|
+
|
|
93
|
+
</section>
|
|
94
|
+
|
|
95
|
+
<!-- /.usage -->
|
|
96
|
+
|
|
97
|
+
<section class="examples">
|
|
98
|
+
|
|
99
|
+
## Examples
|
|
100
|
+
|
|
101
|
+
<!-- eslint no-undef: "error" -->
|
|
102
|
+
|
|
103
|
+
```javascript
|
|
104
|
+
var formatTokenize = require( '@stdlib/string-base-format-tokenize' );
|
|
105
|
+
var PI = require( '@stdlib/constants-float64-pi' );
|
|
106
|
+
var formatInterpolate = require( '@stdlib/string-base-format-interpolate' );
|
|
107
|
+
|
|
108
|
+
var tokens = formatTokenize( 'Hello %s!' );
|
|
109
|
+
var out = formatInterpolate( tokens, 'World' );
|
|
110
|
+
// returns 'Hello World!'
|
|
111
|
+
|
|
112
|
+
tokens = formatTokenize( 'Pi: ~%.2f' );
|
|
113
|
+
out = formatInterpolate( tokens, PI );
|
|
114
|
+
// returns 'Pi: ~3.14'
|
|
115
|
+
|
|
116
|
+
tokens = formatTokenize( 'Index: %d, Value: %s' );
|
|
117
|
+
out = formatInterpolate( tokens, 0, 'foo' );
|
|
118
|
+
// returns 'Index: 0, Value: foo'
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
</section>
|
|
122
|
+
|
|
123
|
+
<!-- /.examples -->
|
|
124
|
+
|
|
125
|
+
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
|
|
126
|
+
|
|
127
|
+
<section class="related">
|
|
128
|
+
|
|
129
|
+
* * *
|
|
130
|
+
|
|
131
|
+
## See Also
|
|
132
|
+
|
|
133
|
+
- <span class="package-name">[`@stdlib/string-base/format-tokenize`][@stdlib/string/base/format-tokenize]</span><span class="delimiter">: </span><span class="description">tokenize a string into an array of string parts and format identifier objects.</span>
|
|
134
|
+
|
|
135
|
+
</section>
|
|
136
|
+
|
|
137
|
+
<!-- /.related -->
|
|
138
|
+
|
|
139
|
+
<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
<section class="main-repo" >
|
|
143
|
+
|
|
144
|
+
* * *
|
|
145
|
+
|
|
146
|
+
## Notice
|
|
147
|
+
|
|
148
|
+
This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more.
|
|
149
|
+
|
|
150
|
+
For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib].
|
|
151
|
+
|
|
152
|
+
#### Community
|
|
153
|
+
|
|
154
|
+
[![Chat][chat-image]][chat-url]
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
## License
|
|
159
|
+
|
|
160
|
+
See [LICENSE][stdlib-license].
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
## Copyright
|
|
164
|
+
|
|
165
|
+
Copyright © 2016-2026. The Stdlib [Authors][stdlib-authors].
|
|
166
|
+
|
|
167
|
+
</section>
|
|
168
|
+
|
|
169
|
+
<!-- /.stdlib -->
|
|
170
|
+
|
|
171
|
+
<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
|
|
172
|
+
|
|
173
|
+
<section class="links">
|
|
174
|
+
|
|
175
|
+
[npm-image]: http://img.shields.io/npm/v/@stdlib/string-base-format-interpolate.svg
|
|
176
|
+
[npm-url]: https://npmjs.org/package/@stdlib/string-base-format-interpolate
|
|
177
|
+
|
|
178
|
+
[test-image]: https://github.com/stdlib-js/string-base-format-interpolate/actions/workflows/test.yml/badge.svg?branch=v0.2.4
|
|
179
|
+
[test-url]: https://github.com/stdlib-js/string-base-format-interpolate/actions/workflows/test.yml?query=branch:v0.2.4
|
|
180
|
+
|
|
181
|
+
[coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/string-base-format-interpolate/main.svg
|
|
182
|
+
[coverage-url]: https://codecov.io/github/stdlib-js/string-base-format-interpolate?branch=main
|
|
183
|
+
|
|
184
|
+
<!--
|
|
185
|
+
|
|
186
|
+
[dependencies-image]: https://img.shields.io/david/stdlib-js/string-base-format-interpolate.svg
|
|
187
|
+
[dependencies-url]: https://david-dm.org/stdlib-js/string-base-format-interpolate/main
|
|
188
|
+
|
|
189
|
+
-->
|
|
190
|
+
|
|
191
|
+
[chat-image]: https://img.shields.io/badge/zulip-join_chat-brightgreen.svg
|
|
192
|
+
[chat-url]: https://stdlib.zulipchat.com
|
|
193
|
+
|
|
194
|
+
[stdlib]: https://github.com/stdlib-js/stdlib
|
|
195
|
+
|
|
196
|
+
[stdlib-authors]: https://github.com/stdlib-js/stdlib/graphs/contributors
|
|
197
|
+
|
|
198
|
+
[umd]: https://github.com/umdjs/umd
|
|
199
|
+
[es-module]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules
|
|
200
|
+
|
|
201
|
+
[deno-url]: https://github.com/stdlib-js/string-base-format-interpolate/tree/deno
|
|
202
|
+
[deno-readme]: https://github.com/stdlib-js/string-base-format-interpolate/blob/deno/README.md
|
|
203
|
+
[umd-url]: https://github.com/stdlib-js/string-base-format-interpolate/tree/umd
|
|
204
|
+
[umd-readme]: https://github.com/stdlib-js/string-base-format-interpolate/blob/umd/README.md
|
|
205
|
+
[esm-url]: https://github.com/stdlib-js/string-base-format-interpolate/tree/esm
|
|
206
|
+
[esm-readme]: https://github.com/stdlib-js/string-base-format-interpolate/blob/esm/README.md
|
|
207
|
+
[branches-url]: https://github.com/stdlib-js/string-base-format-interpolate/blob/main/branches.md
|
|
208
|
+
|
|
209
|
+
[stdlib-license]: https://raw.githubusercontent.com/stdlib-js/string-base-format-interpolate/main/LICENSE
|
|
210
|
+
|
|
211
|
+
<!-- <related-links> -->
|
|
212
|
+
|
|
213
|
+
[@stdlib/string/base/format-tokenize]: https://www.npmjs.com/package/@stdlib/string-base-format-tokenize
|
|
214
|
+
|
|
215
|
+
<!-- </related-links> -->
|
|
216
|
+
|
|
217
|
+
</section>
|
|
218
|
+
|
|
219
|
+
<!-- /.links -->
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";var n=function(e,i){return function(){return i||e((i={exports:{}}).exports,i),i.exports}};var d=n(function(pr,h){
|
|
2
|
+
function C(e){return typeof e=="number"}h.exports=C
|
|
3
|
+
});var v=n(function(fr,E){
|
|
4
|
+
function D(e){return e[0]==="-"}function w(e){var i="",a;for(a=0;a<e;a++)i+="0";return i}function G(e,i,a){var r=!1,t=i-e.length;return t<0||(D(e)&&(r=!0,e=e.substr(1)),e=a?e+w(t):w(t)+e,r&&(e="-"+e)),e}E.exports=G
|
|
5
|
+
});var R=n(function(ur,x){
|
|
6
|
+
var V=d(),b=v(),Z=String.prototype.toLowerCase,m=String.prototype.toUpperCase;function X(e){var i,a,r;switch(e.specifier){case"b":i=2;break;case"o":i=8;break;case"x":case"X":i=16;break;default:i=10;break}if(a=e.arg,r=parseInt(a,10),!isFinite(r)){if(!V(a))throw new Error("invalid integer. Value: "+a);r=0}return r<0&&(e.specifier==="u"||i!==10)&&(r=4294967295+r+1),r<0?(a=(-r).toString(i),e.precision&&(a=b(a,e.precision,e.padRight)),a="-"+a):(a=r.toString(i),!r&&!e.precision?a="":e.precision&&(a=b(a,e.precision,e.padRight)),e.sign&&(a=e.sign+a)),i===16&&(e.alternate&&(a="0x"+a),a=e.specifier===m.call(e.specifier)?m.call(a):Z.call(a)),i===8&&e.alternate&&a.charAt(0)!=="0"&&(a="0"+a),a}x.exports=X
|
|
7
|
+
});var _=n(function(lr,I){
|
|
8
|
+
function A(e){return typeof e=="string"}I.exports=A
|
|
9
|
+
});var P=n(function(gr,y){
|
|
10
|
+
var N=Math.abs,z=String.prototype.toLowerCase,S=String.prototype.toUpperCase,c=String.prototype.replace,W=/e\+(\d)$/,L=/e-(\d)$/,B=/^(\d+)$/,M=/^(\d+)e/,U=/\.0$/,j=/\.0*e/,Y=/(\..*[^0])0*e/;function H(e,i){var a,r;switch(i.specifier){case"e":case"E":r=e.toExponential(i.precision);break;case"f":case"F":r=e.toFixed(i.precision);break;case"g":case"G":N(e)<1e-4?(a=i.precision,a>0&&(a-=1),r=e.toExponential(a)):r=e.toPrecision(i.precision),i.alternate||(r=c.call(r,Y,"$1e"),r=c.call(r,j,"e"),r=c.call(r,U,""));break;default:throw new Error("invalid double notation. Value: "+i.specifier)}return r=c.call(r,W,"e+0$1"),r=c.call(r,L,"e-0$1"),i.alternate&&(r=c.call(r,B,"$1."),r=c.call(r,M,"$1.e")),e>=0&&i.sign&&(r=i.sign+r),r=i.specifier===S.call(i.specifier)?S.call(r):z.call(r),r}y.exports=H
|
|
11
|
+
});var q=n(function(dr,T){
|
|
12
|
+
function O(e){var i="",a;for(a=0;a<e;a++)i+=" ";return i}function J(e,i,a){var r=i-e.length;return r<0||(e=a?e+O(r):O(r)+e),e}T.exports=J
|
|
13
|
+
});var $=n(function(vr,F){
|
|
14
|
+
var K=R(),Q=_(),k=d(),rr=P(),er=q(),ir=v(),ar=String.fromCharCode,sr=Array.isArray;function g(e){return e!==e}function tr(e){var i={};return i.specifier=e.specifier,i.precision=e.precision===void 0?1:e.precision,i.width=e.width,i.flags=e.flags||"",i.mapping=e.mapping,i}function nr(e){var i,a,r,t,o,p,s,u,f,l;if(!sr(e))throw new TypeError("invalid argument. First argument must be an array. Value: `"+e+"`.");for(p="",s=1,f=0;f<e.length;f++)if(r=e[f],Q(r))p+=r;else{if(i=r.precision!==void 0,r=tr(r),!r.specifier)throw new TypeError("invalid argument. Token is missing `specifier` property. Index: `"+f+"`. Value: `"+r+"`.");for(r.mapping&&(s=r.mapping),a=r.flags,l=0;l<a.length;l++)switch(t=a.charAt(l),t){case" ":r.sign=" ";break;case"+":r.sign="+";break;case"-":r.padRight=!0,r.padZeros=!1;break;case"0":r.padZeros=a.indexOf("-")<0;break;case"#":r.alternate=!0;break;default:throw new Error("invalid flag: "+t)}if(r.width==="*"){if(r.width=parseInt(arguments[s],10),s+=1,g(r.width))throw new TypeError("the argument for * width at position "+s+" is not a number. Value: `"+r.width+"`.");r.width<0&&(r.padRight=!0,r.width=-r.width)}if(i&&r.precision==="*"){if(r.precision=parseInt(arguments[s],10),s+=1,g(r.precision))throw new TypeError("the argument for * precision at position "+s+" is not a number. Value: `"+r.precision+"`.");r.precision<0&&(r.precision=1,i=!1)}switch(r.arg=arguments[s],r.specifier){case"b":case"o":case"x":case"X":case"d":case"i":case"u":i&&(r.padZeros=!1),r.arg=K(r);break;case"s":r.maxWidth=i?r.precision:-1,r.arg=String(r.arg);break;case"c":if(!g(r.arg)){if(o=parseInt(r.arg,10),o<0||o>127)throw new Error("invalid character code. Value: "+r.arg);r.arg=g(o)?String(r.arg):ar(o)}break;case"e":case"E":case"f":case"F":case"g":case"G":if(i||(r.precision=6),u=parseFloat(r.arg),!isFinite(u)){if(!k(r.arg))throw new Error("invalid floating-point number. Value: "+p);u=r.arg,r.padZeros=!1}r.arg=rr(u,r);break;default:throw new Error("invalid specifier: "+r.specifier)}r.maxWidth>=0&&r.arg.length>r.maxWidth&&(r.arg=r.arg.substring(0,r.maxWidth)),r.padZeros?r.arg=ir(r.arg,r.width||r.precision,r.padRight):r.width&&(r.arg=er(r.arg,r.width,r.padRight)),p+=r.arg||"",s+=1}return p}F.exports=nr
|
|
15
|
+
});var cr=$();module.exports=cr;
|
|
16
|
+
/** @license Apache-2.0 */
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../lib/is_number.js", "../lib/zero_pad.js", "../lib/format_integer.js", "../lib/is_string.js", "../lib/format_double.js", "../lib/space_pad.js", "../lib/main.js", "../lib/index.js"],
|
|
4
|
+
"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/**\n* Tests if a value is a number primitive.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number primitive\n*\n* @example\n* var bool = isNumber( 3.14 );\n* // returns true\n*\n* @example\n* var bool = isNumber( NaN );\n* // returns true\n*\n* @example\n* var bool = isNumber( new Number( 3.14 ) );\n* // returns false\n*/\nfunction isNumber( value ) {\n\treturn ( typeof value === 'number' ); // NOTE: we inline the `isNumber.isPrimitive` function from `@stdlib/assert/is-number` in order to avoid circular dependencies.\n}\n\n\n// EXPORTS //\n\nmodule.exports = isNumber;\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// FUNCTIONS //\n\n/**\n* Tests if a string starts with a minus sign (`-`).\n*\n* @private\n* @param {string} str - input string\n* @returns {boolean} boolean indicating if a string starts with a minus sign (`-`)\n*/\nfunction startsWithMinus( str ) {\n\treturn str[ 0 ] === '-';\n}\n\n/**\n* Returns a string of `n` zeros.\n*\n* @private\n* @param {number} n - number of zeros\n* @returns {string} string of zeros\n*/\nfunction zeros( n ) {\n\tvar out = '';\n\tvar i;\n\tfor ( i = 0; i < n; i++ ) {\n\t\tout += '0';\n\t}\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Pads a token with zeros to the specified width.\n*\n* @private\n* @param {string} str - token argument\n* @param {number} width - token width\n* @param {boolean} [right=false] - boolean indicating whether to pad to the right\n* @returns {string} padded token argument\n*/\nfunction zeroPad( str, width, right ) {\n\tvar negative = false;\n\tvar pad = width - str.length;\n\tif ( pad < 0 ) {\n\t\treturn str;\n\t}\n\tif ( startsWithMinus( str ) ) {\n\t\tnegative = true;\n\t\tstr = str.substr( 1 );\n\t}\n\tstr = ( right ) ?\n\t\tstr + zeros( pad ) :\n\t\tzeros( pad ) + str;\n\tif ( negative ) {\n\t\tstr = '-' + str;\n\t}\n\treturn str;\n}\n\n\n// EXPORTS //\n\nmodule.exports = zeroPad;\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// MODULES //\n\nvar isNumber = require( './is_number.js' );\nvar zeroPad = require( './zero_pad.js' );\n\n// NOTE: for the following, we explicitly avoid using stdlib packages in this particular package in order to avoid circular dependencies.\nvar lowercase = String.prototype.toLowerCase;\nvar uppercase = String.prototype.toUpperCase;\n\n\n// MAIN //\n\n/**\n* Formats a token object argument as an integer.\n*\n* @private\n* @param {Object} token - token object\n* @throws {Error} must provide a valid integer\n* @returns {string} formatted token argument\n*/\nfunction formatInteger( token ) {\n\tvar base;\n\tvar out;\n\tvar i;\n\n\tswitch ( token.specifier ) {\n\tcase 'b':\n\t\t// Case: %b (binary)\n\t\tbase = 2;\n\t\tbreak;\n\tcase 'o':\n\t\t// Case: %o (octal)\n\t\tbase = 8;\n\t\tbreak;\n\tcase 'x':\n\tcase 'X':\n\t\t// Case: %x, %X (hexadecimal)\n\t\tbase = 16;\n\t\tbreak;\n\tcase 'd':\n\tcase 'i':\n\tcase 'u':\n\tdefault:\n\t\t// Case: %d, %i, %u (decimal)\n\t\tbase = 10;\n\t\tbreak;\n\t}\n\tout = token.arg;\n\ti = parseInt( out, 10 );\n\tif ( !isFinite( i ) ) { // NOTE: We use the global `isFinite` function here instead of `@stdlib/math/base/assert/is-finite` in order to avoid circular dependencies.\n\t\tif ( !isNumber( out ) ) {\n\t\t\tthrow new Error( 'invalid integer. Value: ' + out );\n\t\t}\n\t\ti = 0;\n\t}\n\tif ( i < 0 && ( token.specifier === 'u' || base !== 10 ) ) {\n\t\ti = 0xffffffff + i + 1;\n\t}\n\tif ( i < 0 ) {\n\t\tout = ( -i ).toString( base );\n\t\tif ( token.precision ) {\n\t\t\tout = zeroPad( out, token.precision, token.padRight );\n\t\t}\n\t\tout = '-' + out;\n\t} else {\n\t\tout = i.toString( base );\n\t\tif ( !i && !token.precision ) {\n\t\t\tout = '';\n\t\t} else if ( token.precision ) {\n\t\t\tout = zeroPad( out, token.precision, token.padRight );\n\t\t}\n\t\tif ( token.sign ) {\n\t\t\tout = token.sign + out;\n\t\t}\n\t}\n\tif ( base === 16 ) {\n\t\tif ( token.alternate ) {\n\t\t\tout = '0x' + out;\n\t\t}\n\t\tout = ( token.specifier === uppercase.call( token.specifier ) ) ?\n\t\t\tuppercase.call( out ) :\n\t\t\tlowercase.call( out );\n\t}\n\tif ( base === 8 ) {\n\t\tif ( token.alternate && out.charAt( 0 ) !== '0' ) {\n\t\t\tout = '0' + out;\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nmodule.exports = formatInteger;\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* Tests if a value is a string primitive.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a string primitive\n*\n* @example\n* var bool = isString( 'beep' );\n* // returns true\n*\n* @example\n* var bool = isString( new String( 'beep' ) );\n* // returns false\n*/\nfunction isString( value ) {\n\treturn ( typeof value === 'string' ); // NOTE: we inline the `isString.isPrimitive` function from `@stdlib/assert/is-string` in order to avoid circular dependencies.\n}\n\n\n// EXPORTS //\n\nmodule.exports = isString;\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// MODULES //\n\n// NOTE: for the following, we explicitly avoid using stdlib packages in this particular package in order to avoid circular dependencies.\nvar abs = Math.abs; // eslint-disable-line stdlib/no-builtin-math\nvar lowercase = String.prototype.toLowerCase;\nvar uppercase = String.prototype.toUpperCase;\nvar replace = String.prototype.replace;\n\n\n// VARIABLES //\n\nvar RE_EXP_POS_DIGITS = /e\\+(\\d)$/;\nvar RE_EXP_NEG_DIGITS = /e-(\\d)$/;\nvar RE_ONLY_DIGITS = /^(\\d+)$/;\nvar RE_DIGITS_BEFORE_EXP = /^(\\d+)e/;\nvar RE_TRAILING_PERIOD_ZERO = /\\.0$/;\nvar RE_PERIOD_ZERO_EXP = /\\.0*e/;\nvar RE_ZERO_BEFORE_EXP = /(\\..*[^0])0*e/;\n\n\n// MAIN //\n\n/**\n* Formats a token object argument as a floating-point number.\n*\n* @private\n* @param {number} f - parsed number\n* @param {Object} token - token object\n* @throws {Error} must provide a valid floating-point number\n* @returns {string} formatted token argument\n*/\nfunction formatDouble( f, token ) {\n\tvar digits;\n\tvar out;\n\n\tswitch ( token.specifier ) {\n\tcase 'e':\n\tcase 'E':\n\t\tout = f.toExponential( token.precision );\n\t\tbreak;\n\tcase 'f':\n\tcase 'F':\n\t\tout = f.toFixed( token.precision );\n\t\tbreak;\n\tcase 'g':\n\tcase 'G':\n\t\tif ( abs( f ) < 0.0001 ) {\n\t\t\tdigits = token.precision;\n\t\t\tif ( digits > 0 ) {\n\t\t\t\tdigits -= 1;\n\t\t\t}\n\t\t\tout = f.toExponential( digits );\n\t\t} else {\n\t\t\tout = f.toPrecision( token.precision );\n\t\t}\n\t\tif ( !token.alternate ) {\n\t\t\tout = replace.call( out, RE_ZERO_BEFORE_EXP, '$1e' );\n\t\t\tout = replace.call( out, RE_PERIOD_ZERO_EXP, 'e' );\n\t\t\tout = replace.call( out, RE_TRAILING_PERIOD_ZERO, '' );\n\t\t}\n\t\tbreak;\n\tdefault:\n\t\tthrow new Error( 'invalid double notation. Value: ' + token.specifier );\n\t}\n\tout = replace.call( out, RE_EXP_POS_DIGITS, 'e+0$1' );\n\tout = replace.call( out, RE_EXP_NEG_DIGITS, 'e-0$1' );\n\tif ( token.alternate ) {\n\t\tout = replace.call( out, RE_ONLY_DIGITS, '$1.' );\n\t\tout = replace.call( out, RE_DIGITS_BEFORE_EXP, '$1.e' );\n\t}\n\tif ( f >= 0 && token.sign ) {\n\t\tout = token.sign + out;\n\t}\n\tout = ( token.specifier === uppercase.call( token.specifier ) ) ?\n\t\tuppercase.call( out ) :\n\t\tlowercase.call( out );\n\treturn out;\n}\n\n\n// EXPORTS //\n\nmodule.exports = formatDouble;\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// FUNCTIONS //\n\n/**\n* Returns `n` spaces.\n*\n* @private\n* @param {number} n - number of spaces\n* @returns {string} string of spaces\n*/\nfunction spaces( n ) {\n\tvar out = '';\n\tvar i;\n\tfor ( i = 0; i < n; i++ ) {\n\t\tout += ' ';\n\t}\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Pads a token with spaces to the specified width.\n*\n* @private\n* @param {string} str - token argument\n* @param {number} width - token width\n* @param {boolean} [right=false] - boolean indicating whether to pad to the right\n* @returns {string} padded token argument\n*/\nfunction spacePad( str, width, right ) {\n\tvar pad = width - str.length;\n\tif ( pad < 0 ) {\n\t\treturn str;\n\t}\n\tstr = ( right ) ?\n\t\tstr + spaces( pad ) :\n\t\tspaces( pad ) + str;\n\treturn str;\n}\n\n\n// EXPORTS //\n\nmodule.exports = spacePad;\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// MODULES //\n\nvar formatInteger = require( './format_integer.js' );\nvar isString = require( './is_string.js' );\nvar isNumber = require( './is_number.js' );\nvar formatDouble = require( './format_double.js' );\nvar spacePad = require( './space_pad.js' );\nvar zeroPad = require( './zero_pad.js' );\n\n\n// VARIABLES //\n\nvar fromCharCode = String.fromCharCode;\nvar isArray = Array.isArray; // NOTE: We use the global `Array.isArray` function here instead of `@stdlib/assert/is-array` to avoid circular dependencies.\n\n\n// FUNCTIONS //\n\n/**\n* Returns a boolean indicating whether a value is `NaN`.\n*\n* @private\n* @param {*} value - input value\n* @returns {boolean} boolean indicating whether a value is `NaN`\n*\n* @example\n* var bool = isnan( NaN );\n* // returns true\n*\n* @example\n* var bool = isnan( 4 );\n* // returns false\n*/\nfunction isnan( value ) { // explicitly define a function here instead of `@stdlib/math/base/assert/is-nan` in order to avoid circular dependencies\n\treturn ( value !== value );\n}\n\n/**\n* Initializes token object with properties of supplied format identifier object or default values if not present.\n*\n* @private\n* @param {Object} token - format identifier object\n* @returns {Object} token object\n*/\nfunction initialize( token ) {\n\tvar out = {};\n\tout.specifier = token.specifier;\n\tout.precision = ( token.precision === void 0 ) ? 1 : token.precision;\n\tout.width = token.width;\n\tout.flags = token.flags || '';\n\tout.mapping = token.mapping;\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Generates string from a token array by interpolating values.\n*\n* @param {Array} tokens - string parts and format identifier objects\n* @param {Array} ...args - variable values\n* @throws {TypeError} first argument must be an array\n* @throws {Error} invalid flags\n* @returns {string} formatted string\n*\n* @example\n* var tokens = [ 'beep ', { 'specifier': 's' } ];\n* var out = formatInterpolate( tokens, 'boop' );\n* // returns 'beep boop'\n*/\nfunction formatInterpolate( tokens ) {\n\tvar hasPeriod;\n\tvar flags;\n\tvar token;\n\tvar flag;\n\tvar num;\n\tvar out;\n\tvar pos;\n\tvar f;\n\tvar i;\n\tvar j;\n\n\tif ( !isArray( tokens ) ) {\n\t\tthrow new TypeError( 'invalid argument. First argument must be an array. Value: `' + tokens + '`.' );\n\t}\n\tout = '';\n\tpos = 1;\n\tfor ( i = 0; i < tokens.length; i++ ) {\n\t\ttoken = tokens[ i ];\n\t\tif ( isString( token ) ) {\n\t\t\tout += token;\n\t\t} else {\n\t\t\thasPeriod = token.precision !== void 0;\n\t\t\ttoken = initialize( token );\n\t\t\tif ( !token.specifier ) {\n\t\t\t\tthrow new TypeError( 'invalid argument. Token is missing `specifier` property. Index: `'+ i +'`. Value: `' + token + '`.' );\n\t\t\t}\n\t\t\tif ( token.mapping ) {\n\t\t\t\tpos = token.mapping;\n\t\t\t}\n\t\t\tflags = token.flags;\n\t\t\tfor ( j = 0; j < flags.length; j++ ) {\n\t\t\t\tflag = flags.charAt( j );\n\t\t\t\tswitch ( flag ) {\n\t\t\t\tcase ' ':\n\t\t\t\t\ttoken.sign = ' ';\n\t\t\t\t\tbreak;\n\t\t\t\tcase '+':\n\t\t\t\t\ttoken.sign = '+';\n\t\t\t\t\tbreak;\n\t\t\t\tcase '-':\n\t\t\t\t\ttoken.padRight = true;\n\t\t\t\t\ttoken.padZeros = false;\n\t\t\t\t\tbreak;\n\t\t\t\tcase '0':\n\t\t\t\t\ttoken.padZeros = flags.indexOf( '-' ) < 0; // NOTE: We use built-in `Array.prototype.indexOf` here instead of `@stdlib/assert/contains` in order to avoid circular dependencies.\n\t\t\t\t\tbreak;\n\t\t\t\tcase '#':\n\t\t\t\t\ttoken.alternate = true;\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tthrow new Error( 'invalid flag: ' + flag );\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( token.width === '*' ) {\n\t\t\t\ttoken.width = parseInt( arguments[ pos ], 10 );\n\t\t\t\tpos += 1;\n\t\t\t\tif ( isnan( token.width ) ) {\n\t\t\t\t\tthrow new TypeError( 'the argument for * width at position ' + pos + ' is not a number. Value: `' + token.width + '`.' );\n\t\t\t\t}\n\t\t\t\tif ( token.width < 0 ) {\n\t\t\t\t\ttoken.padRight = true;\n\t\t\t\t\ttoken.width = -token.width;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( hasPeriod ) {\n\t\t\t\tif ( token.precision === '*' ) {\n\t\t\t\t\ttoken.precision = parseInt( arguments[ pos ], 10 );\n\t\t\t\t\tpos += 1;\n\t\t\t\t\tif ( isnan( token.precision ) ) {\n\t\t\t\t\t\tthrow new TypeError( 'the argument for * precision at position ' + pos + ' is not a number. Value: `' + token.precision + '`.' );\n\t\t\t\t\t}\n\t\t\t\t\tif ( token.precision < 0 ) {\n\t\t\t\t\t\ttoken.precision = 1;\n\t\t\t\t\t\thasPeriod = false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\ttoken.arg = arguments[ pos ];\n\t\t\tswitch ( token.specifier ) {\n\t\t\tcase 'b':\n\t\t\tcase 'o':\n\t\t\tcase 'x':\n\t\t\tcase 'X':\n\t\t\tcase 'd':\n\t\t\tcase 'i':\n\t\t\tcase 'u':\n\t\t\t\t// Case: %b (binary), %o (octal), %x, %X (hexadecimal), %d, %i (decimal), %u (unsigned decimal)\n\t\t\t\tif ( hasPeriod ) {\n\t\t\t\t\ttoken.padZeros = false;\n\t\t\t\t}\n\t\t\t\ttoken.arg = formatInteger( token );\n\t\t\t\tbreak;\n\t\t\tcase 's':\n\t\t\t\t// Case: %s (string)\n\t\t\t\ttoken.maxWidth = ( hasPeriod ) ? token.precision : -1;\n\t\t\t\ttoken.arg = String( token.arg );\n\t\t\t\tbreak;\n\t\t\tcase 'c':\n\t\t\t\t// Case: %c (character)\n\t\t\t\tif ( !isnan( token.arg ) ) {\n\t\t\t\t\tnum = parseInt( token.arg, 10 );\n\t\t\t\t\tif ( num < 0 || num > 127 ) {\n\t\t\t\t\t\tthrow new Error( 'invalid character code. Value: ' + token.arg );\n\t\t\t\t\t}\n\t\t\t\t\ttoken.arg = ( isnan( num ) ) ? String( token.arg ) : fromCharCode( num ); // eslint-disable-line max-len\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'e':\n\t\t\tcase 'E':\n\t\t\tcase 'f':\n\t\t\tcase 'F':\n\t\t\tcase 'g':\n\t\t\tcase 'G':\n\t\t\t\t// Case: %e, %E (scientific notation), %f, %F (decimal floating point), %g, %G (uses the shorter of %e/E or %f/F)\n\t\t\t\tif ( !hasPeriod ) {\n\t\t\t\t\ttoken.precision = 6;\n\t\t\t\t}\n\t\t\t\tf = parseFloat( token.arg );\n\t\t\t\tif ( !isFinite( f ) ) { // NOTE: We use the global `isFinite` function here instead of `@stdlib/math/base/assert/is-finite` in order to avoid circular dependencies.\n\t\t\t\t\tif ( !isNumber( token.arg ) ) {\n\t\t\t\t\t\tthrow new Error( 'invalid floating-point number. Value: ' + out );\n\t\t\t\t\t}\n\t\t\t\t\t// Case: NaN, Infinity, or -Infinity\n\t\t\t\t\tf = token.arg;\n\t\t\t\t\ttoken.padZeros = false;\n\t\t\t\t}\n\t\t\t\ttoken.arg = formatDouble( f, token );\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tthrow new Error( 'invalid specifier: ' + token.specifier );\n\t\t\t}\n\t\t\t// Fit argument into field width...\n\t\t\tif ( token.maxWidth >= 0 && token.arg.length > token.maxWidth ) {\n\t\t\t\ttoken.arg = token.arg.substring( 0, token.maxWidth );\n\t\t\t}\n\t\t\tif ( token.padZeros ) {\n\t\t\t\ttoken.arg = zeroPad( token.arg, token.width || token.precision, token.padRight ); // eslint-disable-line max-len\n\t\t\t} else if ( token.width ) {\n\t\t\t\ttoken.arg = spacePad( token.arg, token.width, token.padRight );\n\t\t\t}\n\t\t\tout += token.arg || '';\n\t\t\tpos += 1;\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nmodule.exports = formatInterpolate;\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* Generate string from a token array by interpolating values.\n*\n* @module @stdlib/string-base-format-interpolate\n*\n* @example\n* var formatInterpolate = require( '@stdlib/string-base-format-interpolate' );\n*\n* var tokens = ['Hello ', { 'specifier': 's' }, '!' ];\n* var out = formatInterpolate( tokens, 'World' );\n* // returns 'Hello World!'\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"],
|
|
5
|
+
"mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,GAAAC,EAAA,cAsCA,SAASC,EAAUC,EAAQ,CAC1B,OAAS,OAAOA,GAAU,QAC3B,CAKAF,EAAO,QAAUC,IC7CjB,IAAAE,EAAAC,EAAA,SAAAC,GAAAC,EAAA,cA6BA,SAASC,EAAiBC,EAAM,CAC/B,OAAOA,EAAK,CAAE,IAAM,GACrB,CASA,SAASC,EAAOC,EAAI,CACnB,IAAIC,EAAM,GACNC,EACJ,IAAMA,EAAI,EAAGA,EAAIF,EAAGE,IACnBD,GAAO,IAER,OAAOA,CACR,CAcA,SAASE,EAASL,EAAKM,EAAOC,EAAQ,CACrC,IAAIC,EAAW,GACXC,EAAMH,EAAQN,EAAI,OACtB,OAAKS,EAAM,IAGNV,EAAiBC,CAAI,IACzBQ,EAAW,GACXR,EAAMA,EAAI,OAAQ,CAAE,GAErBA,EAAQO,EACPP,EAAMC,EAAOQ,CAAI,EACjBR,EAAOQ,CAAI,EAAIT,EACXQ,IACJR,EAAM,IAAMA,IAENA,CACR,CAKAF,EAAO,QAAUO,ICnFjB,IAAAK,EAAAC,EAAA,SAAAC,GAAAC,EAAA,cAsBA,IAAIC,EAAW,IACXC,EAAU,IAGVC,EAAY,OAAO,UAAU,YAC7BC,EAAY,OAAO,UAAU,YAajC,SAASC,EAAeC,EAAQ,CAC/B,IAAIC,EACAC,EACAC,EAEJ,OAASH,EAAM,UAAY,CAC3B,IAAK,IAEJC,EAAO,EACP,MACD,IAAK,IAEJA,EAAO,EAC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,GADAO,EAAM,SAAUP,EAAM,IAAK,EAAG,EACzBO,EAAM,GAAKA,EAAM,IACrB,MAAM,IAAI,MAAO,kCAAoCP,EAAM,GAAI,EAEhEA,EAAM,IAAQH,EAAOU,CAAI,EAAM,OAAQP,EAAM,GAAI,EAAIL,GAAcY,CAAI,CACxE,CACA,MACD,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IAMJ,GAJMH,IACLJ,EAAM,UAAY,GAEnBS,EAAI,WAAYT,EAAM,GAAI,EACrB,CAAC,SAAUS,CAAE,EAAI,CACrB,GAAK,CAAClB,EAAUS,EAAM,GAAI,EACzB,MAAM,IAAI,MAAO,yCAA2CC,CAAI,EAGjEQ,EAAIT,EAAM,IACVA,EAAM,SAAW,EAClB,CACAA,EAAM,IAAMR,GAAciB,EAAGT,CAAM,EACnC,MACD,QACC,MAAM,IAAI,MAAO,sBAAwBA,EAAM,SAAU,CAC1D,CAEKA,EAAM,UAAY,GAAKA,EAAM,IAAI,OAASA,EAAM,WACpDA,EAAM,IAAMA,EAAM,IAAI,UAAW,EAAGA,EAAM,QAAS,GAE/CA,EAAM,SACVA,EAAM,IAAMN,GAASM,EAAM,IAAKA,EAAM,OAASA,EAAM,UAAWA,EAAM,QAAS,EACpEA,EAAM,QACjBA,EAAM,IAAMP,GAAUO,EAAM,IAAKA,EAAM,MAAOA,EAAM,QAAS,GAE9DC,GAAOD,EAAM,KAAO,GACpBQ,GAAO,CACR,CAED,OAAOP,CACR,CAKAb,EAAO,QAAUc,KC/MjB,IAAIU,GAAO,IAKX,OAAO,QAAUA",
|
|
6
|
+
"names": ["require_is_number", "__commonJSMin", "exports", "module", "isNumber", "value", "require_zero_pad", "__commonJSMin", "exports", "module", "startsWithMinus", "str", "zeros", "n", "out", "i", "zeroPad", "width", "right", "negative", "pad", "require_format_integer", "__commonJSMin", "exports", "module", "isNumber", "zeroPad", "lowercase", "uppercase", "formatInteger", "token", "base", "out", "i", "require_is_string", "__commonJSMin", "exports", "module", "isString", "value", "require_format_double", "__commonJSMin", "exports", "module", "abs", "lowercase", "uppercase", "replace", "RE_EXP_POS_DIGITS", "RE_EXP_NEG_DIGITS", "RE_ONLY_DIGITS", "RE_DIGITS_BEFORE_EXP", "RE_TRAILING_PERIOD_ZERO", "RE_PERIOD_ZERO_EXP", "RE_ZERO_BEFORE_EXP", "formatDouble", "f", "token", "digits", "out", "require_space_pad", "__commonJSMin", "exports", "module", "spaces", "n", "out", "i", "spacePad", "str", "width", "right", "pad", "require_main", "__commonJSMin", "exports", "module", "formatInteger", "isString", "isNumber", "formatDouble", "spacePad", "zeroPad", "fromCharCode", "isArray", "isnan", "value", "initialize", "token", "out", "formatInterpolate", "tokens", "hasPeriod", "flags", "flag", "num", "pos", "f", "i", "j", "main"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @license Apache-2.0
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2022 The Stdlib Authors.
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
// TypeScript Version: 4.1
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Format identifier object.
|
|
23
|
+
*/
|
|
24
|
+
interface FormatIdentifier {
|
|
25
|
+
/**
|
|
26
|
+
* Format specifier (one of 's', 'c', 'd', 'i', 'u', 'b', 'o', 'x', 'X', 'e', 'E', 'f', 'F', 'g', 'G').
|
|
27
|
+
*/
|
|
28
|
+
specifier: string;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Flags.
|
|
32
|
+
*/
|
|
33
|
+
flags?: string;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Minimum field width (integer or `'*'`).
|
|
37
|
+
*/
|
|
38
|
+
width?: string;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Precision (integer or `'*'`).
|
|
42
|
+
*/
|
|
43
|
+
precision?: string;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Positional mapping from format specifier to argument index.
|
|
47
|
+
*/
|
|
48
|
+
mapping?: number;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
type StringOrToken = string | FormatIdentifier;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Generates string from a token array by interpolating values.
|
|
55
|
+
*
|
|
56
|
+
* @param tokens - string parts and format identifier objects
|
|
57
|
+
* @param args - variable values
|
|
58
|
+
* @throws invalid flags
|
|
59
|
+
* @returns formatted string
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* var tokens = [ 'beep ', { 'specifier': 's' } ];
|
|
63
|
+
* var out = formatInterpolate( tokens, 'boop' );
|
|
64
|
+
* // returns 'beep boop'
|
|
65
|
+
*/
|
|
66
|
+
declare function formatInterpolate( tokens: Array<StringOrToken>, ...args: Array<any> ): string;
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
// EXPORTS //
|
|
70
|
+
|
|
71
|
+
export = formatInterpolate;
|