cdktn 0.23.1 → 0.23.3
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/.jsii +1592 -1591
- package/.spec.swcrc +22 -0
- package/README.md +1 -1
- package/jest.config.js +18 -15
- package/lib/_tokens.js +1 -1
- package/lib/annotations.js +2 -2
- package/lib/app.js +2 -2
- package/lib/aspect.js +2 -2
- package/lib/backends/azurerm-backend.js +3 -3
- package/lib/backends/cloud-backend.js +5 -5
- package/lib/backends/consul-backend.js +3 -3
- package/lib/backends/cos-backend.js +3 -3
- package/lib/backends/gcs-backend.js +3 -3
- package/lib/backends/http-backend.js +3 -3
- package/lib/backends/index.js +1 -1
- package/lib/backends/local-backend.js +3 -3
- package/lib/backends/oss-backend.js +3 -3
- package/lib/backends/pg-backend.js +3 -3
- package/lib/backends/remote-backend.js +5 -5
- package/lib/backends/s3-backend.js +3 -3
- package/lib/backends/swift-backend.js +3 -3
- package/lib/complex-computed-list.js +25 -25
- package/lib/errors.d.ts +1 -2
- package/lib/errors.js +11 -8
- package/lib/features.js +1 -1
- package/lib/functions/helpers.js +1 -1
- package/lib/functions/terraform-functions.generated.js +2 -2
- package/lib/hcl/render.js +1 -1
- package/lib/importable-resource.js +2 -2
- package/lib/index.js +1 -1
- package/lib/manifest.js +4 -5
- package/lib/private/fs.d.ts +20 -5
- package/lib/private/fs.js +43 -69
- package/lib/private/unique.js +1 -1
- package/lib/resource.js +2 -2
- package/lib/runtime.js +1 -1
- package/lib/synthesize/index.js +1 -1
- package/lib/synthesize/synthesizer.js +4 -5
- package/lib/synthesize/types.js +1 -1
- package/lib/terraform-addressable.js +1 -1
- package/lib/terraform-asset.js +2 -2
- package/lib/terraform-backend.js +2 -2
- package/lib/terraform-conditions.js +1 -1
- package/lib/terraform-count.js +2 -2
- package/lib/terraform-data-resource.js +2 -2
- package/lib/terraform-data-source.js +2 -2
- package/lib/terraform-dependable.js +1 -1
- package/lib/terraform-dynamic-block.js +2 -2
- package/lib/terraform-dynamic-expression.js +2 -2
- package/lib/terraform-element.js +2 -2
- package/lib/terraform-functions.js +2 -2
- package/lib/terraform-hcl-module.js +2 -2
- package/lib/terraform-iterator.js +6 -6
- package/lib/terraform-local.js +2 -2
- package/lib/terraform-module-asset.js +1 -1
- package/lib/terraform-module.js +2 -2
- package/lib/terraform-operators.js +2 -2
- package/lib/terraform-output.js +2 -2
- package/lib/terraform-provider.js +2 -2
- package/lib/terraform-provisioner.js +2 -2
- package/lib/terraform-remote-state.js +2 -2
- package/lib/terraform-resource-targets.js +2 -2
- package/lib/terraform-resource.js +2 -2
- package/lib/terraform-stack.js +2 -2
- package/lib/terraform-variable.js +3 -3
- package/lib/testing/adapters/jest.js +1 -1
- package/lib/testing/index.js +7 -8
- package/lib/testing/matchers.js +2 -2
- package/lib/tfExpression.js +1 -1
- package/lib/tokens/index.js +1 -1
- package/lib/tokens/lazy.js +4 -4
- package/lib/tokens/private/dependency.js +1 -1
- package/lib/tokens/private/encoding.js +1 -1
- package/lib/tokens/private/intrinsic.d.ts +0 -5
- package/lib/tokens/private/intrinsic.js +2 -9
- package/lib/tokens/private/resolve.js +1 -1
- package/lib/tokens/private/stack-trace.d.ts +6 -0
- package/lib/tokens/private/stack-trace.js +14 -1
- package/lib/tokens/private/token-map.js +1 -1
- package/lib/tokens/private/uniqueid.js +1 -1
- package/lib/tokens/resolvable.js +4 -4
- package/lib/tokens/string-fragments.js +2 -2
- package/lib/tokens/token.js +3 -3
- package/lib/tsconfig.tsbuildinfo +1 -0
- package/lib/upgrade-id-aspect.js +2 -2
- package/lib/util.js +1 -1
- package/lib/validateEnvironment.js +1 -1
- package/lib/validations/index.js +1 -1
- package/lib/validations/validate-binary-version.js +1 -1
- package/lib/validations/validate-provider-presence.js +1 -1
- package/lib/validations/validate-terraform-version.js +1 -1
- package/node_modules/fflate/CHANGELOG.md +115 -0
- package/node_modules/{has-property-descriptors → fflate}/LICENSE +2 -2
- package/node_modules/fflate/README.md +558 -0
- package/node_modules/fflate/esm/browser.d.ts +1501 -0
- package/node_modules/fflate/esm/browser.js +2665 -0
- package/node_modules/fflate/esm/index.d.mts +1501 -0
- package/node_modules/fflate/esm/index.mjs +2679 -0
- package/node_modules/fflate/lib/browser.cjs +2688 -0
- package/node_modules/fflate/lib/browser.d.cts +1501 -0
- package/node_modules/fflate/lib/index.cjs +2668 -0
- package/node_modules/fflate/lib/index.d.ts +1501 -0
- package/node_modules/fflate/lib/node-worker.cjs +32 -0
- package/node_modules/fflate/lib/node.cjs +2700 -0
- package/node_modules/fflate/lib/node.d.cts +1501 -0
- package/node_modules/fflate/lib/worker.cjs +20 -0
- package/node_modules/fflate/package.json +127 -0
- package/node_modules/fflate/umd/index.js +1 -0
- package/node_modules/{yazl → safe-stable-stringify}/LICENSE +1 -1
- package/node_modules/safe-stable-stringify/esm/package.json +4 -0
- package/node_modules/safe-stable-stringify/esm/wrapper.d.ts +4 -0
- package/node_modules/safe-stable-stringify/esm/wrapper.js +6 -0
- package/node_modules/safe-stable-stringify/index.d.ts +22 -0
- package/node_modules/safe-stable-stringify/index.js +625 -0
- package/node_modules/safe-stable-stringify/package.json +65 -0
- package/node_modules/safe-stable-stringify/readme.md +179 -0
- package/package.json +21 -15
- package/tsconfig.json +6 -3
- package/tsconfig.test.json +12 -0
- package/lib/testing/__tests__/matchers.test.d.ts +0 -1
- package/lib/testing/__tests__/matchers.test.js +0 -205
- package/lib/testing/adapters/__tests__/index.test.d.ts +0 -1
- package/lib/testing/adapters/__tests__/index.test.js +0 -67
- package/lib/testing/adapters/__tests__/jest.test.d.ts +0 -1
- package/lib/testing/adapters/__tests__/jest.test.js +0 -41
- package/node_modules/buffer-crc32/LICENSE +0 -19
- package/node_modules/buffer-crc32/README.md +0 -55
- package/node_modules/buffer-crc32/dist/index.cjs +0 -306
- package/node_modules/buffer-crc32/dist/index.d.cts +0 -35
- package/node_modules/buffer-crc32/dist/index.d.mts +0 -35
- package/node_modules/buffer-crc32/dist/index.mjs +0 -304
- package/node_modules/buffer-crc32/index.d.ts +0 -35
- package/node_modules/buffer-crc32/package.json +0 -54
- package/node_modules/call-bind/.eslintignore +0 -1
- package/node_modules/call-bind/.eslintrc +0 -16
- package/node_modules/call-bind/.github/FUNDING.yml +0 -12
- package/node_modules/call-bind/.nycrc +0 -9
- package/node_modules/call-bind/CHANGELOG.md +0 -106
- package/node_modules/call-bind/LICENSE +0 -21
- package/node_modules/call-bind/README.md +0 -64
- package/node_modules/call-bind/callBound.js +0 -15
- package/node_modules/call-bind/index.js +0 -24
- package/node_modules/call-bind/package.json +0 -93
- package/node_modules/call-bind/test/callBound.js +0 -54
- package/node_modules/call-bind/test/index.js +0 -74
- package/node_modules/call-bind-apply-helpers/.eslintrc +0 -17
- package/node_modules/call-bind-apply-helpers/.github/FUNDING.yml +0 -12
- package/node_modules/call-bind-apply-helpers/.nycrc +0 -9
- package/node_modules/call-bind-apply-helpers/CHANGELOG.md +0 -30
- package/node_modules/call-bind-apply-helpers/LICENSE +0 -21
- package/node_modules/call-bind-apply-helpers/README.md +0 -62
- package/node_modules/call-bind-apply-helpers/actualApply.d.ts +0 -1
- package/node_modules/call-bind-apply-helpers/actualApply.js +0 -10
- package/node_modules/call-bind-apply-helpers/applyBind.d.ts +0 -19
- package/node_modules/call-bind-apply-helpers/applyBind.js +0 -10
- package/node_modules/call-bind-apply-helpers/functionApply.d.ts +0 -1
- package/node_modules/call-bind-apply-helpers/functionApply.js +0 -4
- package/node_modules/call-bind-apply-helpers/functionCall.d.ts +0 -1
- package/node_modules/call-bind-apply-helpers/functionCall.js +0 -4
- package/node_modules/call-bind-apply-helpers/index.d.ts +0 -64
- package/node_modules/call-bind-apply-helpers/index.js +0 -15
- package/node_modules/call-bind-apply-helpers/package.json +0 -85
- package/node_modules/call-bind-apply-helpers/reflectApply.d.ts +0 -3
- package/node_modules/call-bind-apply-helpers/reflectApply.js +0 -4
- package/node_modules/call-bind-apply-helpers/test/index.js +0 -63
- package/node_modules/call-bind-apply-helpers/tsconfig.json +0 -9
- package/node_modules/call-bound/.eslintrc +0 -13
- package/node_modules/call-bound/.github/FUNDING.yml +0 -12
- package/node_modules/call-bound/.nycrc +0 -9
- package/node_modules/call-bound/CHANGELOG.md +0 -42
- package/node_modules/call-bound/LICENSE +0 -21
- package/node_modules/call-bound/README.md +0 -53
- package/node_modules/call-bound/index.d.ts +0 -94
- package/node_modules/call-bound/index.js +0 -19
- package/node_modules/call-bound/package.json +0 -99
- package/node_modules/call-bound/test/index.js +0 -61
- package/node_modules/call-bound/tsconfig.json +0 -10
- package/node_modules/define-data-property/.eslintrc +0 -24
- package/node_modules/define-data-property/.github/FUNDING.yml +0 -12
- package/node_modules/define-data-property/.nycrc +0 -13
- package/node_modules/define-data-property/CHANGELOG.md +0 -70
- package/node_modules/define-data-property/LICENSE +0 -21
- package/node_modules/define-data-property/README.md +0 -67
- package/node_modules/define-data-property/index.d.ts +0 -12
- package/node_modules/define-data-property/index.js +0 -56
- package/node_modules/define-data-property/package.json +0 -106
- package/node_modules/define-data-property/test/index.js +0 -392
- package/node_modules/define-data-property/tsconfig.json +0 -59
- package/node_modules/dunder-proto/.eslintrc +0 -5
- package/node_modules/dunder-proto/.github/FUNDING.yml +0 -12
- package/node_modules/dunder-proto/.nycrc +0 -13
- package/node_modules/dunder-proto/CHANGELOG.md +0 -24
- package/node_modules/dunder-proto/LICENSE +0 -21
- package/node_modules/dunder-proto/README.md +0 -54
- package/node_modules/dunder-proto/get.d.ts +0 -5
- package/node_modules/dunder-proto/get.js +0 -30
- package/node_modules/dunder-proto/package.json +0 -76
- package/node_modules/dunder-proto/set.d.ts +0 -5
- package/node_modules/dunder-proto/set.js +0 -35
- package/node_modules/dunder-proto/test/get.js +0 -34
- package/node_modules/dunder-proto/test/index.js +0 -4
- package/node_modules/dunder-proto/test/set.js +0 -50
- package/node_modules/dunder-proto/tsconfig.json +0 -9
- package/node_modules/es-define-property/.eslintrc +0 -13
- package/node_modules/es-define-property/.github/FUNDING.yml +0 -12
- package/node_modules/es-define-property/.nycrc +0 -9
- package/node_modules/es-define-property/CHANGELOG.md +0 -29
- package/node_modules/es-define-property/LICENSE +0 -21
- package/node_modules/es-define-property/README.md +0 -49
- package/node_modules/es-define-property/index.d.ts +0 -3
- package/node_modules/es-define-property/index.js +0 -14
- package/node_modules/es-define-property/package.json +0 -81
- package/node_modules/es-define-property/test/index.js +0 -56
- package/node_modules/es-define-property/tsconfig.json +0 -10
- package/node_modules/es-errors/.eslintrc +0 -5
- package/node_modules/es-errors/.github/FUNDING.yml +0 -12
- package/node_modules/es-errors/CHANGELOG.md +0 -40
- package/node_modules/es-errors/LICENSE +0 -21
- package/node_modules/es-errors/README.md +0 -55
- package/node_modules/es-errors/eval.d.ts +0 -3
- package/node_modules/es-errors/eval.js +0 -4
- package/node_modules/es-errors/index.d.ts +0 -3
- package/node_modules/es-errors/index.js +0 -4
- package/node_modules/es-errors/package.json +0 -80
- package/node_modules/es-errors/range.d.ts +0 -3
- package/node_modules/es-errors/range.js +0 -4
- package/node_modules/es-errors/ref.d.ts +0 -3
- package/node_modules/es-errors/ref.js +0 -4
- package/node_modules/es-errors/syntax.d.ts +0 -3
- package/node_modules/es-errors/syntax.js +0 -4
- package/node_modules/es-errors/test/index.js +0 -19
- package/node_modules/es-errors/tsconfig.json +0 -49
- package/node_modules/es-errors/type.d.ts +0 -3
- package/node_modules/es-errors/type.js +0 -4
- package/node_modules/es-errors/uri.d.ts +0 -3
- package/node_modules/es-errors/uri.js +0 -4
- package/node_modules/es-object-atoms/.eslintrc +0 -16
- package/node_modules/es-object-atoms/.github/FUNDING.yml +0 -12
- package/node_modules/es-object-atoms/CHANGELOG.md +0 -37
- package/node_modules/es-object-atoms/LICENSE +0 -21
- package/node_modules/es-object-atoms/README.md +0 -63
- package/node_modules/es-object-atoms/RequireObjectCoercible.d.ts +0 -3
- package/node_modules/es-object-atoms/RequireObjectCoercible.js +0 -11
- package/node_modules/es-object-atoms/ToObject.d.ts +0 -7
- package/node_modules/es-object-atoms/ToObject.js +0 -10
- package/node_modules/es-object-atoms/index.d.ts +0 -3
- package/node_modules/es-object-atoms/index.js +0 -4
- package/node_modules/es-object-atoms/isObject.d.ts +0 -3
- package/node_modules/es-object-atoms/isObject.js +0 -6
- package/node_modules/es-object-atoms/package.json +0 -80
- package/node_modules/es-object-atoms/test/index.js +0 -38
- package/node_modules/es-object-atoms/tsconfig.json +0 -6
- package/node_modules/function-bind/.eslintrc +0 -21
- package/node_modules/function-bind/.github/FUNDING.yml +0 -12
- package/node_modules/function-bind/.github/SECURITY.md +0 -3
- package/node_modules/function-bind/.nycrc +0 -13
- package/node_modules/function-bind/CHANGELOG.md +0 -136
- package/node_modules/function-bind/LICENSE +0 -20
- package/node_modules/function-bind/README.md +0 -46
- package/node_modules/function-bind/implementation.js +0 -84
- package/node_modules/function-bind/index.js +0 -5
- package/node_modules/function-bind/package.json +0 -87
- package/node_modules/function-bind/test/.eslintrc +0 -9
- package/node_modules/function-bind/test/index.js +0 -252
- package/node_modules/get-intrinsic/.eslintrc +0 -42
- package/node_modules/get-intrinsic/.github/FUNDING.yml +0 -12
- package/node_modules/get-intrinsic/.nycrc +0 -9
- package/node_modules/get-intrinsic/CHANGELOG.md +0 -186
- package/node_modules/get-intrinsic/LICENSE +0 -21
- package/node_modules/get-intrinsic/README.md +0 -71
- package/node_modules/get-intrinsic/index.js +0 -378
- package/node_modules/get-intrinsic/package.json +0 -97
- package/node_modules/get-intrinsic/test/GetIntrinsic.js +0 -274
- package/node_modules/get-proto/.eslintrc +0 -10
- package/node_modules/get-proto/.github/FUNDING.yml +0 -12
- package/node_modules/get-proto/.nycrc +0 -9
- package/node_modules/get-proto/CHANGELOG.md +0 -21
- package/node_modules/get-proto/LICENSE +0 -21
- package/node_modules/get-proto/Object.getPrototypeOf.d.ts +0 -5
- package/node_modules/get-proto/Object.getPrototypeOf.js +0 -6
- package/node_modules/get-proto/README.md +0 -50
- package/node_modules/get-proto/Reflect.getPrototypeOf.d.ts +0 -3
- package/node_modules/get-proto/Reflect.getPrototypeOf.js +0 -4
- package/node_modules/get-proto/index.d.ts +0 -5
- package/node_modules/get-proto/index.js +0 -27
- package/node_modules/get-proto/package.json +0 -81
- package/node_modules/get-proto/test/index.js +0 -68
- package/node_modules/get-proto/tsconfig.json +0 -9
- package/node_modules/gopd/.eslintrc +0 -16
- package/node_modules/gopd/.github/FUNDING.yml +0 -12
- package/node_modules/gopd/CHANGELOG.md +0 -45
- package/node_modules/gopd/LICENSE +0 -21
- package/node_modules/gopd/README.md +0 -40
- package/node_modules/gopd/gOPD.d.ts +0 -1
- package/node_modules/gopd/gOPD.js +0 -4
- package/node_modules/gopd/index.d.ts +0 -5
- package/node_modules/gopd/index.js +0 -15
- package/node_modules/gopd/package.json +0 -77
- package/node_modules/gopd/test/index.js +0 -36
- package/node_modules/gopd/tsconfig.json +0 -9
- package/node_modules/has-property-descriptors/.eslintrc +0 -13
- package/node_modules/has-property-descriptors/.github/FUNDING.yml +0 -12
- package/node_modules/has-property-descriptors/.nycrc +0 -9
- package/node_modules/has-property-descriptors/CHANGELOG.md +0 -35
- package/node_modules/has-property-descriptors/README.md +0 -43
- package/node_modules/has-property-descriptors/index.js +0 -22
- package/node_modules/has-property-descriptors/package.json +0 -77
- package/node_modules/has-property-descriptors/test/index.js +0 -57
- package/node_modules/has-symbols/.eslintrc +0 -11
- package/node_modules/has-symbols/.github/FUNDING.yml +0 -12
- package/node_modules/has-symbols/.nycrc +0 -9
- package/node_modules/has-symbols/CHANGELOG.md +0 -91
- package/node_modules/has-symbols/LICENSE +0 -21
- package/node_modules/has-symbols/README.md +0 -46
- package/node_modules/has-symbols/index.d.ts +0 -3
- package/node_modules/has-symbols/index.js +0 -14
- package/node_modules/has-symbols/package.json +0 -111
- package/node_modules/has-symbols/shams.d.ts +0 -3
- package/node_modules/has-symbols/shams.js +0 -45
- package/node_modules/has-symbols/test/index.js +0 -22
- package/node_modules/has-symbols/test/shams/core-js.js +0 -29
- package/node_modules/has-symbols/test/shams/get-own-property-symbols.js +0 -29
- package/node_modules/has-symbols/test/tests.js +0 -58
- package/node_modules/has-symbols/tsconfig.json +0 -10
- package/node_modules/hasown/.eslintrc +0 -5
- package/node_modules/hasown/.github/FUNDING.yml +0 -12
- package/node_modules/hasown/.nycrc +0 -13
- package/node_modules/hasown/CHANGELOG.md +0 -40
- package/node_modules/hasown/LICENSE +0 -21
- package/node_modules/hasown/README.md +0 -40
- package/node_modules/hasown/index.d.ts +0 -3
- package/node_modules/hasown/index.js +0 -8
- package/node_modules/hasown/package.json +0 -92
- package/node_modules/hasown/tsconfig.json +0 -6
- package/node_modules/isarray/LICENSE +0 -21
- package/node_modules/isarray/README.md +0 -38
- package/node_modules/isarray/index.js +0 -5
- package/node_modules/isarray/package.json +0 -48
- package/node_modules/json-stable-stringify/.eslintrc +0 -31
- package/node_modules/json-stable-stringify/.github/FUNDING.yml +0 -12
- package/node_modules/json-stable-stringify/CHANGELOG.md +0 -160
- package/node_modules/json-stable-stringify/LICENSE +0 -21
- package/node_modules/json-stable-stringify/README.md +0 -157
- package/node_modules/json-stable-stringify/example/key_cmp.js +0 -9
- package/node_modules/json-stable-stringify/example/nested.js +0 -7
- package/node_modules/json-stable-stringify/example/str.js +0 -7
- package/node_modules/json-stable-stringify/example/value_cmp.js +0 -12
- package/node_modules/json-stable-stringify/index.d.ts +0 -25
- package/node_modules/json-stable-stringify/index.js +0 -124
- package/node_modules/json-stable-stringify/package.json +0 -88
- package/node_modules/json-stable-stringify/test/cmp.js +0 -33
- package/node_modules/json-stable-stringify/test/nested.js +0 -48
- package/node_modules/json-stable-stringify/test/replacer.js +0 -81
- package/node_modules/json-stable-stringify/test/space.js +0 -127
- package/node_modules/json-stable-stringify/test/str.js +0 -46
- package/node_modules/json-stable-stringify/test/to-json.js +0 -22
- package/node_modules/json-stable-stringify/tsconfig.json +0 -10
- package/node_modules/jsonify/.eslintrc +0 -21
- package/node_modules/jsonify/.github/FUNDING.yml +0 -12
- package/node_modules/jsonify/CHANGELOG.md +0 -48
- package/node_modules/jsonify/README.md +0 -66
- package/node_modules/jsonify/index.js +0 -4
- package/node_modules/jsonify/lib/parse.js +0 -261
- package/node_modules/jsonify/lib/stringify.js +0 -151
- package/node_modules/jsonify/package.json +0 -62
- package/node_modules/jsonify/test/parse.js +0 -20
- package/node_modules/jsonify/test/stringify.js +0 -18
- package/node_modules/math-intrinsics/.eslintrc +0 -16
- package/node_modules/math-intrinsics/.github/FUNDING.yml +0 -12
- package/node_modules/math-intrinsics/CHANGELOG.md +0 -24
- package/node_modules/math-intrinsics/LICENSE +0 -21
- package/node_modules/math-intrinsics/README.md +0 -50
- package/node_modules/math-intrinsics/abs.d.ts +0 -1
- package/node_modules/math-intrinsics/abs.js +0 -4
- package/node_modules/math-intrinsics/constants/maxArrayLength.d.ts +0 -3
- package/node_modules/math-intrinsics/constants/maxArrayLength.js +0 -4
- package/node_modules/math-intrinsics/constants/maxSafeInteger.d.ts +0 -3
- package/node_modules/math-intrinsics/constants/maxSafeInteger.js +0 -5
- package/node_modules/math-intrinsics/constants/maxValue.d.ts +0 -3
- package/node_modules/math-intrinsics/constants/maxValue.js +0 -5
- package/node_modules/math-intrinsics/floor.d.ts +0 -1
- package/node_modules/math-intrinsics/floor.js +0 -4
- package/node_modules/math-intrinsics/isFinite.d.ts +0 -3
- package/node_modules/math-intrinsics/isFinite.js +0 -12
- package/node_modules/math-intrinsics/isInteger.d.ts +0 -3
- package/node_modules/math-intrinsics/isInteger.js +0 -16
- package/node_modules/math-intrinsics/isNaN.d.ts +0 -1
- package/node_modules/math-intrinsics/isNaN.js +0 -6
- package/node_modules/math-intrinsics/isNegativeZero.d.ts +0 -3
- package/node_modules/math-intrinsics/isNegativeZero.js +0 -6
- package/node_modules/math-intrinsics/max.d.ts +0 -1
- package/node_modules/math-intrinsics/max.js +0 -4
- package/node_modules/math-intrinsics/min.d.ts +0 -1
- package/node_modules/math-intrinsics/min.js +0 -4
- package/node_modules/math-intrinsics/mod.d.ts +0 -3
- package/node_modules/math-intrinsics/mod.js +0 -9
- package/node_modules/math-intrinsics/package.json +0 -86
- package/node_modules/math-intrinsics/pow.d.ts +0 -1
- package/node_modules/math-intrinsics/pow.js +0 -4
- package/node_modules/math-intrinsics/round.d.ts +0 -1
- package/node_modules/math-intrinsics/round.js +0 -4
- package/node_modules/math-intrinsics/sign.d.ts +0 -3
- package/node_modules/math-intrinsics/sign.js +0 -11
- package/node_modules/math-intrinsics/test/index.js +0 -192
- package/node_modules/math-intrinsics/tsconfig.json +0 -3
- package/node_modules/object-keys/.editorconfig +0 -13
- package/node_modules/object-keys/.eslintrc +0 -17
- package/node_modules/object-keys/.travis.yml +0 -277
- package/node_modules/object-keys/CHANGELOG.md +0 -232
- package/node_modules/object-keys/LICENSE +0 -21
- package/node_modules/object-keys/README.md +0 -76
- package/node_modules/object-keys/implementation.js +0 -122
- package/node_modules/object-keys/index.js +0 -32
- package/node_modules/object-keys/isArguments.js +0 -17
- package/node_modules/object-keys/package.json +0 -88
- package/node_modules/object-keys/test/index.js +0 -5
- package/node_modules/set-function-length/.eslintrc +0 -27
- package/node_modules/set-function-length/.github/FUNDING.yml +0 -12
- package/node_modules/set-function-length/.nycrc +0 -13
- package/node_modules/set-function-length/CHANGELOG.md +0 -70
- package/node_modules/set-function-length/LICENSE +0 -21
- package/node_modules/set-function-length/README.md +0 -56
- package/node_modules/set-function-length/env.d.ts +0 -9
- package/node_modules/set-function-length/env.js +0 -25
- package/node_modules/set-function-length/index.d.ts +0 -7
- package/node_modules/set-function-length/index.js +0 -42
- package/node_modules/set-function-length/package.json +0 -102
- package/node_modules/set-function-length/tsconfig.json +0 -9
- package/node_modules/yazl/README.md +0 -457
- package/node_modules/yazl/index.js +0 -826
- package/node_modules/yazl/package.json +0 -34
- package/tsconfig.tsbuildinfo +0 -1
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
declare namespace stableStringify {
|
|
2
|
-
type Key = string | number;
|
|
3
|
-
|
|
4
|
-
type NonArrayNode = Record<Key, unknown>;
|
|
5
|
-
type Node = unknown[] | NonArrayNode;
|
|
6
|
-
|
|
7
|
-
type Getter = { get(key: Key): unknown };
|
|
8
|
-
|
|
9
|
-
type Comparator = (a: { key: string, value: unknown }, b: { key: string, value: unknown }, getter: Getter) => number;
|
|
10
|
-
|
|
11
|
-
type StableStringifyOptions = {
|
|
12
|
-
cmp?: Comparator;
|
|
13
|
-
collapseEmpty?: boolean;
|
|
14
|
-
cycles?: boolean;
|
|
15
|
-
replacer?: (this: Node, key: Key, value: unknown) => unknown;
|
|
16
|
-
space?: string | number;
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
declare function stableStringify(
|
|
21
|
-
obj: unknown,
|
|
22
|
-
options?: (stableStringify.Comparator & stableStringify.StableStringifyOptions) | stableStringify.StableStringifyOptions,
|
|
23
|
-
): string | undefined;
|
|
24
|
-
|
|
25
|
-
export = stableStringify;
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
/** @type {typeof JSON.stringify} */
|
|
4
|
-
var jsonStringify = (typeof JSON !== 'undefined' ? JSON : require('jsonify')).stringify;
|
|
5
|
-
|
|
6
|
-
var isArray = require('isarray');
|
|
7
|
-
var objectKeys = require('object-keys');
|
|
8
|
-
var callBind = require('call-bind');
|
|
9
|
-
var callBound = require('call-bound');
|
|
10
|
-
|
|
11
|
-
var $join = callBound('Array.prototype.join');
|
|
12
|
-
var $indexOf = callBound('Array.prototype.indexOf');
|
|
13
|
-
var $splice = callBound('Array.prototype.splice');
|
|
14
|
-
var $sort = callBound('Array.prototype.sort');
|
|
15
|
-
|
|
16
|
-
/** @type {(n: number, char: string) => string} */
|
|
17
|
-
var strRepeat = function repeat(n, char) {
|
|
18
|
-
var str = '';
|
|
19
|
-
for (var i = 0; i < n; i += 1) {
|
|
20
|
-
str += char;
|
|
21
|
-
}
|
|
22
|
-
return str;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
/** @type {(parent: import('.').Node, key: import('.').Key, value: unknown) => unknown} */
|
|
26
|
-
var defaultReplacer = function (_parent, _key, value) { return value; };
|
|
27
|
-
|
|
28
|
-
/** @type {import('.')} */
|
|
29
|
-
module.exports = function stableStringify(obj) {
|
|
30
|
-
/** @type {Parameters<import('.')>[1]} */
|
|
31
|
-
var opts = arguments.length > 1 ? arguments[1] : void undefined;
|
|
32
|
-
var space = (opts && opts.space) || '';
|
|
33
|
-
if (typeof space === 'number') { space = strRepeat(space, ' '); }
|
|
34
|
-
var cycles = !!opts && typeof opts.cycles === 'boolean' && opts.cycles;
|
|
35
|
-
/** @type {undefined | typeof defaultReplacer} */
|
|
36
|
-
var replacer = opts && opts.replacer ? callBind(opts.replacer) : defaultReplacer;
|
|
37
|
-
if (opts && typeof opts.collapseEmpty !== 'undefined' && typeof opts.collapseEmpty !== 'boolean') {
|
|
38
|
-
throw new TypeError('`collapseEmpty` must be a boolean, if provided');
|
|
39
|
-
}
|
|
40
|
-
var collapseEmpty = !!opts && opts.collapseEmpty;
|
|
41
|
-
|
|
42
|
-
var cmpOpt = typeof opts === 'function' ? opts : opts && opts.cmp;
|
|
43
|
-
/** @type {undefined | (<T extends import('.').NonArrayNode>(node: T) => (a: Exclude<keyof T, symbol | number>, b: Exclude<keyof T, symbol | number>) => number)} */
|
|
44
|
-
var cmp = cmpOpt && function (node) {
|
|
45
|
-
// eslint-disable-next-line no-extra-parens
|
|
46
|
-
var get = /** @type {NonNullable<typeof cmpOpt>} */ (cmpOpt).length > 2
|
|
47
|
-
&& /** @type {import('.').Getter['get']} */ function get(k) { return node[k]; };
|
|
48
|
-
return function (a, b) {
|
|
49
|
-
// eslint-disable-next-line no-extra-parens
|
|
50
|
-
return /** @type {NonNullable<typeof cmpOpt>} */ (cmpOpt)(
|
|
51
|
-
{ key: a, value: node[a] },
|
|
52
|
-
{ key: b, value: node[b] },
|
|
53
|
-
// @ts-expect-error TS doesn't understand the optimization used here
|
|
54
|
-
get ? /** @type {import('.').Getter} */ { __proto__: null, get: get } : void undefined
|
|
55
|
-
);
|
|
56
|
-
};
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
/** @type {import('.').Node[]} */
|
|
60
|
-
var seen = [];
|
|
61
|
-
return (/** @type {(parent: import('.').Node, key: string | number, node: unknown, level: number) => string | undefined} */
|
|
62
|
-
function stringify(parent, key, node, level) {
|
|
63
|
-
var indent = space ? '\n' + strRepeat(level, space) : '';
|
|
64
|
-
var colonSeparator = space ? ': ' : ':';
|
|
65
|
-
|
|
66
|
-
// eslint-disable-next-line no-extra-parens
|
|
67
|
-
if (node && /** @type {{ toJSON?: unknown }} */ (node).toJSON && typeof /** @type {{ toJSON?: unknown }} */ (node).toJSON === 'function') {
|
|
68
|
-
// eslint-disable-next-line no-extra-parens
|
|
69
|
-
node = /** @type {{ toJSON: Function }} */ (node).toJSON();
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
node = replacer(parent, key, node);
|
|
73
|
-
if (node === undefined) {
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
if (typeof node !== 'object' || node === null) {
|
|
77
|
-
return jsonStringify(node);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
/** @type {(out: string[], brackets: '[]' | '{}') => string} */
|
|
81
|
-
var groupOutput = function (out, brackets) {
|
|
82
|
-
return collapseEmpty && out.length === 0
|
|
83
|
-
? brackets
|
|
84
|
-
: (brackets === '[]' ? '[' : '{') + $join(out, ',') + indent + (brackets === '[]' ? ']' : '}');
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
if (isArray(node)) {
|
|
88
|
-
var out = [];
|
|
89
|
-
for (var i = 0; i < node.length; i++) {
|
|
90
|
-
var item = stringify(node, i, node[i], level + 1) || jsonStringify(null);
|
|
91
|
-
out[out.length] = indent + space + item;
|
|
92
|
-
}
|
|
93
|
-
return groupOutput(out, '[]');
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
if ($indexOf(seen, node) !== -1) {
|
|
97
|
-
if (cycles) { return jsonStringify('__cycle__'); }
|
|
98
|
-
throw new TypeError('Converting circular structure to JSON');
|
|
99
|
-
} else {
|
|
100
|
-
seen[seen.length] = /** @type {import('.').NonArrayNode} */ (node);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
/** @type {import('.').Key[]} */
|
|
104
|
-
// eslint-disable-next-line no-extra-parens
|
|
105
|
-
var keys = $sort(objectKeys(node), cmp && cmp(/** @type {import('.').NonArrayNode} */ (node)));
|
|
106
|
-
var out = [];
|
|
107
|
-
for (var i = 0; i < keys.length; i++) {
|
|
108
|
-
var key = keys[i];
|
|
109
|
-
// eslint-disable-next-line no-extra-parens
|
|
110
|
-
var value = stringify(/** @type {import('.').Node} */ (node), key, /** @type {import('.').NonArrayNode} */ (node)[key], level + 1);
|
|
111
|
-
|
|
112
|
-
if (!value) { continue; }
|
|
113
|
-
|
|
114
|
-
var keyValue = jsonStringify(key)
|
|
115
|
-
+ colonSeparator
|
|
116
|
-
+ value;
|
|
117
|
-
|
|
118
|
-
out[out.length] = indent + space + keyValue;
|
|
119
|
-
}
|
|
120
|
-
$splice(seen, $indexOf(seen, node), 1);
|
|
121
|
-
return groupOutput(out, '{}');
|
|
122
|
-
}({ '': obj }, '', obj, 0)
|
|
123
|
-
);
|
|
124
|
-
};
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "json-stable-stringify",
|
|
3
|
-
"version": "1.3.0",
|
|
4
|
-
"description": "deterministic JSON.stringify() with custom sorting to get deterministic hashes from stringified results",
|
|
5
|
-
"main": "index.js",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"prepack": "npmignore --auto --commentLines=autogenerated",
|
|
8
|
-
"prepublishOnly": "safe-publish-latest",
|
|
9
|
-
"prepublish": "not-in-publish || npm run prepublishOnly",
|
|
10
|
-
"lint": "eslint --ext=js,mjs .",
|
|
11
|
-
"postlint": "tsc && attw -P",
|
|
12
|
-
"pretest": "npm run lint",
|
|
13
|
-
"tests-only": "tape 'test/**/*.js'",
|
|
14
|
-
"test": "npm run tests-only",
|
|
15
|
-
"posttest": "npx npm@'>= 10.2' audit --production",
|
|
16
|
-
"version": "auto-changelog && git add CHANGELOG.md",
|
|
17
|
-
"postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\""
|
|
18
|
-
},
|
|
19
|
-
"repository": {
|
|
20
|
-
"type": "git",
|
|
21
|
-
"url": "git://github.com/ljharb/json-stable-stringify.git"
|
|
22
|
-
},
|
|
23
|
-
"keywords": [
|
|
24
|
-
"json",
|
|
25
|
-
"stringify",
|
|
26
|
-
"deterministic",
|
|
27
|
-
"hash",
|
|
28
|
-
"sort",
|
|
29
|
-
"stable"
|
|
30
|
-
],
|
|
31
|
-
"author": {
|
|
32
|
-
"name": "James Halliday",
|
|
33
|
-
"email": "mail@substack.net",
|
|
34
|
-
"url": "http://substack.net"
|
|
35
|
-
},
|
|
36
|
-
"license": "MIT",
|
|
37
|
-
"bugs": {
|
|
38
|
-
"url": "https://github.com/ljharb/json-stable-stringify/issues"
|
|
39
|
-
},
|
|
40
|
-
"homepage": "https://github.com/ljharb/json-stable-stringify",
|
|
41
|
-
"funding": {
|
|
42
|
-
"url": "https://github.com/sponsors/ljharb"
|
|
43
|
-
},
|
|
44
|
-
"dependencies": {
|
|
45
|
-
"call-bind": "^1.0.8",
|
|
46
|
-
"call-bound": "^1.0.4",
|
|
47
|
-
"isarray": "^2.0.5",
|
|
48
|
-
"jsonify": "^0.0.1",
|
|
49
|
-
"object-keys": "^1.1.1"
|
|
50
|
-
},
|
|
51
|
-
"devDependencies": {
|
|
52
|
-
"@arethetypeswrong/cli": "^0.17.4",
|
|
53
|
-
"@ljharb/eslint-config": "^21.1.1",
|
|
54
|
-
"@ljharb/tsconfig": "^0.3.2",
|
|
55
|
-
"@types/call-bind": "^1.0.5",
|
|
56
|
-
"@types/isarray": "^2.0.3",
|
|
57
|
-
"@types/object-keys": "^1.0.3",
|
|
58
|
-
"@types/tape": "^5.8.1",
|
|
59
|
-
"auto-changelog": "^2.5.0",
|
|
60
|
-
"encoding": "^0.1.13",
|
|
61
|
-
"eslint": "=8.8.0",
|
|
62
|
-
"in-publish": "^2.0.1",
|
|
63
|
-
"npmignore": "^0.3.1",
|
|
64
|
-
"safe-publish-latest": "^2.0.0",
|
|
65
|
-
"tape": "^5.9.0",
|
|
66
|
-
"typescript": "next"
|
|
67
|
-
},
|
|
68
|
-
"engines": {
|
|
69
|
-
"node": ">= 0.4"
|
|
70
|
-
},
|
|
71
|
-
"testling": {
|
|
72
|
-
"files": "test/*.js"
|
|
73
|
-
},
|
|
74
|
-
"auto-changelog": {
|
|
75
|
-
"output": "CHANGELOG.md",
|
|
76
|
-
"template": "keepachangelog",
|
|
77
|
-
"unreleased": false,
|
|
78
|
-
"commitLimit": false,
|
|
79
|
-
"backfillLimit": false,
|
|
80
|
-
"hideCredit": true
|
|
81
|
-
},
|
|
82
|
-
"publishConfig": {
|
|
83
|
-
"ignore": [
|
|
84
|
-
".github/workflows",
|
|
85
|
-
"types"
|
|
86
|
-
]
|
|
87
|
-
}
|
|
88
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var test = require('tape');
|
|
4
|
-
var stringify = require('../');
|
|
5
|
-
|
|
6
|
-
test('custom comparison function', function (t) {
|
|
7
|
-
t.plan(1);
|
|
8
|
-
var obj = { c: 8, b: [{ z: 6, y: 5, x: 4 }, 7], a: 3 };
|
|
9
|
-
var s = stringify(obj, function (a, b) {
|
|
10
|
-
return a.key < b.key ? 1 : -1;
|
|
11
|
-
});
|
|
12
|
-
t.equal(s, '{"c":8,"b":[{"z":6,"y":5,"x":4},7],"a":3}');
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
test('custom comparison function with get', function (t) {
|
|
16
|
-
t.plan(2);
|
|
17
|
-
|
|
18
|
-
stringify({ a: 1, b: 2 }, /** @type {import('..').Comparator} */ function (_a, _b) { // eslint-disable-line no-unused-vars
|
|
19
|
-
t.equal(arguments[2], undefined, 'comparator options not passed when not explicitly requested');
|
|
20
|
-
return NaN;
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
var obj = { c: 8, b: [{ z: 7, y: 6, x: 4, v: 2, '!v': 3 }, 7], a: 3 };
|
|
24
|
-
var s = stringify(obj, function (a, b, options) {
|
|
25
|
-
var get = options.get;
|
|
26
|
-
// @ts-expect-error implicit coercion here is fine
|
|
27
|
-
var v1 = (get('!' + a.key) || 0) + a.value;
|
|
28
|
-
// @ts-expect-error implicit coercion here is fine
|
|
29
|
-
var v2 = (get('!' + b.key) || 0) + b.value;
|
|
30
|
-
return v1 - v2;
|
|
31
|
-
});
|
|
32
|
-
t.equal(s, '{"c":8,"b":[{"!v":3,"x":4,"v":2,"y":6,"z":7},7],"a":3}');
|
|
33
|
-
});
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var test = require('tape');
|
|
4
|
-
var stringify = require('../');
|
|
5
|
-
|
|
6
|
-
test('nested', function (t) {
|
|
7
|
-
t.plan(1);
|
|
8
|
-
var obj = { c: 8, b: [{ z: 6, y: 5, x: 4 }, 7], a: 3 };
|
|
9
|
-
t.equal(stringify(obj), '{"a":3,"b":[{"x":4,"y":5,"z":6},7],"c":8}');
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
test('cyclic (default)', function (t) {
|
|
13
|
-
t.plan(1);
|
|
14
|
-
var one = { a: 1, two: {} };
|
|
15
|
-
var two = { a: 2, one: one };
|
|
16
|
-
one.two = two;
|
|
17
|
-
try {
|
|
18
|
-
stringify(one);
|
|
19
|
-
} catch (ex) {
|
|
20
|
-
if (ex == null) { // eslint-disable-line eqeqeq
|
|
21
|
-
t.fail('nullish exception');
|
|
22
|
-
} else {
|
|
23
|
-
t.equal(ex.toString(), 'TypeError: Converting circular structure to JSON');
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
test('cyclic (specifically allowed)', function (t) {
|
|
29
|
-
t.plan(1);
|
|
30
|
-
var one = { a: 1, two: {} };
|
|
31
|
-
var two = { a: 2, one: one };
|
|
32
|
-
one.two = two;
|
|
33
|
-
t.equal(stringify(one, { cycles: true }), '{"a":1,"two":{"a":2,"one":"__cycle__"}}');
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
test('repeated non-cyclic value', function (t) {
|
|
37
|
-
t.plan(1);
|
|
38
|
-
var one = { x: 1 };
|
|
39
|
-
var two = { a: one, b: one };
|
|
40
|
-
t.equal(stringify(two), '{"a":{"x":1},"b":{"x":1}}');
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
test('acyclic but with reused obj-property pointers', function (t) {
|
|
44
|
-
t.plan(1);
|
|
45
|
-
var x = { a: 1 };
|
|
46
|
-
var y = { b: x, c: x };
|
|
47
|
-
t.equal(stringify(y), '{"b":{"a":1},"c":{"a":1}}');
|
|
48
|
-
});
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var test = require('tape');
|
|
4
|
-
var stringify = require('../');
|
|
5
|
-
|
|
6
|
-
test('replace root', function (t) {
|
|
7
|
-
t.plan(1);
|
|
8
|
-
|
|
9
|
-
var obj = { a: 1, b: 2, c: false };
|
|
10
|
-
var replacer = function () { return 'one'; };
|
|
11
|
-
|
|
12
|
-
t.equal(stringify(obj, { replacer: replacer }), '"one"');
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
test('replace numbers', function (t) {
|
|
16
|
-
t.plan(1);
|
|
17
|
-
|
|
18
|
-
var obj = { a: 1, b: 2, c: false };
|
|
19
|
-
/** @type {import('..').StableStringifyOptions['replacer']} */
|
|
20
|
-
var replacer = function (_key, value) {
|
|
21
|
-
if (value === 1) { return 'one'; }
|
|
22
|
-
if (value === 2) { return 'two'; }
|
|
23
|
-
return value;
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
t.equal(stringify(obj, { replacer: replacer }), '{"a":"one","b":"two","c":false}');
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
test('replace with object', function (t) {
|
|
30
|
-
t.plan(1);
|
|
31
|
-
|
|
32
|
-
var obj = { a: 1, b: 2, c: false };
|
|
33
|
-
/** @type {import('..').StableStringifyOptions['replacer']} */
|
|
34
|
-
var replacer = function (key, value) {
|
|
35
|
-
if (key === 'b') { return { d: 1 }; }
|
|
36
|
-
if (value === 1) { return 'one'; }
|
|
37
|
-
return value;
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
t.equal(stringify(obj, { replacer: replacer }), '{"a":"one","b":{"d":"one"},"c":false}');
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
test('replace with undefined', function (t) {
|
|
44
|
-
t.plan(1);
|
|
45
|
-
|
|
46
|
-
var obj = { a: 1, b: 2, c: false };
|
|
47
|
-
/** @type {import('..').StableStringifyOptions['replacer']} */
|
|
48
|
-
var replacer = function (_key, value) {
|
|
49
|
-
if (value === false) { return; }
|
|
50
|
-
return value;
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
t.equal(stringify(obj, { replacer: replacer }), '{"a":1,"b":2}');
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
test('replace with array', function (t) {
|
|
57
|
-
t.plan(1);
|
|
58
|
-
|
|
59
|
-
var obj = { a: 1, b: 2, c: false };
|
|
60
|
-
/** @type {import('..').StableStringifyOptions['replacer']} */
|
|
61
|
-
var replacer = function (key, value) {
|
|
62
|
-
if (key === 'b') { return ['one', 'two']; }
|
|
63
|
-
return value;
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
t.equal(stringify(obj, { replacer: replacer }), '{"a":1,"b":["one","two"],"c":false}');
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
test('replace array item', function (t) {
|
|
70
|
-
t.plan(1);
|
|
71
|
-
|
|
72
|
-
var obj = { a: 1, b: 2, c: [1, 2] };
|
|
73
|
-
/** @type {import('..').StableStringifyOptions['replacer']} */
|
|
74
|
-
var replacer = function (_key, value) {
|
|
75
|
-
if (value === 1) { return 'one'; }
|
|
76
|
-
if (value === 2) { return 'two'; }
|
|
77
|
-
return value;
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
t.equal(stringify(obj, { replacer: replacer }), '{"a":"one","b":"two","c":["one","two"]}');
|
|
81
|
-
});
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var test = require('tape');
|
|
4
|
-
var stringify = require('../');
|
|
5
|
-
|
|
6
|
-
// @ts-expect-error node ensures this will never fail
|
|
7
|
-
var isNode10OrLess = parseInt(process.version.match(/^v(\d+)\./)[1], 10) <= 10;
|
|
8
|
-
|
|
9
|
-
test('space parameter', function (t) {
|
|
10
|
-
t.plan(1);
|
|
11
|
-
var obj = { one: 1, two: 2 };
|
|
12
|
-
t.equal(
|
|
13
|
-
stringify(obj, { space: ' ' }),
|
|
14
|
-
''
|
|
15
|
-
+ '{\n'
|
|
16
|
-
+ ' "one": 1,\n'
|
|
17
|
-
+ ' "two": 2\n'
|
|
18
|
-
+ '}'
|
|
19
|
-
);
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
test('space parameter (with tabs)', function (t) {
|
|
23
|
-
t.plan(1);
|
|
24
|
-
var obj = { one: 1, two: 2 };
|
|
25
|
-
t.equal(
|
|
26
|
-
stringify(obj, { space: '\t' }),
|
|
27
|
-
''
|
|
28
|
-
+ '{\n'
|
|
29
|
-
+ '\t"one": 1,\n'
|
|
30
|
-
+ '\t"two": 2\n'
|
|
31
|
-
+ '}'
|
|
32
|
-
);
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
test('space parameter (with a number)', function (t) {
|
|
36
|
-
t.plan(1);
|
|
37
|
-
var obj = { one: 1, two: 2 };
|
|
38
|
-
t.equal(
|
|
39
|
-
stringify(obj, { space: 3 }),
|
|
40
|
-
''
|
|
41
|
-
+ '{\n'
|
|
42
|
-
+ ' "one": 1,\n'
|
|
43
|
-
+ ' "two": 2\n'
|
|
44
|
-
+ '}'
|
|
45
|
-
);
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
test('space parameter (nested objects)', function (t) {
|
|
49
|
-
t.plan(1);
|
|
50
|
-
var obj = { one: 1, two: { b: 4, a: [2, 3] } };
|
|
51
|
-
t.equal(
|
|
52
|
-
stringify(obj, { space: ' ' }),
|
|
53
|
-
''
|
|
54
|
-
+ '{\n'
|
|
55
|
-
+ ' "one": 1,\n'
|
|
56
|
-
+ ' "two": {\n'
|
|
57
|
-
+ ' "a": [\n'
|
|
58
|
-
+ ' 2,\n'
|
|
59
|
-
+ ' 3\n'
|
|
60
|
-
+ ' ],\n'
|
|
61
|
-
+ ' "b": 4\n'
|
|
62
|
-
+ ' }\n'
|
|
63
|
-
+ '}'
|
|
64
|
-
);
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
test('space parameter (same as native)', function (t) {
|
|
68
|
-
t.plan(1);
|
|
69
|
-
// for this test, properties need to be in alphabetical order
|
|
70
|
-
var obj = { one: 1, two: { a: [2, 3], b: 4 } };
|
|
71
|
-
t.equal(
|
|
72
|
-
stringify(obj, { space: ' ' }),
|
|
73
|
-
JSON.stringify(obj, null, ' ')
|
|
74
|
-
);
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
test('space parameter base empty behavior: empty arrays and objects have added newline and space', function (t) {
|
|
78
|
-
t.plan(1);
|
|
79
|
-
var obj = { emptyArr: [], emptyObj: {} };
|
|
80
|
-
t.equal(
|
|
81
|
-
stringify(obj, { space: ' ' }),
|
|
82
|
-
'{\n "emptyArr": [\n ],\n "emptyObj": {\n }\n}'
|
|
83
|
-
);
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
test('space parameter, with collapseEmpty: true', function (t) {
|
|
87
|
-
t.plan(2);
|
|
88
|
-
var obj = { emptyArr: [], emptyObj: {} };
|
|
89
|
-
|
|
90
|
-
t['throws'](
|
|
91
|
-
// @ts-expect-error
|
|
92
|
-
function () { stringify(obj, { collapseEmpty: 'not a boolean' }); },
|
|
93
|
-
TypeError
|
|
94
|
-
);
|
|
95
|
-
|
|
96
|
-
t.equal(
|
|
97
|
-
stringify(obj, { collapseEmpty: true, space: ' ' }),
|
|
98
|
-
'{\n "emptyArr": [],\n "emptyObj": {}\n}'
|
|
99
|
-
);
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
test('space parameter, on a cmp function', function (t) {
|
|
103
|
-
t.plan(3);
|
|
104
|
-
var obj = { one: 1, two: 2 };
|
|
105
|
-
/** @type {import('..').Comparator & import('../').StableStringifyOptions} */
|
|
106
|
-
var cmp = function (a, b) {
|
|
107
|
-
return (a < b ? 1 : -1) * (isNode10OrLess ? -1 : 1);
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
t.equal(
|
|
111
|
-
stringify(obj, { space: '\t' }),
|
|
112
|
-
'{\n\t"one": 1,\n\t"two": 2\n}',
|
|
113
|
-
'no cmp option (control)'
|
|
114
|
-
);
|
|
115
|
-
t.equal(
|
|
116
|
-
stringify(obj, { cmp: cmp, space: '\t' }),
|
|
117
|
-
'{\n\t"two": 2,\n\t"one": 1\n}',
|
|
118
|
-
'cmp option in the object'
|
|
119
|
-
);
|
|
120
|
-
|
|
121
|
-
cmp.space = '\t';
|
|
122
|
-
t.equal(
|
|
123
|
-
stringify(obj, cmp),
|
|
124
|
-
'{\n\t"two": 2,\n\t"one": 1\n}',
|
|
125
|
-
'cmp passed directly, with space option on it'
|
|
126
|
-
);
|
|
127
|
-
});
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var test = require('tape');
|
|
4
|
-
var stringify = require('../');
|
|
5
|
-
|
|
6
|
-
test('simple object', function (t) {
|
|
7
|
-
t.plan(1);
|
|
8
|
-
var obj = { c: 6, b: [4, 5], a: 3, z: null };
|
|
9
|
-
t.equal(stringify(obj), '{"a":3,"b":[4,5],"c":6,"z":null}');
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
test('object with undefined', function (t) {
|
|
13
|
-
t.plan(1);
|
|
14
|
-
var obj = { a: 3, z: undefined };
|
|
15
|
-
t.equal(stringify(obj), '{"a":3}');
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
test('array with undefined', function (t) {
|
|
19
|
-
t.plan(1);
|
|
20
|
-
var obj = [4, undefined, 6];
|
|
21
|
-
t.equal(stringify(obj), '[4,null,6]');
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
test('object with empty string', function (t) {
|
|
25
|
-
t.plan(1);
|
|
26
|
-
var obj = { a: 3, z: '' };
|
|
27
|
-
t.equal(stringify(obj), '{"a":3,"z":""}');
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
test('array with empty string', function (t) {
|
|
31
|
-
t.plan(1);
|
|
32
|
-
var obj = [4, '', 6];
|
|
33
|
-
t.equal(stringify(obj), '[4,"",6]');
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
test('raw string', function (t) {
|
|
37
|
-
t.plan(1);
|
|
38
|
-
var input = 'raw';
|
|
39
|
-
t.equal(stringify(input), '"raw"');
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
test('raw number', function (t) {
|
|
43
|
-
t.plan(1);
|
|
44
|
-
var input = 42;
|
|
45
|
-
t.equal(stringify(input), '42');
|
|
46
|
-
});
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var test = require('tape');
|
|
4
|
-
var stringify = require('../');
|
|
5
|
-
|
|
6
|
-
test('toJSON function', function (t) {
|
|
7
|
-
t.plan(1);
|
|
8
|
-
var obj = { one: 1, two: 2, toJSON: function () { return { one: 1 }; } };
|
|
9
|
-
t.equal(stringify(obj), '{"one":1}');
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
test('toJSON returns string', function (t) {
|
|
13
|
-
t.plan(1);
|
|
14
|
-
var obj = { one: 1, two: 2, toJSON: function () { return 'one'; } };
|
|
15
|
-
t.equal(stringify(obj), '"one"');
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
test('toJSON returns array', function (t) {
|
|
19
|
-
t.plan(1);
|
|
20
|
-
var obj = { one: 1, two: 2, toJSON: function () { return ['one']; } };
|
|
21
|
-
t.equal(stringify(obj), '["one"]');
|
|
22
|
-
});
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"root": true,
|
|
3
|
-
|
|
4
|
-
"extends": "@ljharb",
|
|
5
|
-
|
|
6
|
-
"rules": {
|
|
7
|
-
"complexity": 0,
|
|
8
|
-
"consistent-return": 1,
|
|
9
|
-
"func-style": [2, "declaration"],
|
|
10
|
-
"max-depth": 1,
|
|
11
|
-
"max-lines-per-function": 0,
|
|
12
|
-
"max-statements": 0,
|
|
13
|
-
"multiline-comment-style": 0,
|
|
14
|
-
"no-control-regex": 1,
|
|
15
|
-
"no-misleading-character-class": 1,
|
|
16
|
-
"no-restricted-syntax": 1,
|
|
17
|
-
"no-throw-literal": 0,
|
|
18
|
-
"no-unmodified-loop-condition": 0,
|
|
19
|
-
"sort-keys": 0,
|
|
20
|
-
},
|
|
21
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
# These are supported funding model platforms
|
|
2
|
-
|
|
3
|
-
github: [ljharb]
|
|
4
|
-
patreon: # Replace with a single Patreon username
|
|
5
|
-
open_collective: # Replace with a single Open Collective username
|
|
6
|
-
ko_fi: # Replace with a single Ko-fi username
|
|
7
|
-
tidelift: npm/jsonify
|
|
8
|
-
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
|
9
|
-
liberapay: # Replace with a single Liberapay username
|
|
10
|
-
issuehunt: # Replace with a single IssueHunt username
|
|
11
|
-
otechie: # Replace with a single Otechie username
|
|
12
|
-
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|