@blazetrails/ruby-compat 0.0.0-stage → 0.1.0-alpha0.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 +21 -0
- package/NOTICE +6 -0
- package/README.md +440 -2
- package/dist/argument-error.d.ts +15 -0
- package/dist/argument-error.js +15 -0
- package/dist/argument-error.js.map +1 -0
- package/dist/array.d.ts +415 -0
- package/dist/array.js +1330 -0
- package/dist/array.js.map +1 -0
- package/dist/async-context-adapter.d.ts +19 -0
- package/dist/async-context-adapter.js +139 -0
- package/dist/async-context-adapter.js.map +1 -0
- package/dist/backtrace-location.d.ts +77 -0
- package/dist/backtrace-location.js +155 -0
- package/dist/backtrace-location.js.map +1 -0
- package/dist/base64.d.ts +73 -0
- package/dist/base64.js +164 -0
- package/dist/base64.js.map +1 -0
- package/dist/benchmark.d.ts +19 -0
- package/dist/benchmark.js +16 -0
- package/dist/benchmark.js.map +1 -0
- package/dist/big-decimal.d.ts +110 -0
- package/dist/big-decimal.js +582 -0
- package/dist/big-decimal.js.map +1 -0
- package/dist/bundler.d.ts +44 -0
- package/dist/bundler.js +101 -0
- package/dist/bundler.js.map +1 -0
- package/dist/cgi.d.ts +89 -0
- package/dist/cgi.js +168 -0
- package/dist/cgi.js.map +1 -0
- package/dist/child-process-adapter.d.ts +110 -0
- package/dist/child-process-adapter.js +272 -0
- package/dist/child-process-adapter.js.map +1 -0
- package/dist/class-module.d.ts +10 -0
- package/dist/class-module.js +10 -0
- package/dist/class-module.js.map +1 -0
- package/dist/classpath.d.ts +90 -0
- package/dist/classpath.js +207 -0
- package/dist/classpath.js.map +1 -0
- package/dist/closed-queue-error.d.ts +10 -0
- package/dist/closed-queue-error.js +10 -0
- package/dist/closed-queue-error.js.map +1 -0
- package/dist/comparable.d.ts +127 -0
- package/dist/comparable.js +376 -0
- package/dist/comparable.js.map +1 -0
- package/dist/complex.d.ts +48 -0
- package/dist/complex.js +162 -0
- package/dist/complex.js.map +1 -0
- package/dist/concurrent/atomic-boolean.d.ts +24 -0
- package/dist/concurrent/atomic-boolean.js +43 -0
- package/dist/concurrent/atomic-boolean.js.map +1 -0
- package/dist/concurrent/atomic-fixnum.d.ts +21 -0
- package/dist/concurrent/atomic-fixnum.js +35 -0
- package/dist/concurrent/atomic-fixnum.js.map +1 -0
- package/dist/concurrent/count-down-latch.d.ts +20 -0
- package/dist/concurrent/count-down-latch.js +50 -0
- package/dist/concurrent/count-down-latch.js.map +1 -0
- package/dist/concurrent/cyclic-barrier.d.ts +18 -0
- package/dist/concurrent/cyclic-barrier.js +50 -0
- package/dist/concurrent/cyclic-barrier.js.map +1 -0
- package/dist/concurrent/event.d.ts +19 -0
- package/dist/concurrent/event.js +31 -0
- package/dist/concurrent/event.js.map +1 -0
- package/dist/concurrent/map.d.ts +149 -0
- package/dist/concurrent/map.js +202 -0
- package/dist/concurrent/map.js.map +1 -0
- package/dist/concurrent/read-write-lock.d.ts +25 -0
- package/dist/concurrent/read-write-lock.js +70 -0
- package/dist/concurrent/read-write-lock.js.map +1 -0
- package/dist/concurrent/semaphore.d.ts +24 -0
- package/dist/concurrent/semaphore.js +74 -0
- package/dist/concurrent/semaphore.js.map +1 -0
- package/dist/concurrent/timer-task.d.ts +52 -0
- package/dist/concurrent/timer-task.js +112 -0
- package/dist/concurrent/timer-task.js.map +1 -0
- package/dist/constants.generated.d.ts +2 -0
- package/dist/constants.generated.js +64 -0
- package/dist/constants.generated.js.map +1 -0
- package/dist/converter-not-found-error.d.ts +14 -0
- package/dist/converter-not-found-error.js +14 -0
- package/dist/converter-not-found-error.js.map +1 -0
- package/dist/crypto-adapter.d.ts +64 -0
- package/dist/crypto-adapter.js +365 -0
- package/dist/crypto-adapter.js.map +1 -0
- package/dist/delegate.d.ts +156 -0
- package/dist/delegate.js +306 -0
- package/dist/delegate.js.map +1 -0
- package/dist/digest.d.ts +99 -0
- package/dist/digest.js +131 -0
- package/dist/digest.js.map +1 -0
- package/dist/dir.d.ts +218 -0
- package/dist/dir.js +599 -0
- package/dist/dir.js.map +1 -0
- package/dist/encoding-error.d.ts +14 -0
- package/dist/encoding-error.js +17 -0
- package/dist/encoding-error.js.map +1 -0
- package/dist/encoding.d.ts +121 -0
- package/dist/encoding.js +306 -0
- package/dist/encoding.js.map +1 -0
- package/dist/ensure.d.ts +15 -0
- package/dist/ensure.js +35 -0
- package/dist/ensure.js.map +1 -0
- package/dist/enumerable.d.ts +375 -0
- package/dist/enumerable.js +1100 -0
- package/dist/enumerable.js.map +1 -0
- package/dist/enumerator.d.ts +321 -0
- package/dist/enumerator.js +642 -0
- package/dist/enumerator.js.map +1 -0
- package/dist/eof-error.d.ts +14 -0
- package/dist/eof-error.js +14 -0
- package/dist/eof-error.js.map +1 -0
- package/dist/errno.d.ts +327 -0
- package/dist/errno.js +452 -0
- package/dist/errno.js.map +1 -0
- package/dist/exc-detailed-message.d.ts +15 -0
- package/dist/exc-detailed-message.js +106 -0
- package/dist/exc-detailed-message.js.map +1 -0
- package/dist/exc-to-s.d.ts +10 -0
- package/dist/exc-to-s.js +21 -0
- package/dist/exc-to-s.js.map +1 -0
- package/dist/exception.d.ts +34 -0
- package/dist/exception.js +99 -0
- package/dist/exception.js.map +1 -0
- package/dist/fiber-error.d.ts +12 -0
- package/dist/fiber-error.js +12 -0
- package/dist/fiber-error.js.map +1 -0
- package/dist/fiber.d.ts +51 -0
- package/dist/fiber.js +178 -0
- package/dist/fiber.js.map +1 -0
- package/dist/file-utils.d.ts +480 -0
- package/dist/file-utils.js +1823 -0
- package/dist/file-utils.js.map +1 -0
- package/dist/file.d.ts +635 -0
- package/dist/file.js +1312 -0
- package/dist/file.js.map +1 -0
- package/dist/float-domain-error.d.ts +17 -0
- package/dist/float-domain-error.js +17 -0
- package/dist/float-domain-error.js.map +1 -0
- package/dist/fork-children.d.ts +23 -0
- package/dist/fork-children.js +32 -0
- package/dist/fork-children.js.map +1 -0
- package/dist/frozen-error.d.ts +33 -0
- package/dist/frozen-error.js +42 -0
- package/dist/frozen-error.js.map +1 -0
- package/dist/fs-adapter.d.ts +158 -0
- package/dist/fs-adapter.js +253 -0
- package/dist/fs-adapter.js.map +1 -0
- package/dist/gem/deprecate.d.ts +10 -0
- package/dist/gem/deprecate.js +8 -0
- package/dist/gem/deprecate.js.map +1 -0
- package/dist/gem/requirement.d.ts +64 -0
- package/dist/gem/requirement.js +91 -0
- package/dist/gem/requirement.js.map +1 -0
- package/dist/gem/version.d.ts +50 -0
- package/dist/gem/version.js +148 -0
- package/dist/gem/version.js.map +1 -0
- package/dist/gem.d.ts +59 -0
- package/dist/gem.js +82 -0
- package/dist/gem.js.map +1 -0
- package/dist/hash.d.ts +967 -0
- package/dist/hash.js +1572 -0
- package/dist/hash.js.map +1 -0
- package/dist/http-adapter.d.ts +123 -0
- package/dist/http-adapter.js +220 -0
- package/dist/http-adapter.js.map +1 -0
- package/dist/immediate-executor.d.ts +20 -0
- package/dist/immediate-executor.js +39 -0
- package/dist/immediate-executor.js.map +1 -0
- package/dist/include.d.ts +778 -0
- package/dist/include.js +2195 -0
- package/dist/include.js.map +1 -0
- package/dist/index-error.d.ts +13 -0
- package/dist/index-error.js +13 -0
- package/dist/index-error.js.map +1 -0
- package/dist/index.d.ts +174 -0
- package/dist/index.js +166 -0
- package/dist/index.js.map +1 -0
- package/dist/invalid-byte-sequence-error.d.ts +62 -0
- package/dist/invalid-byte-sequence-error.js +75 -0
- package/dist/invalid-byte-sequence-error.js.map +1 -0
- package/dist/io-error.d.ts +14 -0
- package/dist/io-error.js +17 -0
- package/dist/io-error.js.map +1 -0
- package/dist/io.d.ts +867 -0
- package/dist/io.js +1960 -0
- package/dist/io.js.map +1 -0
- package/dist/ipaddr.d.ts +79 -0
- package/dist/ipaddr.js +405 -0
- package/dist/ipaddr.js.map +1 -0
- package/dist/json.d.ts +67 -0
- package/dist/json.js +185 -0
- package/dist/json.js.map +1 -0
- package/dist/kernel-catch.d.ts +59 -0
- package/dist/kernel-catch.js +184 -0
- package/dist/kernel-catch.js.map +1 -0
- package/dist/kernel-float.d.ts +19 -0
- package/dist/kernel-float.js +54 -0
- package/dist/kernel-float.js.map +1 -0
- package/dist/kernel-fork.d.ts +30 -0
- package/dist/kernel-fork.js +72 -0
- package/dist/kernel-fork.js.map +1 -0
- package/dist/kernel-format.d.ts +27 -0
- package/dist/kernel-format.js +901 -0
- package/dist/kernel-format.js.map +1 -0
- package/dist/kernel-hash.d.ts +7 -0
- package/dist/kernel-hash.js +33 -0
- package/dist/kernel-hash.js.map +1 -0
- package/dist/kernel-integer.d.ts +49 -0
- package/dist/kernel-integer.js +170 -0
- package/dist/kernel-integer.js.map +1 -0
- package/dist/kernel-rand.d.ts +16 -0
- package/dist/kernel-rand.js +237 -0
- package/dist/kernel-rand.js.map +1 -0
- package/dist/kernel-system.d.ts +40 -0
- package/dist/kernel-system.js +97 -0
- package/dist/kernel-system.js.map +1 -0
- package/dist/kernel-warn.d.ts +35 -0
- package/dist/kernel-warn.js +73 -0
- package/dist/kernel-warn.js.map +1 -0
- package/dist/key-error.d.ts +44 -0
- package/dist/key-error.js +59 -0
- package/dist/key-error.js.map +1 -0
- package/dist/keyword-splat.d.ts +41 -0
- package/dist/keyword-splat.js +65 -0
- package/dist/keyword-splat.js.map +1 -0
- package/dist/load-error.d.ts +19 -0
- package/dist/load-error.js +19 -0
- package/dist/load-error.js.map +1 -0
- package/dist/load.d.ts +121 -0
- package/dist/load.js +263 -0
- package/dist/load.js.map +1 -0
- package/dist/loaded-features.d.ts +13 -0
- package/dist/loaded-features.js +15 -0
- package/dist/loaded-features.js.map +1 -0
- package/dist/local-jump-error.d.ts +12 -0
- package/dist/local-jump-error.js +12 -0
- package/dist/local-jump-error.js.map +1 -0
- package/dist/logger/formatter.d.ts +21 -0
- package/dist/logger/formatter.js +43 -0
- package/dist/logger/formatter.js.map +1 -0
- package/dist/logger/log-device.d.ts +52 -0
- package/dist/logger/log-device.js +104 -0
- package/dist/logger/log-device.js.map +1 -0
- package/dist/logger/severity.d.ts +23 -0
- package/dist/logger/severity.js +42 -0
- package/dist/logger/severity.js.map +1 -0
- package/dist/logger.d.ts +127 -0
- package/dist/logger.js +215 -0
- package/dist/logger.js.map +1 -0
- package/dist/marshal.d.ts +83 -0
- package/dist/marshal.js +1487 -0
- package/dist/marshal.js.map +1 -0
- package/dist/match-data.d.ts +161 -0
- package/dist/match-data.js +284 -0
- package/dist/match-data.js.map +1 -0
- package/dist/method-cache.d.ts +17 -0
- package/dist/method-cache.js +19 -0
- package/dist/method-cache.js.map +1 -0
- package/dist/method-missing-proxy.d.ts +53 -0
- package/dist/method-missing-proxy.js +154 -0
- package/dist/method-missing-proxy.js.map +1 -0
- package/dist/method.d.ts +132 -0
- package/dist/method.js +320 -0
- package/dist/method.js.map +1 -0
- package/dist/monitor.d.ts +114 -0
- package/dist/monitor.js +270 -0
- package/dist/monitor.js.map +1 -0
- package/dist/mutex.d.ts +51 -0
- package/dist/mutex.js +150 -0
- package/dist/mutex.js.map +1 -0
- package/dist/name-error.d.ts +45 -0
- package/dist/name-error.js +54 -0
- package/dist/name-error.js.map +1 -0
- package/dist/net/http/exceptions.d.ts +31 -0
- package/dist/net/http/exceptions.js +46 -0
- package/dist/net/http/exceptions.js.map +1 -0
- package/dist/net/http/request.d.ts +137 -0
- package/dist/net/http/request.js +559 -0
- package/dist/net/http/request.js.map +1 -0
- package/dist/net/http/requests.d.ts +197 -0
- package/dist/net/http/requests.js +197 -0
- package/dist/net/http/requests.js.map +1 -0
- package/dist/net/http/response.d.ts +141 -0
- package/dist/net/http/response.js +416 -0
- package/dist/net/http/response.js.map +1 -0
- package/dist/net/http/responses.d.ts +345 -0
- package/dist/net/http/responses.js +486 -0
- package/dist/net/http/responses.js.map +1 -0
- package/dist/net/http.d.ts +278 -0
- package/dist/net/http.js +760 -0
- package/dist/net/http.js.map +1 -0
- package/dist/net/protocol.d.ts +227 -0
- package/dist/net/protocol.js +392 -0
- package/dist/net/protocol.js.map +1 -0
- package/dist/nil-class.d.ts +10 -0
- package/dist/nil-class.js +27 -0
- package/dist/nil-class.js.map +1 -0
- package/dist/no-method-error.d.ts +38 -0
- package/dist/no-method-error.js +45 -0
- package/dist/no-method-error.js.map +1 -0
- package/dist/not-implemented-error.d.ts +13 -0
- package/dist/not-implemented-error.js +14 -0
- package/dist/not-implemented-error.js.map +1 -0
- package/dist/numeric.d.ts +211 -0
- package/dist/numeric.js +802 -0
- package/dist/numeric.js.map +1 -0
- package/dist/object-space.d.ts +34 -0
- package/dist/object-space.js +152 -0
- package/dist/object-space.js.map +1 -0
- package/dist/object.d.ts +908 -0
- package/dist/object.js +2238 -0
- package/dist/object.js.map +1 -0
- package/dist/open-uri.d.ts +180 -0
- package/dist/open-uri.js +402 -0
- package/dist/open-uri.js.map +1 -0
- package/dist/open3.d.ts +69 -0
- package/dist/open3.js +134 -0
- package/dist/open3.js.map +1 -0
- package/dist/openssl.d.ts +479 -0
- package/dist/openssl.js +1052 -0
- package/dist/openssl.js.map +1 -0
- package/dist/optparse.d.ts +130 -0
- package/dist/optparse.js +457 -0
- package/dist/optparse.js.map +1 -0
- package/dist/os-adapter.d.ts +20 -0
- package/dist/os-adapter.js +95 -0
- package/dist/os-adapter.js.map +1 -0
- package/dist/pathname.d.ts +71 -0
- package/dist/pathname.js +394 -0
- package/dist/pathname.js.map +1 -0
- package/dist/pp.d.ts +60 -0
- package/dist/pp.js +195 -0
- package/dist/pp.js.map +1 -0
- package/dist/pretty-print.d.ts +89 -0
- package/dist/pretty-print.js +232 -0
- package/dist/pretty-print.js.map +1 -0
- package/dist/process-adapter.d.ts +224 -0
- package/dist/process-adapter.js +878 -0
- package/dist/process-adapter.js.map +1 -0
- package/dist/process.d.ts +192 -0
- package/dist/process.js +403 -0
- package/dist/process.js.map +1 -0
- package/dist/psych/class-loader.d.ts +92 -0
- package/dist/psych/class-loader.js +139 -0
- package/dist/psych/class-loader.js.map +1 -0
- package/dist/psych/coder.d.ts +144 -0
- package/dist/psych/coder.js +176 -0
- package/dist/psych/coder.js.map +1 -0
- package/dist/psych/core-ext.d.ts +8 -0
- package/dist/psych/core-ext.js +10 -0
- package/dist/psych/core-ext.js.map +1 -0
- package/dist/psych/emitter.d.ts +116 -0
- package/dist/psych/emitter.js +1130 -0
- package/dist/psych/emitter.js.map +1 -0
- package/dist/psych/exception.d.ts +43 -0
- package/dist/psych/exception.js +54 -0
- package/dist/psych/exception.js.map +1 -0
- package/dist/psych/handler.d.ts +59 -0
- package/dist/psych/handler.js +95 -0
- package/dist/psych/handler.js.map +1 -0
- package/dist/psych/handlers/document-stream.d.ts +17 -0
- package/dist/psych/handlers/document-stream.js +26 -0
- package/dist/psych/handlers/document-stream.js.map +1 -0
- package/dist/psych/nodes/alias.d.ts +15 -0
- package/dist/psych/nodes/alias.js +22 -0
- package/dist/psych/nodes/alias.js.map +1 -0
- package/dist/psych/nodes/document.d.ts +23 -0
- package/dist/psych/nodes/document.js +35 -0
- package/dist/psych/nodes/document.js.map +1 -0
- package/dist/psych/nodes/mapping.d.ts +25 -0
- package/dist/psych/nodes/mapping.js +35 -0
- package/dist/psych/nodes/mapping.js.map +1 -0
- package/dist/psych/nodes/node.d.ts +59 -0
- package/dist/psych/nodes/node.js +79 -0
- package/dist/psych/nodes/node.js.map +1 -0
- package/dist/psych/nodes/scalar.d.ts +35 -0
- package/dist/psych/nodes/scalar.js +47 -0
- package/dist/psych/nodes/scalar.js.map +1 -0
- package/dist/psych/nodes/sequence.d.ts +25 -0
- package/dist/psych/nodes/sequence.js +35 -0
- package/dist/psych/nodes/sequence.js.map +1 -0
- package/dist/psych/nodes/stream.d.ts +23 -0
- package/dist/psych/nodes/stream.js +31 -0
- package/dist/psych/nodes/stream.js.map +1 -0
- package/dist/psych/omap.d.ts +9 -0
- package/dist/psych/omap.js +9 -0
- package/dist/psych/omap.js.map +1 -0
- package/dist/psych/parser.d.ts +41 -0
- package/dist/psych/parser.js +139 -0
- package/dist/psych/parser.js.map +1 -0
- package/dist/psych/scalar-scanner.d.ts +35 -0
- package/dist/psych/scalar-scanner.js +173 -0
- package/dist/psych/scalar-scanner.js.map +1 -0
- package/dist/psych/syntax-error.d.ts +23 -0
- package/dist/psych/syntax-error.js +35 -0
- package/dist/psych/syntax-error.js.map +1 -0
- package/dist/psych/tree-builder.d.ts +51 -0
- package/dist/psych/tree-builder.js +118 -0
- package/dist/psych/tree-builder.js.map +1 -0
- package/dist/psych/visitors/depth-first.d.ts +27 -0
- package/dist/psych/visitors/depth-first.js +37 -0
- package/dist/psych/visitors/depth-first.js.map +1 -0
- package/dist/psych/visitors/emitter.d.ts +32 -0
- package/dist/psych/visitors/emitter.js +63 -0
- package/dist/psych/visitors/emitter.js.map +1 -0
- package/dist/psych/visitors/to-ruby.d.ts +110 -0
- package/dist/psych/visitors/to-ruby.js +396 -0
- package/dist/psych/visitors/to-ruby.js.map +1 -0
- package/dist/psych/visitors/visitor.d.ts +11 -0
- package/dist/psych/visitors/visitor.js +17 -0
- package/dist/psych/visitors/visitor.js.map +1 -0
- package/dist/psych/visitors/yaml-tree.d.ts +182 -0
- package/dist/psych/visitors/yaml-tree.js +593 -0
- package/dist/psych/visitors/yaml-tree.js.map +1 -0
- package/dist/psych-adapter.d.ts +65 -0
- package/dist/psych-adapter.js +121 -0
- package/dist/psych-adapter.js.map +1 -0
- package/dist/psych-yaml.d.ts +2 -0
- package/dist/psych-yaml.js +5 -0
- package/dist/psych-yaml.js.map +1 -0
- package/dist/psych.d.ts +257 -0
- package/dist/psych.js +332 -0
- package/dist/psych.js.map +1 -0
- package/dist/queue.d.ts +129 -0
- package/dist/queue.js +215 -0
- package/dist/queue.js.map +1 -0
- package/dist/racc/parser.d.ts +70 -0
- package/dist/racc/parser.js +206 -0
- package/dist/racc/parser.js.map +1 -0
- package/dist/range-error.d.ts +15 -0
- package/dist/range-error.js +15 -0
- package/dist/range-error.js.map +1 -0
- package/dist/range.d.ts +166 -0
- package/dist/range.js +421 -0
- package/dist/range.js.map +1 -0
- package/dist/rational.d.ts +167 -0
- package/dist/rational.js +379 -0
- package/dist/rational.js.map +1 -0
- package/dist/rb-config.d.ts +33 -0
- package/dist/rb-config.js +53 -0
- package/dist/rb-config.js.map +1 -0
- package/dist/rb-equal.d.ts +66 -0
- package/dist/rb-equal.js +261 -0
- package/dist/rb-equal.js.map +1 -0
- package/dist/rb-hash.d.ts +26 -0
- package/dist/rb-hash.js +108 -0
- package/dist/rb-hash.js.map +1 -0
- package/dist/regexp.d.ts +82 -0
- package/dist/regexp.js +191 -0
- package/dist/regexp.js.map +1 -0
- package/dist/repl-adapter.d.ts +188 -0
- package/dist/repl-adapter.js +388 -0
- package/dist/repl-adapter.js.map +1 -0
- package/dist/resolv.d.ts +30 -0
- package/dist/resolv.js +48 -0
- package/dist/resolv.js.map +1 -0
- package/dist/ruby-empty.d.ts +28 -0
- package/dist/ruby-empty.js +40 -0
- package/dist/ruby-empty.js.map +1 -0
- package/dist/ruby-platform.d.ts +39 -0
- package/dist/ruby-platform.js +49 -0
- package/dist/ruby-platform.js.map +1 -0
- package/dist/runtime-error.d.ts +15 -0
- package/dist/runtime-error.js +16 -0
- package/dist/runtime-error.js.map +1 -0
- package/dist/scheduled-task.d.ts +73 -0
- package/dist/scheduled-task.js +150 -0
- package/dist/scheduled-task.js.map +1 -0
- package/dist/secure-random.d.ts +33 -0
- package/dist/secure-random.js +78 -0
- package/dist/secure-random.js.map +1 -0
- package/dist/set.d.ts +158 -0
- package/dist/set.js +352 -0
- package/dist/set.js.map +1 -0
- package/dist/shellwords.d.ts +27 -0
- package/dist/shellwords.js +53 -0
- package/dist/shellwords.js.map +1 -0
- package/dist/signal-exception.d.ts +21 -0
- package/dist/signal-exception.js +21 -0
- package/dist/signal-exception.js.map +1 -0
- package/dist/socket.d.ts +230 -0
- package/dist/socket.js +484 -0
- package/dist/socket.js.map +1 -0
- package/dist/standard-error.d.ts +18 -0
- package/dist/standard-error.js +23 -0
- package/dist/standard-error.js.map +1 -0
- package/dist/stop-iteration.d.ts +10 -0
- package/dist/stop-iteration.js +10 -0
- package/dist/stop-iteration.js.map +1 -0
- package/dist/string/b.d.ts +19 -0
- package/dist/string/b.js +28 -0
- package/dist/string/b.js.map +1 -0
- package/dist/string/byte-methods.d.ts +57 -0
- package/dist/string/byte-methods.js +266 -0
- package/dist/string/byte-methods.js.map +1 -0
- package/dist/string/bytes.d.ts +35 -0
- package/dist/string/bytes.js +123 -0
- package/dist/string/bytes.js.map +1 -0
- package/dist/string/case-mapping.d.ts +57 -0
- package/dist/string/case-mapping.js +192 -0
- package/dist/string/case-mapping.js.map +1 -0
- package/dist/string/chomp.d.ts +15 -0
- package/dist/string/chomp.js +32 -0
- package/dist/string/chomp.js.map +1 -0
- package/dist/string/convert.d.ts +55 -0
- package/dist/string/convert.js +316 -0
- package/dist/string/convert.js.map +1 -0
- package/dist/string/delete.d.ts +14 -0
- package/dist/string/delete.js +17 -0
- package/dist/string/delete.js.map +1 -0
- package/dist/string/each.d.ts +108 -0
- package/dist/string/each.js +305 -0
- package/dist/string/each.js.map +1 -0
- package/dist/string/encode.d.ts +37 -0
- package/dist/string/encode.js +268 -0
- package/dist/string/encode.js.map +1 -0
- package/dist/string/force-encoding.d.ts +72 -0
- package/dist/string/force-encoding.js +147 -0
- package/dist/string/force-encoding.js.map +1 -0
- package/dist/string/inspect.d.ts +17 -0
- package/dist/string/inspect.js +81 -0
- package/dist/string/inspect.js.map +1 -0
- package/dist/string/method-table.d.ts +174 -0
- package/dist/string/method-table.js +805 -0
- package/dist/string/method-table.js.map +1 -0
- package/dist/string/scrub.d.ts +12 -0
- package/dist/string/scrub.js +33 -0
- package/dist/string/scrub.js.map +1 -0
- package/dist/string/slice.d.ts +26 -0
- package/dist/string/slice.js +73 -0
- package/dist/string/slice.js.map +1 -0
- package/dist/string/split.d.ts +11 -0
- package/dist/string/split.js +44 -0
- package/dist/string/split.js.map +1 -0
- package/dist/string/sub.d.ts +114 -0
- package/dist/string/sub.js +371 -0
- package/dist/string/sub.js.map +1 -0
- package/dist/string/succ.d.ts +14 -0
- package/dist/string/succ.js +118 -0
- package/dist/string/succ.js.map +1 -0
- package/dist/string/support.d.ts +135 -0
- package/dist/string/support.js +283 -0
- package/dist/string/support.js.map +1 -0
- package/dist/string/tr.d.ts +46 -0
- package/dist/string/tr.js +156 -0
- package/dist/string/tr.js.map +1 -0
- package/dist/string-io.d.ts +166 -0
- package/dist/string-io.js +248 -0
- package/dist/string-io.js.map +1 -0
- package/dist/string-scanner.d.ts +133 -0
- package/dist/string-scanner.js +248 -0
- package/dist/string-scanner.js.map +1 -0
- package/dist/struct.d.ts +54 -0
- package/dist/struct.js +222 -0
- package/dist/struct.js.map +1 -0
- package/dist/symbol.d.ts +48 -0
- package/dist/symbol.js +107 -0
- package/dist/symbol.js.map +1 -0
- package/dist/tempfile.d.ts +173 -0
- package/dist/tempfile.js +290 -0
- package/dist/tempfile.js.map +1 -0
- package/dist/temporal-tag.d.ts +23 -0
- package/dist/temporal-tag.js +29 -0
- package/dist/temporal-tag.js.map +1 -0
- package/dist/thread-error.d.ts +13 -0
- package/dist/thread-error.js +13 -0
- package/dist/thread-error.js.map +1 -0
- package/dist/thread-pool-executor.d.ts +119 -0
- package/dist/thread-pool-executor.js +250 -0
- package/dist/thread-pool-executor.js.map +1 -0
- package/dist/thread.d.ts +211 -0
- package/dist/thread.js +495 -0
- package/dist/thread.js.map +1 -0
- package/dist/timeout.d.ts +29 -0
- package/dist/timeout.js +41 -0
- package/dist/timeout.js.map +1 -0
- package/dist/tse.d.ts +40 -0
- package/dist/tse.js +62 -0
- package/dist/tse.js.map +1 -0
- package/dist/type-error.d.ts +14 -0
- package/dist/type-error.js +15 -0
- package/dist/type-error.js.map +1 -0
- package/dist/undefined-conversion-error.d.ts +10 -0
- package/dist/undefined-conversion-error.js +10 -0
- package/dist/undefined-conversion-error.js.map +1 -0
- package/dist/uri/common.d.ts +209 -0
- package/dist/uri/common.js +369 -0
- package/dist/uri/common.js.map +1 -0
- package/dist/uri/generic.d.ts +283 -0
- package/dist/uri/generic.js +810 -0
- package/dist/uri/generic.js.map +1 -0
- package/dist/uri/http.d.ts +23 -0
- package/dist/uri/http.js +30 -0
- package/dist/uri/http.js.map +1 -0
- package/dist/uri/https.d.ts +13 -0
- package/dist/uri/https.js +15 -0
- package/dist/uri/https.js.map +1 -0
- package/dist/uri/rfc2396-parser.d.ts +70 -0
- package/dist/uri/rfc2396-parser.js +264 -0
- package/dist/uri/rfc2396-parser.js.map +1 -0
- package/dist/uri/rfc3986-parser.d.ts +46 -0
- package/dist/uri/rfc3986-parser.js +171 -0
- package/dist/uri/rfc3986-parser.js.map +1 -0
- package/dist/uri.d.ts +13 -0
- package/dist/uri.js +13 -0
- package/dist/uri.js.map +1 -0
- package/dist/variable.d.ts +183 -0
- package/dist/variable.js +463 -0
- package/dist/variable.js.map +1 -0
- package/dist/verbose.d.ts +21 -0
- package/dist/verbose.js +26 -0
- package/dist/verbose.js.map +1 -0
- package/dist/yaml.d.ts +9 -0
- package/dist/yaml.js +9 -0
- package/dist/yaml.js.map +1 -0
- package/dist/zlib-adapter.d.ts +117 -0
- package/dist/zlib-adapter.js +250 -0
- package/dist/zlib-adapter.js.map +1 -0
- package/dist/zlib.d.ts +248 -0
- package/dist/zlib.js +362 -0
- package/dist/zlib.js.map +1 -0
- package/package.json +82 -3
package/dist/hash.d.ts
ADDED
|
@@ -0,0 +1,967 @@
|
|
|
1
|
+
import { Enumerator } from "./enumerator.js";
|
|
2
|
+
declare const BLOCK: unique symbol;
|
|
3
|
+
/** @noRailsEquivalent PERMANENT — Ruby's `&block`, read back by `rb_block_given_p` (`vendor/ruby/v3.3.11/eval.c:866`); TypeScript has no such syntax, and a stored default may itself be callable, so the block carries a mark instead. */
|
|
4
|
+
export type Block<T> = ((key: string) => T) & {
|
|
5
|
+
readonly [BLOCK]: true;
|
|
6
|
+
};
|
|
7
|
+
/** @noRailsEquivalent PERMANENT — Ruby's `&` block-pass, whose `rb_block_given_p` (`vendor/ruby/v3.3.11/eval.c:866`) TypeScript has no equivalent of. */
|
|
8
|
+
export declare function block<T>(fn: (key: string) => T): Block<T>;
|
|
9
|
+
/** @noRailsEquivalent PERMANENT — Ruby's `&` block-pass, whose `rb_block_given_p` (`vendor/ruby/v3.3.11/eval.c:866`) TypeScript has no equivalent of. */
|
|
10
|
+
export declare function block<T>(fn: (key: string, oldValue: T, newValue: T) => T): ConflictBlock<T>;
|
|
11
|
+
/** @noRailsEquivalent PERMANENT — Ruby's `&` block-pass, whose `rb_block_given_p` (`vendor/ruby/v3.3.11/eval.c:866`) TypeScript has no equivalent of; a block yielded something other than a key. */
|
|
12
|
+
export declare function block<F extends (...args: never[]) => unknown>(fn: F): F & {
|
|
13
|
+
readonly [BLOCK]: true;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* `rb_block_given_p` (`vendor/ruby/v3.3.11/eval.c:866`): whether a trailing
|
|
17
|
+
* argument is a {@link block}-marked `&block` rather than a positional callable.
|
|
18
|
+
*
|
|
19
|
+
* @noRailsEquivalent PERMANENT
|
|
20
|
+
*/
|
|
21
|
+
export declare function rbBlockGivenP(value: unknown): value is Block<unknown>;
|
|
22
|
+
/**
|
|
23
|
+
* Ruby `Hash#fetch` (`vendor/ruby/v3.3.11/hash.c:2176` `rb_hash_fetch_m`), all three
|
|
24
|
+
* arms: with one argument the stored value or a `KeyError`, with a second the
|
|
25
|
+
* stored value or that default, and with a {@link block} the stored value or
|
|
26
|
+
* what the block returns for the missing key.
|
|
27
|
+
* @noRailsEquivalent PERMANENT — Ruby core `Hash#fetch` (`vendor/ruby/v3.3.11/hash.c:2176`).
|
|
28
|
+
*/
|
|
29
|
+
export declare function fetch<T>(hash: Record<string, unknown> | {
|
|
30
|
+
fetch(key: string, ...rest: never): unknown;
|
|
31
|
+
}, key: string): T;
|
|
32
|
+
/**
|
|
33
|
+
* The block arm: on a miss `rb_hash_fetch_m` yields the key and returns what
|
|
34
|
+
* the block returns, which is what `Rack::Request::Env#fetch_header`
|
|
35
|
+
* (`vendor/rack/v3.2.8/lib/rack/request.rb:111-113`) installs a default through.
|
|
36
|
+
* @noRailsEquivalent PERMANENT — Ruby core `Hash#fetch` (`vendor/ruby/v3.3.11/hash.c:2176`).
|
|
37
|
+
*/
|
|
38
|
+
export declare function fetch<T>(hash: Record<string, unknown> | {
|
|
39
|
+
fetch(key: string, ...rest: never): unknown;
|
|
40
|
+
}, key: string, block: Block<T>): T;
|
|
41
|
+
/**
|
|
42
|
+
* The two-argument arm: the STORED value whenever the key exists — including a
|
|
43
|
+
* stored `nil` or `false` — and otherwise `defaultValue`, which is what `??`
|
|
44
|
+
* gets wrong.
|
|
45
|
+
* @noRailsEquivalent PERMANENT — Ruby core `Hash#fetch` (`vendor/ruby/v3.3.11/hash.c:2176`).
|
|
46
|
+
*/
|
|
47
|
+
export declare function fetch<T>(hash: Record<string, unknown> | {
|
|
48
|
+
fetch(key: string, ...rest: never): unknown;
|
|
49
|
+
}, key: string, defaultValue: T): T;
|
|
50
|
+
/**
|
|
51
|
+
* The arguments forwarded as received, which is how a delegated `fetch`
|
|
52
|
+
* (`delegate :fetch, to: :attributes`) reaches `Hash#fetch`.
|
|
53
|
+
* @noRailsEquivalent PERMANENT — Ruby core `Hash#fetch` (`vendor/ruby/v3.3.11/hash.c:2176`).
|
|
54
|
+
*/
|
|
55
|
+
export declare function fetch<T>(hash: Record<string, unknown> | {
|
|
56
|
+
fetch(key: string, ...rest: never): unknown;
|
|
57
|
+
}, key: string, ...rest: [] | [T | Block<T>]): T;
|
|
58
|
+
/**
|
|
59
|
+
* The Map arm: a Hash keyed by objects, looked up the same way.
|
|
60
|
+
* @noRailsEquivalent PERMANENT — Ruby core `Hash#fetch` (`vendor/ruby/v3.3.11/hash.c:2176`).
|
|
61
|
+
*/
|
|
62
|
+
export declare function fetch<K, V, T>(hash: Map<K, V>, key: K, defaultValue: T): V | T;
|
|
63
|
+
/**
|
|
64
|
+
* The Map arm with the arguments forwarded as received, which is how a
|
|
65
|
+
* subclass's `fetch(key, *args)` reaches `super(key, *args)`.
|
|
66
|
+
* @noRailsEquivalent PERMANENT — Ruby core `Hash#fetch` (`vendor/ruby/v3.3.11/hash.c:2176`).
|
|
67
|
+
*/
|
|
68
|
+
export declare function fetch<K, V>(hash: Map<K, V>, key: K, ...rest: unknown[]): unknown;
|
|
69
|
+
/**
|
|
70
|
+
* Either arm, for a receiver typed as either.
|
|
71
|
+
* @noRailsEquivalent PERMANENT — Ruby core `Hash#fetch` (`vendor/ruby/v3.3.11/hash.c:2176`).
|
|
72
|
+
*/
|
|
73
|
+
export declare function fetch<V>(hash: Record<string, V> | Map<string, V> | {
|
|
74
|
+
fetch(key: string, ...rest: never): unknown;
|
|
75
|
+
}, key: string, ...rest: [] | [V | Block<V>]): V;
|
|
76
|
+
/**
|
|
77
|
+
* Ruby `Hash#key?` / `#has_key?` (`vendor/ruby/v3.3.11/hash.c:3671`
|
|
78
|
+
* `rb_hash_has_key`) — membership, which for a stored `nil` or `false` is the
|
|
79
|
+
* question `hash[key] !== undefined` cannot answer. A receiver that is not a
|
|
80
|
+
* Hash and defines `isKey` answers through it, as Ruby sends `key?` to the
|
|
81
|
+
* receiver: `values.key?(name)`
|
|
82
|
+
* (`activemodel/lib/active_model/attribute_set/builder.rb:33`) is
|
|
83
|
+
* `ActiveRecord::Result::IndexedRow#key?` when `values` is one. `fetch`,
|
|
84
|
+
* `keys` and `eachKey` dispatch the same way. An `undefined`-valued property of
|
|
85
|
+
* a plain object is an absent key: Ruby's stored `nil` is `null`, and a caller
|
|
86
|
+
* forwarding an absent keyword writes `{ name: undefined }`. That holds for a
|
|
87
|
+
* bare object only, with `Object.prototype` or no prototype: a class instance
|
|
88
|
+
* and a `Map` answer for the entry they store. `keys`, `eachKey` and the
|
|
89
|
+
* iterating readers still enumerate the property.
|
|
90
|
+
* @noRailsEquivalent PERMANENT — Ruby core `Hash#key?` (`vendor/ruby/v3.3.11/hash.c:3671`).
|
|
91
|
+
*/
|
|
92
|
+
export declare function hasKey(hash: object, key: PropertyKey): boolean;
|
|
93
|
+
/**
|
|
94
|
+
* Ruby `Hash#keys` (`vendor/ruby/v3.3.11/hash.c:3584` `rb_hash_keys`): a new Array
|
|
95
|
+
* of the keys, in insertion order.
|
|
96
|
+
* @noRailsEquivalent PERMANENT — Ruby core `Hash#keys` (`vendor/ruby/v3.3.11/hash.c:3584`).
|
|
97
|
+
*/
|
|
98
|
+
export declare function keys<K = string>(hash: Record<string, unknown> | Map<K, unknown> | {
|
|
99
|
+
readonly keys: K[] | (() => K[]);
|
|
100
|
+
}): K[];
|
|
101
|
+
/**
|
|
102
|
+
* Ruby `Hash#include?` (`vendor/ruby/v3.3.11/hash.c:7255`), which MRI defines onto the
|
|
103
|
+
* same `rb_hash_has_key` body as `key?` and `has_key?`.
|
|
104
|
+
* @noRailsEquivalent PERMANENT — Ruby core `Hash#include?` (`vendor/ruby/v3.3.11/hash.c:7255`).
|
|
105
|
+
*/
|
|
106
|
+
export declare const isInclude: typeof hasKey;
|
|
107
|
+
/**
|
|
108
|
+
* A Ruby block yielded a key and a value. `delete_if_i`
|
|
109
|
+
* (`vendor/ruby/v3.3.11/hash.c:2531`) tests its result with `RTEST` — false only for
|
|
110
|
+
* `nil` and `false` — so `deleteIf` spells that test out rather than coercing
|
|
111
|
+
* with `Boolean()`.
|
|
112
|
+
*/
|
|
113
|
+
type PairBlock<T> = (key: string, value: T) => unknown;
|
|
114
|
+
/**
|
|
115
|
+
* The conflict block `rb_hash_update` and `rb_hash_merge` take
|
|
116
|
+
* (`vendor/ruby/v3.3.11/hash.c:4012-4022` `rb_hash_update_block_i`), yielded the key,
|
|
117
|
+
* the RECEIVER's value and the argument's, in that order.
|
|
118
|
+
*/
|
|
119
|
+
export type ConflictBlock<T> = ((key: string, oldValue: T, newValue: T) => T) & {
|
|
120
|
+
readonly [BLOCK]: true;
|
|
121
|
+
};
|
|
122
|
+
/**
|
|
123
|
+
* Ruby `Hash#merge` (`vendor/ruby/v3.3.11/hash.c:4144` `rb_hash_merge`), which is
|
|
124
|
+
* `rb_hash_update` over `rb_hash_dup(self)` — a NEW hash, the receiver
|
|
125
|
+
* untouched, and it inherits `rb_hash_update`'s conflict-block arm through
|
|
126
|
+
* that call.
|
|
127
|
+
* @noRailsEquivalent PERMANENT — Ruby core `Hash#merge` (`vendor/ruby/v3.3.11/hash.c:4144`).
|
|
128
|
+
*/
|
|
129
|
+
export declare function merge<H extends object, const O extends object>(hash: H, other: O): Omit<H, keyof O> & O;
|
|
130
|
+
export declare function merge<T>(hash: Record<string, T>, ...others: (Record<string, T> | ToHash | ConflictBlock<T>)[]): Record<string, T>;
|
|
131
|
+
type ToHash = {
|
|
132
|
+
toHash(): object;
|
|
133
|
+
};
|
|
134
|
+
/**
|
|
135
|
+
* MRI's `rb_to_hash_type` (`vendor/ruby/v3.3.11/hash.c:1904`, `to_hash` at `:1909`), the implicit
|
|
136
|
+
* conversion `rb_hash_update_call` (`vendor/ruby/v3.3.11/hash.c:3960`) applies to
|
|
137
|
+
* each argument: a Hash is itself, anything else is asked for `to_hash`, and
|
|
138
|
+
* one that does not answer it raises `TypeError` (`rb_convert_type_with_id`).
|
|
139
|
+
*
|
|
140
|
+
* @noRailsEquivalent PERMANENT
|
|
141
|
+
*/
|
|
142
|
+
export declare function rbToHashType<T>(hash: Record<string, T> | Map<string, T> | ToHash): Record<string, T> | Map<string, T>;
|
|
143
|
+
/**
|
|
144
|
+
* Ruby `Hash#update` (`vendor/ruby/v3.3.11/hash.c:4028` `rb_hash_update`) — MUTATES
|
|
145
|
+
* the receiver and returns it, which is the whole difference from `merge`.
|
|
146
|
+
* Each argument is applied in turn, so a later one wins — unless a trailing
|
|
147
|
+
* conflict block is given, which `rb_hash_update_block_i`
|
|
148
|
+
* (`vendor/ruby/v3.3.11/hash.c:4012-4022`) yields for a key already in the receiver,
|
|
149
|
+
* storing what it returns. Each argument goes through `rb_to_hash_type`, so a
|
|
150
|
+
* `Hash` (a `Map`) is applied as readily as a plain object.
|
|
151
|
+
* @noRailsEquivalent PERMANENT — Ruby core `Hash#update` (`vendor/ruby/v3.3.11/hash.c:4028`).
|
|
152
|
+
*/
|
|
153
|
+
export declare function update<T>(hash: Record<string, T>, ...others: (Record<string, T> | Map<string, T> | ToHash | ConflictBlock<T>)[]): Record<string, T>;
|
|
154
|
+
/**
|
|
155
|
+
* The Map arm: a `Hash` receiver is written through its own `[]=`, as
|
|
156
|
+
* `rb_hash_update_i` does through `rb_hash_aset` (`vendor/ruby/v3.3.11/hash.c:3945`).
|
|
157
|
+
* @noRailsEquivalent PERMANENT — Ruby core `Hash#update` (`vendor/ruby/v3.3.11/hash.c:4028`).
|
|
158
|
+
*/
|
|
159
|
+
export declare function update<T, H extends Map<string, T>>(hash: H, ...others: (Record<string, T> | Map<string, T> | ToHash | ConflictBlock<T>)[]): H;
|
|
160
|
+
/**
|
|
161
|
+
* Ruby `Hash#merge!` (`vendor/ruby/v3.3.11/hash.c:7247`), which MRI defines onto the
|
|
162
|
+
* same `rb_hash_update` body as `update`, conflict-block arm included.
|
|
163
|
+
* @noRailsEquivalent PERMANENT — Ruby core `Hash#merge!` (`vendor/ruby/v3.3.11/hash.c:4028`).
|
|
164
|
+
*/
|
|
165
|
+
export declare const mergeBang: typeof update;
|
|
166
|
+
/**
|
|
167
|
+
* Ruby `Hash#replace` (`vendor/ruby/v3.3.11/hash.c:2967` `rb_hash_replace`) — empties
|
|
168
|
+
* the receiver, copies `hash2`'s entries into it, and returns the receiver.
|
|
169
|
+
* @noRailsEquivalent PERMANENT — Ruby core `Hash#replace` (`vendor/ruby/v3.3.11/hash.c:2967`).
|
|
170
|
+
*/
|
|
171
|
+
export declare function hashReplace<H extends object>(hash: H, hash2: object): H;
|
|
172
|
+
/**
|
|
173
|
+
* Ruby `Hash#delete` (`vendor/ruby/v3.3.11/hash.c:2441` `rb_hash_delete_m`) — removes
|
|
174
|
+
* the entry and returns its stored value, or `nil` when the key is absent,
|
|
175
|
+
* where the block form yields the key instead.
|
|
176
|
+
* @noRailsEquivalent PERMANENT — Ruby core `Hash#delete` (`vendor/ruby/v3.3.11/hash.c:2441`).
|
|
177
|
+
*/
|
|
178
|
+
export declare function hashDelete<T, U = null>(hash: Record<string, T>, key: string, block?: (key: string) => U): T | U | null;
|
|
179
|
+
/**
|
|
180
|
+
* The Map arm: `rb_hash_delete_m` is the same removal whichever hash it is given.
|
|
181
|
+
* @noRailsEquivalent PERMANENT — Ruby core `Hash#delete` (`vendor/ruby/v3.3.11/hash.c:2441`).
|
|
182
|
+
*/
|
|
183
|
+
export declare function hashDelete<K, V, U = null>(hash: Map<K, V>, key: K, block?: (key: K) => U): V | U | null;
|
|
184
|
+
/**
|
|
185
|
+
* Either hash, where the caller holds one it cannot tell apart statically.
|
|
186
|
+
* @noRailsEquivalent PERMANENT — Ruby core `Hash#delete` (`vendor/ruby/v3.3.11/hash.c:2441`).
|
|
187
|
+
*/
|
|
188
|
+
export declare function hashDelete(hash: object, key: unknown): unknown;
|
|
189
|
+
/**
|
|
190
|
+
* Ruby `Hash#clear` (`rb_hash_clear`, `vendor/ruby/v3.3.11/hash.c:2868`), which
|
|
191
|
+
* raises `FrozenError` through `rb_hash_modify_check` on a frozen receiver.
|
|
192
|
+
*
|
|
193
|
+
* @noRailsEquivalent PERMANENT
|
|
194
|
+
*/
|
|
195
|
+
export declare function hashClear<H extends object>(hash: H): H;
|
|
196
|
+
/**
|
|
197
|
+
* Ruby `Hash#[]` (`vendor/ruby/v3.3.11/hash.c:2121` `rb_hash_aref`) — the stored
|
|
198
|
+
* value, or `nil` when the key is absent, whichever hash it is given. A
|
|
199
|
+
* receiver that is not a Hash is sent its own `[]`, which it must spell `get`,
|
|
200
|
+
* the conventions table's default spelling for the operator. A miss goes to
|
|
201
|
+
* `rb_hash_default_value` (`vendor/ruby/v3.3.11/hash.c:2068`): a `Hash` answers
|
|
202
|
+
* its `default`, and a plain object, which has no default seat, answers `nil`.
|
|
203
|
+
* @noRailsEquivalent PERMANENT — Ruby core `Hash#[]` (`vendor/ruby/v3.3.11/hash.c:2121`).
|
|
204
|
+
*/
|
|
205
|
+
export declare function hashAref(hash: object, key: unknown): unknown;
|
|
206
|
+
/**
|
|
207
|
+
* Ruby `Hash#[]=` (`vendor/ruby/v3.3.11/hash.c:2018` `rb_hash_aset`) — stores the
|
|
208
|
+
* pair and returns the value, as the assignment expression does. A receiver
|
|
209
|
+
* that is not a Hash is sent its own `[]=`, spelled `set`.
|
|
210
|
+
* @noRailsEquivalent PERMANENT — Ruby core `Hash#[]=` (`vendor/ruby/v3.3.11/hash.c:2018`).
|
|
211
|
+
*/
|
|
212
|
+
export declare function hashAset<T>(hash: object, key: unknown, val: T): T;
|
|
213
|
+
/**
|
|
214
|
+
* Ruby `Hash#delete_if` (`vendor/ruby/v3.3.11/hash.c:2564` `rb_hash_delete_if`) —
|
|
215
|
+
* MUTATES the receiver, dropping every pair the block answers truthily for,
|
|
216
|
+
* and returns it.
|
|
217
|
+
* @noRailsEquivalent PERMANENT — Ruby core `Hash#delete_if` (`vendor/ruby/v3.3.11/hash.c:2564`).
|
|
218
|
+
*/
|
|
219
|
+
export declare function deleteIf<T>(hash: Record<string, T>, block: PairBlock<T>): Record<string, T>;
|
|
220
|
+
/**
|
|
221
|
+
* Ruby `Hash#keep_if` (`vendor/ruby/v3.3.11/hash.c:2844` `rb_hash_keep_if`) — the
|
|
222
|
+
* inverse of `delete_if`: MUTATES the receiver, dropping every pair the block
|
|
223
|
+
* answers falsily for (`keep_if_i`, `hash.c:2757`), and returns it.
|
|
224
|
+
* @noRailsEquivalent PERMANENT — Ruby core `Hash#keep_if` (`vendor/ruby/v3.3.11/hash.c:2844`).
|
|
225
|
+
*/
|
|
226
|
+
export declare function keepIf<T>(hash: Record<string, T>, block: PairBlock<T>): Record<string, T>;
|
|
227
|
+
/**
|
|
228
|
+
* Ruby `Hash#reject` (`vendor/ruby/v3.3.11/hash.c:2626` `rb_hash_reject`) — the
|
|
229
|
+
* non-mutating twin: `delete_if` over a dup.
|
|
230
|
+
* @noRailsEquivalent PERMANENT — Ruby core `Hash#reject` (`vendor/ruby/v3.3.11/hash.c:2626`).
|
|
231
|
+
*/
|
|
232
|
+
export declare function reject<T>(hash: Record<string, T>, block: PairBlock<T>): Record<string, T>;
|
|
233
|
+
/**
|
|
234
|
+
* Ruby `Hash#each_pair` (`vendor/ruby/v3.3.11/hash.c:3149` `rb_hash_each_pair`), which
|
|
235
|
+
* `Hash#each` is also defined onto (`hash.c:7219`): yields each key and value
|
|
236
|
+
* and returns the receiver. A `Hash` (a `Map`) is walked as readily as a plain object.
|
|
237
|
+
* A receiver that is not a Hash is sent its own `each`, as {@link hashAref}
|
|
238
|
+
* sends one its own `[]`; a lone Array that `each` yields is splatted over the
|
|
239
|
+
* two-parameter block (`vendor/ruby/v3.3.11/vm_insnhelper.c:4807`
|
|
240
|
+
* `vm_callee_setup_block_arg_arg0_splat`).
|
|
241
|
+
* @noRailsEquivalent PERMANENT — Ruby core `Hash#each_pair` (`vendor/ruby/v3.3.11/hash.c:3149`).
|
|
242
|
+
*/
|
|
243
|
+
export declare function eachPair<T>(hash: Record<string, T>, block: PairBlock<T>): Record<string, T>;
|
|
244
|
+
/**
|
|
245
|
+
* The Map arm: `rb_hash_foreach` walks whichever hash it is given.
|
|
246
|
+
* @noRailsEquivalent PERMANENT — Ruby core `Hash#each_pair` (`vendor/ruby/v3.3.11/hash.c:3149`).
|
|
247
|
+
*/
|
|
248
|
+
export declare function eachPair<T>(hash: Map<string, T>, block: PairBlock<T>): Map<string, T>;
|
|
249
|
+
/**
|
|
250
|
+
* Either arm, for a receiver typed as either.
|
|
251
|
+
* @noRailsEquivalent PERMANENT — Ruby core `Hash#each_pair` (`vendor/ruby/v3.3.11/hash.c:3149`).
|
|
252
|
+
*/
|
|
253
|
+
export declare function eachPair<T>(hash: Record<string, T> | Map<string, T>, block: PairBlock<T>): Record<string, T> | Map<string, T>;
|
|
254
|
+
/**
|
|
255
|
+
* Ruby `Hash#each_value` (`vendor/ruby/v3.3.11/hash.c:3060` `rb_hash_each_value`):
|
|
256
|
+
* yields each value alone and returns the receiver.
|
|
257
|
+
* @noRailsEquivalent PERMANENT — Ruby core `Hash#each_value` (`vendor/ruby/v3.3.11/hash.c:3060`).
|
|
258
|
+
*/
|
|
259
|
+
export declare function eachValue<T, R = never>(hash: Record<string, T> | {
|
|
260
|
+
eachValue(block: (value: T) => unknown): R;
|
|
261
|
+
}, block: (value: T) => unknown): Record<string, T> | R;
|
|
262
|
+
/**
|
|
263
|
+
* The blockless arm, `RETURN_SIZED_ENUMERATOR` (`hash.c:3061`): an Enumerator
|
|
264
|
+
* over the receiver's values.
|
|
265
|
+
* @noRailsEquivalent PERMANENT — Ruby core `Hash#each_value` (`vendor/ruby/v3.3.11/hash.c:3060`).
|
|
266
|
+
*/
|
|
267
|
+
export declare function eachValue<T>(hash: Record<string, T>, block?: undefined): Enumerator<T>;
|
|
268
|
+
/**
|
|
269
|
+
* The Map arm: `rb_hash_foreach` walks whichever hash it is given.
|
|
270
|
+
* @noRailsEquivalent PERMANENT — Ruby core `Hash#each_value` (`vendor/ruby/v3.3.11/hash.c:3060`).
|
|
271
|
+
*/
|
|
272
|
+
export declare function eachValue<K, T>(hash: Map<K, T>, block: (value: T) => unknown): Map<K, T>;
|
|
273
|
+
/**
|
|
274
|
+
* The Map arm, blockless.
|
|
275
|
+
* @noRailsEquivalent PERMANENT — Ruby core `Hash#each_value` (`vendor/ruby/v3.3.11/hash.c:3060`).
|
|
276
|
+
*/
|
|
277
|
+
export declare function eachValue<K, T>(hash: Map<K, T>, block?: undefined): Enumerator<T>;
|
|
278
|
+
/**
|
|
279
|
+
* Either arm, for a receiver typed as either.
|
|
280
|
+
* @noRailsEquivalent PERMANENT — Ruby core `Hash#each_value` (`vendor/ruby/v3.3.11/hash.c:3060`).
|
|
281
|
+
*/
|
|
282
|
+
export declare function eachValue<T, R = never>(hash: Record<string, T> | Map<unknown, T> | {
|
|
283
|
+
eachValue(block: (value: T) => unknown): R;
|
|
284
|
+
}, block: (value: T) => unknown): Record<string, T> | Map<unknown, T> | R;
|
|
285
|
+
/**
|
|
286
|
+
* A forwarded `&block`, which may be either arm.
|
|
287
|
+
* @noRailsEquivalent PERMANENT — Ruby core `Hash#each_value` (`vendor/ruby/v3.3.11/hash.c:3060`).
|
|
288
|
+
*/
|
|
289
|
+
export declare function eachValue<T>(hash: Record<string, T>, block: ((value: T) => unknown) | undefined): Record<string, T> | Enumerator<T>;
|
|
290
|
+
/**
|
|
291
|
+
* Ruby `Hash#each_key` (`vendor/ruby/v3.3.11/hash.c:3098` `rb_hash_each_key`): yields
|
|
292
|
+
* each key alone and returns the receiver.
|
|
293
|
+
* A receiver that defines `eachKey` answers what its own method returns, which
|
|
294
|
+
* need not be the receiver: `LazyAttributeHash#each_key` is `keys.each(&block)`
|
|
295
|
+
* (`activemodel/lib/active_model/attribute_set/builder.rb:129-132`), the keys
|
|
296
|
+
* Array `Array#each` returns.
|
|
297
|
+
* @noRailsEquivalent PERMANENT — Ruby core `Hash#each_key` (`vendor/ruby/v3.3.11/hash.c:3098`).
|
|
298
|
+
*/
|
|
299
|
+
export declare function eachKey<T, R = never>(hash: Record<string, T> | {
|
|
300
|
+
eachKey(block: (key: string) => unknown): R;
|
|
301
|
+
}, block: (key: string) => unknown): Record<string, T> | R;
|
|
302
|
+
/**
|
|
303
|
+
* The blockless arm, `RETURN_SIZED_ENUMERATOR` (`hash.c:3100`): the keys an
|
|
304
|
+
* Enumerable call chained onto the Enumerator iterates.
|
|
305
|
+
* @noRailsEquivalent PERMANENT — Ruby core `Hash#each_key` (`vendor/ruby/v3.3.11/hash.c:3098`).
|
|
306
|
+
*/
|
|
307
|
+
export declare function eachKey<T>(hash: Record<string, T> | {
|
|
308
|
+
eachKey(): string[];
|
|
309
|
+
}): string[];
|
|
310
|
+
/**
|
|
311
|
+
* Either arm, for a receiver typed as either.
|
|
312
|
+
* @noRailsEquivalent PERMANENT — Ruby core `Hash#each_key` (`vendor/ruby/v3.3.11/hash.c:3098`).
|
|
313
|
+
*/
|
|
314
|
+
export declare function eachKey<T>(hash: Record<string, T> | Map<string, T> | {
|
|
315
|
+
eachKey(block: (key: string) => unknown): unknown;
|
|
316
|
+
}, block: (key: string) => unknown): unknown;
|
|
317
|
+
/**
|
|
318
|
+
* Either arm, blockless.
|
|
319
|
+
* @noRailsEquivalent PERMANENT — Ruby core `Hash#each_key` (`vendor/ruby/v3.3.11/hash.c:3098`).
|
|
320
|
+
*/
|
|
321
|
+
export declare function eachKey<T>(hash: Record<string, T> | Map<string, T> | {
|
|
322
|
+
eachKey(): string[];
|
|
323
|
+
}): string[];
|
|
324
|
+
/**
|
|
325
|
+
* Ruby `Hash#transform_values!` (`vendor/ruby/v3.3.11/hash.c:3398`
|
|
326
|
+
* `rb_hash_transform_values_bang`): each value replaced in place by the
|
|
327
|
+
* block's result, answering the receiver.
|
|
328
|
+
* @noRailsEquivalent PERMANENT — Ruby core `Hash#transform_values!` (`vendor/ruby/v3.3.11/hash.c:3398`).
|
|
329
|
+
*/
|
|
330
|
+
export declare function transformValuesBang<H extends Record<string, unknown> | Map<unknown, unknown>>(hash: H, block: (value: unknown) => unknown): H;
|
|
331
|
+
/**
|
|
332
|
+
* The Map arm: `rb_hash_transform_values` answers a bare `Hash`
|
|
333
|
+
* (`rb_hash_new`), whatever the receiver's class and without its default.
|
|
334
|
+
* @noRailsEquivalent PERMANENT — Ruby core `Hash#transform_values` (`vendor/ruby/v3.3.11/hash.c:3366`).
|
|
335
|
+
*/
|
|
336
|
+
export declare function transformValues<K, T, U>(hash: Hash<K, T> | Map<K, T>, block: (value: T) => U): Hash<K, U>;
|
|
337
|
+
/**
|
|
338
|
+
* Ruby `Hash#transform_values` (`vendor/ruby/v3.3.11/hash.c:3366`
|
|
339
|
+
* `rb_hash_transform_values`) — a NEW hash with the same keys in the same
|
|
340
|
+
* order and each value replaced by the block's result.
|
|
341
|
+
* @noRailsEquivalent PERMANENT — Ruby core `Hash#transform_values` (`vendor/ruby/v3.3.11/hash.c:3366`).
|
|
342
|
+
*/
|
|
343
|
+
export declare function transformValues<T, U>(hash: Record<string, T> | {
|
|
344
|
+
transformValues(block: (value: T) => unknown): object;
|
|
345
|
+
}, block: (value: T) => U): Record<string, U>;
|
|
346
|
+
/**
|
|
347
|
+
* Either arm, for a receiver typed as either.
|
|
348
|
+
* @noRailsEquivalent PERMANENT — Ruby core `Hash#transform_values` (`vendor/ruby/v3.3.11/hash.c:3366`).
|
|
349
|
+
*/
|
|
350
|
+
export declare function transformValues<T, U>(hash: Record<string, T> | Map<string, T> | {
|
|
351
|
+
transformValues(block: (value: T) => unknown): object;
|
|
352
|
+
}, block: (value: T) => U): Record<string, U> | Hash<string, U>;
|
|
353
|
+
/**
|
|
354
|
+
* Ruby `Hash#slice` (`vendor/ruby/v3.3.11/hash.c:2651` `rb_hash_slice`) — a NEW hash
|
|
355
|
+
* of just the given keys, in ARGUMENT order, keys that are absent ignored.
|
|
356
|
+
* @noRailsEquivalent PERMANENT — Ruby core `Hash#slice` (`vendor/ruby/v3.3.11/hash.c:2651`).
|
|
357
|
+
*/
|
|
358
|
+
export declare function slice<T>(hash: Record<string, T>, ...keys: string[]): Record<string, T>;
|
|
359
|
+
/**
|
|
360
|
+
* The Map arm: `rb_hash_slice` answers a bare `Hash` (`rb_hash_new_with_size`)
|
|
361
|
+
* whatever the receiver's class.
|
|
362
|
+
* @noRailsEquivalent PERMANENT — Ruby core `Hash#slice` (`vendor/ruby/v3.3.11/hash.c:2651`).
|
|
363
|
+
*/
|
|
364
|
+
export declare function slice<K, V>(hash: Map<K, V>, ...keys: K[]): Hash<K, V>;
|
|
365
|
+
/**
|
|
366
|
+
* The Map arm: `hash_dup_with_compare_by_id` (`vendor/ruby/v3.3.11/hash.c:1563`)
|
|
367
|
+
* answers a bare `Hash` whatever the receiver's class, keeping only its
|
|
368
|
+
* `compare_by_identity` table type.
|
|
369
|
+
* @noRailsEquivalent PERMANENT — Ruby core `Hash#except` (`vendor/ruby/v3.3.11/hash.c:2683`).
|
|
370
|
+
*/
|
|
371
|
+
export declare function except<K, V>(hash: Hash<K, V> | Map<K, V>, ...keys: K[]): Hash<K, V>;
|
|
372
|
+
/**
|
|
373
|
+
* Ruby `Hash#except` (`vendor/ruby/v3.3.11/hash.c:2683` `rb_hash_except`) — a dup
|
|
374
|
+
* with the given keys deleted, keys that are absent ignored.
|
|
375
|
+
* @noRailsEquivalent PERMANENT — Ruby core `Hash#except` (`vendor/ruby/v3.3.11/hash.c:2683`).
|
|
376
|
+
*/
|
|
377
|
+
export declare function except<T>(receiver: Record<string, T> | {
|
|
378
|
+
except(...keys: string[]): Record<string, T>;
|
|
379
|
+
}, ...keys: string[]): Record<string, T>;
|
|
380
|
+
/**
|
|
381
|
+
* Either arm, for a receiver typed as either.
|
|
382
|
+
* @noRailsEquivalent PERMANENT — Ruby core `Hash#except` (`vendor/ruby/v3.3.11/hash.c:2683`).
|
|
383
|
+
*/
|
|
384
|
+
export declare function except<T>(receiver: Record<string, T> | Map<string, T> | {
|
|
385
|
+
except(...keys: string[]): Record<string, T> | Hash<string, T>;
|
|
386
|
+
}, ...keys: string[]): Record<string, T> | Hash<string, T>;
|
|
387
|
+
/**
|
|
388
|
+
* Ruby `Hash#values_at` (`vendor/ruby/v3.3.11/hash.c:2713` `rb_hash_values_at`) — an
|
|
389
|
+
* ARRAY of the values for the given keys, in argument order, `nil` for a key
|
|
390
|
+
* the hash does not hold.
|
|
391
|
+
* @noRailsEquivalent PERMANENT — Ruby core `Hash#values_at` (`vendor/ruby/v3.3.11/hash.c:2713`).
|
|
392
|
+
*/
|
|
393
|
+
export declare function valuesAt<T>(hash: Record<string, T> | Map<string, T>, ...keys: string[]): (T | null)[];
|
|
394
|
+
/**
|
|
395
|
+
* The Map arm: `rb_hash_aref` is the same lookup whichever hash it is given.
|
|
396
|
+
* @noRailsEquivalent PERMANENT — Ruby core `Hash#values_at` (`vendor/ruby/v3.3.11/hash.c:2713`).
|
|
397
|
+
*/
|
|
398
|
+
export declare function valuesAt<K, T>(hash: Map<K, T>, ...keys: K[]): (T | null)[];
|
|
399
|
+
/**
|
|
400
|
+
* Ruby `Hash#size` (`vendor/ruby/v3.3.11/hash.c:3002` `rb_hash_size`), and
|
|
401
|
+
* `Array#size` (`vendor/ruby/v3.3.11/array.c:2671` `rb_ary_length`): the number of
|
|
402
|
+
* pairs, or of elements.
|
|
403
|
+
* @noRailsEquivalent PERMANENT — Ruby core `Hash#size` (`vendor/ruby/v3.3.11/hash.c:3002`).
|
|
404
|
+
*/
|
|
405
|
+
export declare function size(hash: Record<string, unknown> | Map<unknown, unknown> | readonly unknown[] | object): number;
|
|
406
|
+
/**
|
|
407
|
+
* Ruby `Hash#dup` (`vendor/ruby/v3.3.11/object.c:591` `rb_obj_dup`), which for a Hash
|
|
408
|
+
* allocates through `rb_hash_dup` (`vendor/ruby/v3.3.11/hash.c:1584`): a NEW hash of
|
|
409
|
+
* the receiver's class (`rb_obj_class(hash)`) with the same pairs in the same order, carrying the receiver's `default` /
|
|
410
|
+
* `default_proc` over — `hash_dup` passes `RHASH_IFNONE(hash)` and the
|
|
411
|
+
* `RHASH_PROC_DEFAULT` flag through to the allocation, which a plain object
|
|
412
|
+
* spread has nowhere to put. The flag is what decides which of the two seats
|
|
413
|
+
* the value lands in, so the port reads the receiver's seat rather than
|
|
414
|
+
* testing the value's type. `hash_copy` (`vendor/ruby/v3.3.11/hash.c:1530`)
|
|
415
|
+
* copies the table with its type, so an identity hash dups into one.
|
|
416
|
+
* @noRailsEquivalent PERMANENT — Ruby core `Hash#dup` (`vendor/ruby/v3.3.11/object.c:591`).
|
|
417
|
+
*/
|
|
418
|
+
export declare function dup<K, V>(hash: Hash<K, V>): Hash<K, V>;
|
|
419
|
+
/**
|
|
420
|
+
* The plain-object arm: a Hash with no `default` seat is an object literal in
|
|
421
|
+
* trails, and `rb_obj_dup` over it copies the pairs into a fresh
|
|
422
|
+
* `rb_hash_dup` allocation, which has no ancestors — so `__proto__` stays an
|
|
423
|
+
* ordinary key in the copy, as it does in `transformValues` and `except`.
|
|
424
|
+
* @noRailsEquivalent PERMANENT — Ruby core `Hash#dup` (`vendor/ruby/v3.3.11/object.c:591`).
|
|
425
|
+
*/
|
|
426
|
+
export declare function dup<T>(hash: Record<string, T>): Record<string, T>;
|
|
427
|
+
/**
|
|
428
|
+
* Either arm, for a receiver typed as either.
|
|
429
|
+
* @noRailsEquivalent PERMANENT — Ruby core `Hash#dup` (`vendor/ruby/v3.3.11/object.c:591`).
|
|
430
|
+
*/
|
|
431
|
+
export declare function dup<T>(hash: Record<string, T> | Hash<string, T>): Record<string, T> | Hash<string, T>;
|
|
432
|
+
/**
|
|
433
|
+
* Ruby `Hash.ruby2_keywords_hash?` (`vendor/ruby/v3.3.11/hash.c:1952`
|
|
434
|
+
* `rb_hash_s_ruby2_keywords_hash_p`): whether this hash object is flagged to
|
|
435
|
+
* be passed as keywords. The flag is MRI's `RHASH_PASS_AS_KEYWORDS`
|
|
436
|
+
* (`vendor/ruby/v3.3.11/internal/hash.h:23`), a bit in the hash's own header
|
|
437
|
+
* and no entry of the hash, so no key enumeration or serializer sees it.
|
|
438
|
+
* @noRailsEquivalent PERMANENT — Ruby core `Hash.ruby2_keywords_hash?` (`vendor/ruby/v3.3.11/hash.c:1952`).
|
|
439
|
+
*/
|
|
440
|
+
export declare function rbHashSRuby2KeywordsHashP(hash: object): boolean;
|
|
441
|
+
/**
|
|
442
|
+
* Ruby `Hash.ruby2_keywords_hash` (`vendor/ruby/v3.3.11/hash.c:1974`
|
|
443
|
+
* `rb_hash_s_ruby2_keywords_hash`): a duplicate of the hash carrying the
|
|
444
|
+
* flag. The argument itself is left as it was. Both functions open with
|
|
445
|
+
* `Check_Type(hash, T_HASH)` (`rb_check_type`,
|
|
446
|
+
* `vendor/ruby/v3.3.11/error.c:1251`). MRI's `compare_by_identity` arm for an
|
|
447
|
+
* empty hash (`hash.c:1978-1980`) restores a table type its `hash_copy` drops
|
|
448
|
+
* for an empty table; `hashDup` here carries `compare_by_identity` whatever
|
|
449
|
+
* the size, so the copy already has it.
|
|
450
|
+
* @noRailsEquivalent PERMANENT — Ruby core `Hash.ruby2_keywords_hash` (`vendor/ruby/v3.3.11/hash.c:1974`).
|
|
451
|
+
*/
|
|
452
|
+
export declare function rbHashSRuby2KeywordsHash<H extends object>(hash: H): H;
|
|
453
|
+
/**
|
|
454
|
+
* A `Hash#default_proc` (`vendor/ruby/v3.3.11/hash.c:2308` `rb_hash_set_default_proc`):
|
|
455
|
+
* yielded the hash itself and the missing key.
|
|
456
|
+
*/
|
|
457
|
+
export type DefaultProc<K, V> = (hash: Hash<K, V>, key: K) => V;
|
|
458
|
+
type MapBoundaryReturn = any;
|
|
459
|
+
/**
|
|
460
|
+
* A Ruby `Hash` carrying the `default` / `default_proc` seat a plain JS object
|
|
461
|
+
* has nowhere to put: `Hash.new(obj)` stores a value returned for every miss,
|
|
462
|
+
* `Hash.new { |hash, key| … }` stores a proc run on every miss — the one that
|
|
463
|
+
* lets `hash[key]` populate the hash as it reads it. It subclasses `Map`
|
|
464
|
+
* because Ruby's key equality is `eql?`, not string coercion. Which features
|
|
465
|
+
* make a Ruby Hash a `Hash` rather than a plain object is in the README,
|
|
466
|
+
* § "When a Ruby Hash is a `Hash` and when it is an object".
|
|
467
|
+
*
|
|
468
|
+
* @noRailsEquivalent PERMANENT — Ruby core `Hash` (`vendor/ruby/v3.3.11/hash.c:7182`).
|
|
469
|
+
*/
|
|
470
|
+
export declare class Hash<K, V> extends Map<K, V> {
|
|
471
|
+
#private;
|
|
472
|
+
/**
|
|
473
|
+
* @noRailsEquivalent PERMANENT — Ruby core `Class#allocate` (`vendor/ruby/v3.3.11/object.c:2066`).
|
|
474
|
+
*/
|
|
475
|
+
static allocate<T>(this: new () => T): T;
|
|
476
|
+
/**
|
|
477
|
+
* `Hash.new` (`vendor/ruby/v3.3.11/hash.c:1782` `rb_hash_initialize`): a block is
|
|
478
|
+
* the default_proc, an argument the default value, neither is `nil`. A block
|
|
479
|
+
* is a single trailing function argument, the spelling `fetch` uses, and a
|
|
480
|
+
* block beside a default is `rb_check_arity(argc, 0, 0)`'s ArgumentError.
|
|
481
|
+
*
|
|
482
|
+
* @noRailsEquivalent PERMANENT — Ruby core `Hash.new` (`vendor/ruby/v3.3.11/hash.c:1782`).
|
|
483
|
+
*/
|
|
484
|
+
constructor(ifnone?: DefaultProc<K, V> | V, block?: DefaultProc<K, V>);
|
|
485
|
+
/**
|
|
486
|
+
* `Hash#[]` (`vendor/ruby/v3.3.11/hash.c:2121` `rb_hash_aref`) — a miss goes to
|
|
487
|
+
* `rb_hash_default_value` (`hash.c:2068`), which runs the default_proc with
|
|
488
|
+
* the missing key.
|
|
489
|
+
*
|
|
490
|
+
* @noRailsEquivalent PERMANENT — Ruby core `Hash#[]` (`vendor/ruby/v3.3.11/hash.c:2121`).
|
|
491
|
+
*/
|
|
492
|
+
/**
|
|
493
|
+
* `Object#freeze` (`vendor/ruby/v3.3.11/object.c:1284` `rb_obj_freeze`), which
|
|
494
|
+
* `Hash#freeze` (`vendor/ruby/v3.3.11/hash.c:107`) is. `Object.freeze` cannot serve:
|
|
495
|
+
* it seals a JS object's properties, and a `Map`'s entries are not
|
|
496
|
+
* properties, so the seat is the `FL_FREEZE` flag `rb_hash_modify_check`
|
|
497
|
+
* reads.
|
|
498
|
+
*
|
|
499
|
+
* @noRailsEquivalent PERMANENT — Ruby core `Object#freeze` (`vendor/ruby/v3.3.11/object.c:1284`).
|
|
500
|
+
*/
|
|
501
|
+
freeze(): this;
|
|
502
|
+
/**
|
|
503
|
+
* `Object#frozen?` (`vendor/ruby/v3.3.11/object.c:1301` `rb_obj_frozen_p`). Ruby's
|
|
504
|
+
* `?` predicate suffix is `is` here, per the conventions.
|
|
505
|
+
*
|
|
506
|
+
* @noRailsEquivalent PERMANENT — Ruby core `Object#frozen?` (`vendor/ruby/v3.3.11/object.c:1301`).
|
|
507
|
+
*/
|
|
508
|
+
isFrozen(): boolean;
|
|
509
|
+
/**
|
|
510
|
+
* `rb_hash_modify_check` (`vendor/ruby/v3.3.11/hash.c:1602`), which every mutator
|
|
511
|
+
* calls first: `rb_check_frozen` raises `FrozenError` naming the receiver's
|
|
512
|
+
* class and `inspect`.
|
|
513
|
+
*/
|
|
514
|
+
private modifyCheck;
|
|
515
|
+
/**
|
|
516
|
+
* `Hash#[]=` (`vendor/ruby/v3.3.11/hash.c:2018` `rb_hash_aset`), whose
|
|
517
|
+
* `rb_hash_modify` goes through `rb_hash_modify_check` (`hash.c:1623`).
|
|
518
|
+
*
|
|
519
|
+
* @noRailsEquivalent PERMANENT — Ruby core `Hash#[]=` (`vendor/ruby/v3.3.11/hash.c:2018`).
|
|
520
|
+
*/
|
|
521
|
+
set(key: K, value: V): this;
|
|
522
|
+
/**
|
|
523
|
+
* @noRailsEquivalent PERMANENT — Ruby core `Hash#include?` (`vendor/ruby/v3.3.11/hash.c:7255`, `rb_hash_has_key` `:3671`).
|
|
524
|
+
*/
|
|
525
|
+
isInclude(key: K): boolean;
|
|
526
|
+
/**
|
|
527
|
+
* `Hash#key?` (`vendor/ruby/v3.3.11/hash.c:3671` `rb_hash_has_key`), a lookup by
|
|
528
|
+
* the key's `hash` / `eql?`.
|
|
529
|
+
*
|
|
530
|
+
* @noRailsEquivalent PERMANENT — Ruby core `Hash#key?` (`vendor/ruby/v3.3.11/hash.c:3671`).
|
|
531
|
+
*/
|
|
532
|
+
has(key: K): boolean;
|
|
533
|
+
/**
|
|
534
|
+
* `Hash#has_value?` (`vendor/ruby/v3.3.11/hash.c:3697` `rb_hash_has_value`):
|
|
535
|
+
* `rb_hash_search_value` (`:3680`) compares each stored value with `==`.
|
|
536
|
+
*
|
|
537
|
+
* @noRailsEquivalent PERMANENT — Ruby core `Hash#has_value?` (`vendor/ruby/v3.3.11/hash.c:3697`).
|
|
538
|
+
*/
|
|
539
|
+
hasValue(val: unknown): boolean;
|
|
540
|
+
/**
|
|
541
|
+
* `Hash#key` (`vendor/ruby/v3.3.11/hash.c:2354` `rb_hash_key`): the key of the
|
|
542
|
+
* first entry whose value is `==` to `value` (`key_i`, `:2329`), else `nil`.
|
|
543
|
+
*
|
|
544
|
+
* @noRailsEquivalent PERMANENT — Ruby core `Hash#key` (`vendor/ruby/v3.3.11/hash.c:2354`).
|
|
545
|
+
*/
|
|
546
|
+
key(value: unknown): K | null;
|
|
547
|
+
/**
|
|
548
|
+
* The stored key `eql?` to `key`, found by `hash_stlike_lookup`
|
|
549
|
+
* (`vendor/ruby/v3.3.11/hash.c:2084`) through the `hash` / `eql?` pair
|
|
550
|
+
* (`rb_any_hash`, `hash.c:241`; `rb_any_cmp`, `hash.c:126`). A JS
|
|
551
|
+
* `Map` keys an object by identity, so two equal Arrays would otherwise be
|
|
552
|
+
* two entries. A primitive's identity is already its `eql?`. An identity
|
|
553
|
+
* hash's table type is `identhash` (`vendor/ruby/v3.3.11/hash.c:375`), whose
|
|
554
|
+
* `rb_ident_cmp` is the `Map`'s own comparison. Ruby has one Integer for
|
|
555
|
+
* every magnitude (`rb_int_equal`, `vendor/ruby/v3.3.11/numeric.c:4634`), so a
|
|
556
|
+
* `bigint` that fits a `number` is looked up as that `number`. A binary
|
|
557
|
+
* String, whose seat is a `Uint8Array`, is `eql?` to the 7-bit JS string it
|
|
558
|
+
* spells and hashes as it does (`rb_str_eql`, `vendor/ruby/v3.3.11/string.c:3773`,
|
|
559
|
+
* over `rb_str_comparable`, `string.c:3671`), so either finds the other.
|
|
560
|
+
*/
|
|
561
|
+
private hashStlikeLookup;
|
|
562
|
+
/**
|
|
563
|
+
* `Hash#clear` (`vendor/ruby/v3.3.11/hash.c:1988` `rb_hash_clear`), which also
|
|
564
|
+
* begins with `rb_hash_modify_check`.
|
|
565
|
+
*
|
|
566
|
+
* @noRailsEquivalent PERMANENT — Ruby core `Hash#clear` (`vendor/ruby/v3.3.11/hash.c:1988`).
|
|
567
|
+
*/
|
|
568
|
+
clear(): void;
|
|
569
|
+
get(key: K): V | undefined;
|
|
570
|
+
/**
|
|
571
|
+
* `Hash#default` (`vendor/ruby/v3.3.11/hash.c:2238` `rb_hash_default`), both arms:
|
|
572
|
+
* with no argument the stored default value — `nil` when a default_proc is
|
|
573
|
+
* what is stored — and with a key the proc's result for that key.
|
|
574
|
+
*
|
|
575
|
+
* @noRailsEquivalent PERMANENT — Ruby core `Hash#default` (`vendor/ruby/v3.3.11/hash.c:2238`).
|
|
576
|
+
*/
|
|
577
|
+
default(...key: [] | [K]): V | undefined;
|
|
578
|
+
/**
|
|
579
|
+
* The `JSON.stringify` protocol: a `Map`'s entries are not properties, so
|
|
580
|
+
* without it a Hash stringifies as `{}` where `Hash#to_json`
|
|
581
|
+
* (`vendor/ruby/v3.3.11/ext/json/generator/generator.c:430` `mHash_to_json`)
|
|
582
|
+
* writes each pair under its key's `to_s`, a Symbol's being its name.
|
|
583
|
+
*
|
|
584
|
+
* @noRailsEquivalent PERMANENT
|
|
585
|
+
*/
|
|
586
|
+
toJSON(): Record<string, V>;
|
|
587
|
+
/**
|
|
588
|
+
* `Hash#to_h` (`vendor/ruby/v3.3.11/hash.c:3555` `rb_hash_to_h`). With a block,
|
|
589
|
+
* `rb_hash_to_h_block` (`hash.c:3528`): a new bare Hash of the pairs the block
|
|
590
|
+
* returns, each checked by `rb_hash_set_pair` (`hash.c:3503`). With none, the receiver itself when it IS a Hash (`hash.c:3560`),
|
|
591
|
+
* otherwise a `hash_dup` (`hash.c:3562`) into a bare Hash that carries the
|
|
592
|
+
* same entries and the same `default` / `default_proc`. That bare Hash is a
|
|
593
|
+
* plain object when it needs no `Hash` feature (README, § "When a Ruby Hash
|
|
594
|
+
* is a `Hash` and when it is an object").
|
|
595
|
+
*
|
|
596
|
+
* @noRailsEquivalent PERMANENT — Ruby core `Hash#to_h` (`vendor/ruby/v3.3.11/hash.c:3555`).
|
|
597
|
+
*/
|
|
598
|
+
toH(): Hash<K, V> | Record<string, V>;
|
|
599
|
+
toH<K2, V2>(block: (key: K, value: V) => [K2, V2]): Hash<K2, V2>;
|
|
600
|
+
/**
|
|
601
|
+
* `Hash#default=` (`vendor/ruby/v3.3.11/hash.c:2265` `rb_hash_set_default`), whose
|
|
602
|
+
* `SET_DEFAULT` clears `RHASH_PROC_DEFAULT`. A TS `set` accessor cannot
|
|
603
|
+
* share a name with the `default()` reader, so it takes the conventions'
|
|
604
|
+
* `setX()` spelling.
|
|
605
|
+
*
|
|
606
|
+
* @noRailsEquivalent PERMANENT — Ruby core `Hash#default=` (`vendor/ruby/v3.3.11/hash.c:2265`).
|
|
607
|
+
*/
|
|
608
|
+
setDefault(value: V | undefined): void;
|
|
609
|
+
/**
|
|
610
|
+
* `Hash#default_proc` (`vendor/ruby/v3.3.11/hash.c:2285` `rb_hash_default_proc`):
|
|
611
|
+
* the proc only when one is what is stored.
|
|
612
|
+
*
|
|
613
|
+
* @noRailsEquivalent PERMANENT — Ruby core `Hash#default_proc` (`vendor/ruby/v3.3.11/hash.c:2285`).
|
|
614
|
+
*/
|
|
615
|
+
defaultProc(): DefaultProc<K, V> | undefined;
|
|
616
|
+
/**
|
|
617
|
+
* `Hash#default_proc=` (`vendor/ruby/v3.3.11/hash.c:2308`
|
|
618
|
+
* `rb_hash_set_default_proc`): `nil` goes through `SET_DEFAULT`, clearing
|
|
619
|
+
* the proc; anything that is not a Proc is a `TypeError`.
|
|
620
|
+
*
|
|
621
|
+
* @noRailsEquivalent PERMANENT — Ruby core `Hash#default_proc=` (`vendor/ruby/v3.3.11/hash.c:2308`).
|
|
622
|
+
*/
|
|
623
|
+
setDefaultProc(proc: DefaultProc<K, V> | undefined): void;
|
|
624
|
+
/**
|
|
625
|
+
* `Hash#delete` (`vendor/ruby/v3.3.11/hash.c:2441` `rb_hash_delete_m`): returns the
|
|
626
|
+
* deleted value, the block's result for a key that was not there, `nil`
|
|
627
|
+
* otherwise. `Map#delete` returns a boolean instead, and a TS override may
|
|
628
|
+
* not narrow a `boolean` return, so the declared return is
|
|
629
|
+
* `MapBoundaryReturn` — the dynamic return Ruby has here.
|
|
630
|
+
*
|
|
631
|
+
* @noRailsEquivalent PERMANENT — Ruby core `Hash#delete` (`vendor/ruby/v3.3.11/hash.c:2441`).
|
|
632
|
+
*/
|
|
633
|
+
delete(key: K, block?: (key: K) => V): MapBoundaryReturn;
|
|
634
|
+
/**
|
|
635
|
+
* `rb_hash_delete_entry` (`vendor/ruby/v3.3.11/hash.c:2383`): the stored
|
|
636
|
+
* value, or `Qundef` for a key that was not there.
|
|
637
|
+
*/
|
|
638
|
+
private deleteEntry;
|
|
639
|
+
/**
|
|
640
|
+
* Removes a stored entry from its bin by the hash the entry was stored
|
|
641
|
+
* under, as `st_table_entry.hash` holds it (`vendor/ruby/v3.3.11/st.c:134`),
|
|
642
|
+
* so a key whose `hash` has changed since is still found.
|
|
643
|
+
*/
|
|
644
|
+
private stDeleteEntry;
|
|
645
|
+
/**
|
|
646
|
+
* `Hash#shift` (`vendor/ruby/v3.3.11/hash.c:2492` `rb_hash_shift`): removes
|
|
647
|
+
* the first entry and returns it as a `[key, value]` pair, `nil` for an
|
|
648
|
+
* empty hash, after `rb_hash_modify_check`. The entry is removed directly,
|
|
649
|
+
* with no lookup of its key, as `st_shift` does (`hash.c:2515`). MRI takes
|
|
650
|
+
* it through `rb_hash_foreach` only while the hash is being iterated,
|
|
651
|
+
* because `st_shift` may not run then; a `Map` drops its first entry
|
|
652
|
+
* either way.
|
|
653
|
+
*
|
|
654
|
+
* @noRailsEquivalent PERMANENT — Ruby core `Hash#shift` (`vendor/ruby/v3.3.11/hash.c:2492`).
|
|
655
|
+
*/
|
|
656
|
+
shift(): [K, V] | undefined;
|
|
657
|
+
/**
|
|
658
|
+
* `Hash#compare_by_identity` (`vendor/ruby/v3.3.11/hash.c:4427`
|
|
659
|
+
* `rb_hash_compare_by_id`): keys are compared by identity from here on, and
|
|
660
|
+
* the receiver is returned. The rehash into an `identhash` table keeps every
|
|
661
|
+
* entry, since two stored keys were never `eql?`, so only the `eql?` index
|
|
662
|
+
* goes. A JS string is a primitive with no identity apart from its value, so
|
|
663
|
+
* two equal Strings stay one key where Ruby makes them two.
|
|
664
|
+
*
|
|
665
|
+
* @noRailsEquivalent PERMANENT — Ruby core `Hash#compare_by_identity` (`vendor/ruby/v3.3.11/hash.c:4427`).
|
|
666
|
+
*/
|
|
667
|
+
compareByIdentity(): this;
|
|
668
|
+
/**
|
|
669
|
+
* `rb_hash_foreach` (`vendor/ruby/v3.3.11/hash.c:1438`), the walk every
|
|
670
|
+
* yielding Hash method goes through: it raises the receiver's `iter_lev`
|
|
671
|
+
* for the length of the walk and lowers it in an `ensure`. A `for…of` that
|
|
672
|
+
* ends, breaks or throws closes the iterator and lowers the level. One left
|
|
673
|
+
* part-way keeps it raised, as a suspended `hash.each` Enumerator does.
|
|
674
|
+
*
|
|
675
|
+
* @noRailsEquivalent PERMANENT — Ruby core `rb_hash_foreach` (`vendor/ruby/v3.3.11/hash.c:1438`).
|
|
676
|
+
*/
|
|
677
|
+
[Symbol.iterator](): Generator<[K, V], undefined, unknown>;
|
|
678
|
+
/**
|
|
679
|
+
* `Map#entries`, the pair walk under another name, so it goes through
|
|
680
|
+
* `rb_hash_foreach` (`vendor/ruby/v3.3.11/hash.c:1438`) as `Hash#each_pair`
|
|
681
|
+
* does (`hash.c:3149`).
|
|
682
|
+
*
|
|
683
|
+
* @noRailsEquivalent PERMANENT — Ruby core `Hash#each_pair` (`vendor/ruby/v3.3.11/hash.c:3149`).
|
|
684
|
+
*/
|
|
685
|
+
entries(): Generator<[K, V], undefined, unknown>;
|
|
686
|
+
/**
|
|
687
|
+
* `Map#forEach`, walked through `rb_hash_foreach`
|
|
688
|
+
* (`vendor/ruby/v3.3.11/hash.c:1438`) as `Hash#each_pair` is (`hash.c:3149`).
|
|
689
|
+
*
|
|
690
|
+
* @noRailsEquivalent PERMANENT — Ruby core `Hash#each_pair` (`vendor/ruby/v3.3.11/hash.c:3149`).
|
|
691
|
+
*/
|
|
692
|
+
forEach(callbackfn: (value: V, key: K, map: Map<K, V>) => void, thisArg?: unknown): void;
|
|
693
|
+
/**
|
|
694
|
+
* `Hash#initialize_copy`, which MRI binds to `rb_hash_replace`
|
|
695
|
+
* (`vendor/ruby/v3.3.11/hash.c:7190`): the hook `rbObjDup` / `rbObjClone`
|
|
696
|
+
* dispatch, so a dup holds a copy of the receiver's table.
|
|
697
|
+
*
|
|
698
|
+
* @noRailsEquivalent PERMANENT — Ruby core `Hash#initialize_copy` (`vendor/ruby/v3.3.11/hash.c:7190`).
|
|
699
|
+
*/
|
|
700
|
+
initializeCopy(hash: Hash<K, V>): this;
|
|
701
|
+
/**
|
|
702
|
+
* `Hash#replace` (`vendor/ruby/v3.3.11/hash.c:2967` `rb_hash_replace`): the
|
|
703
|
+
* receiver takes `hash2`'s `default` / `default_proc` (`COPY_DEFAULT`) and a
|
|
704
|
+
* `hash_copy` of its table, which is not written through a subclass's `[]=`.
|
|
705
|
+
*
|
|
706
|
+
* @noRailsEquivalent PERMANENT — Ruby core `Hash#replace` (`vendor/ruby/v3.3.11/hash.c:2967`).
|
|
707
|
+
*/
|
|
708
|
+
replace(hash2: Iterable<[K, V]> | Record<string, unknown>): this;
|
|
709
|
+
/**
|
|
710
|
+
* `Hash#merge` (`vendor/ruby/v3.3.11/hash.c:4144` `rb_hash_merge`), the
|
|
711
|
+
* method a `:merge` send finds; the body is {@link merge}'s. The conflict
|
|
712
|
+
* block is the trailing argument, marked with {@link block}.
|
|
713
|
+
*
|
|
714
|
+
* @noRailsEquivalent PERMANENT — Ruby core `Hash#merge` (`vendor/ruby/v3.3.11/hash.c:4144`).
|
|
715
|
+
*/
|
|
716
|
+
merge(...argv: (object | undefined)[]): Hash<K, V>;
|
|
717
|
+
/** `hash_iterating_p` (`vendor/ruby/v3.3.11/hash.c:1339`). */
|
|
718
|
+
private hashIteratingP;
|
|
719
|
+
/**
|
|
720
|
+
* `Hash#compare_by_identity?` (`vendor/ruby/v3.3.11/hash.c:4474`
|
|
721
|
+
* `rb_hash_compare_by_id_p`).
|
|
722
|
+
*
|
|
723
|
+
* @noRailsEquivalent PERMANENT — Ruby core `Hash#compare_by_identity?` (`vendor/ruby/v3.3.11/hash.c:4474`).
|
|
724
|
+
*/
|
|
725
|
+
isCompareByIdentity(): boolean;
|
|
726
|
+
/**
|
|
727
|
+
* `Hash#each` (`vendor/ruby/v3.3.11/hash.c:7219`), `rb_hash_each_pair`
|
|
728
|
+
* (`hash.c:3149`): yields the key and the value to a block taking two
|
|
729
|
+
* parameters (`each_pair_i_fast`) and one `[key, value]` pair otherwise
|
|
730
|
+
* (`each_pair_i`), and returns the receiver.
|
|
731
|
+
*
|
|
732
|
+
* @noRailsEquivalent PERMANENT
|
|
733
|
+
*/
|
|
734
|
+
each(block: ((pair: [K, V]) => void) | ((key: K, value: V) => void)): this;
|
|
735
|
+
/**
|
|
736
|
+
* `Hash#keys` (`vendor/ruby/v3.3.11/hash.c:3584` `rb_hash_keys`): an Array of the
|
|
737
|
+
* keys, where `Map#keys` is an iterator. A TS override may not narrow that
|
|
738
|
+
* return, so it declares `MapBoundaryReturn`, the same Map boundary `delete`
|
|
739
|
+
* meets.
|
|
740
|
+
*
|
|
741
|
+
* @noRailsEquivalent PERMANENT — Ruby core `Hash#keys` (`vendor/ruby/v3.3.11/hash.c:3584`).
|
|
742
|
+
*/
|
|
743
|
+
keys(): MapBoundaryReturn;
|
|
744
|
+
/**
|
|
745
|
+
* `Hash#values` (`vendor/ruby/v3.3.11/hash.c:3628` `rb_hash_values`): an Array of the
|
|
746
|
+
* values, where `Map#values` is an iterator.
|
|
747
|
+
*
|
|
748
|
+
* @noRailsEquivalent PERMANENT — Ruby core `Hash#values` (`vendor/ruby/v3.3.11/hash.c:3628`).
|
|
749
|
+
*/
|
|
750
|
+
values(): MapBoundaryReturn;
|
|
751
|
+
/**
|
|
752
|
+
* `Hash#length` (`vendor/ruby/v3.3.11/hash.c:3002` `rb_hash_size`).
|
|
753
|
+
*
|
|
754
|
+
* @noRailsEquivalent PERMANENT
|
|
755
|
+
*/
|
|
756
|
+
length(): number;
|
|
757
|
+
/**
|
|
758
|
+
* `Hash#empty?` (`vendor/ruby/v3.3.11/hash.c:3023` `rb_hash_empty_p`).
|
|
759
|
+
*
|
|
760
|
+
* @noRailsEquivalent PERMANENT
|
|
761
|
+
*/
|
|
762
|
+
isEmpty(): boolean;
|
|
763
|
+
/**
|
|
764
|
+
* `Hash#delete_if` (`vendor/ruby/v3.3.11/hash.c:2564` `rb_hash_delete_if`):
|
|
765
|
+
* drops every pair the block answers truthily for, and returns the receiver.
|
|
766
|
+
*
|
|
767
|
+
* @noRailsEquivalent PERMANENT
|
|
768
|
+
*/
|
|
769
|
+
deleteIf(block: (key: K, value: V) => unknown): this;
|
|
770
|
+
/**
|
|
771
|
+
* `Hash#reject!` (`vendor/ruby/v3.3.11/hash.c:2594` `rb_hash_reject_bang`):
|
|
772
|
+
* `delete_if`, answering `nil` when nothing was deleted.
|
|
773
|
+
*
|
|
774
|
+
* @noRailsEquivalent PERMANENT
|
|
775
|
+
*/
|
|
776
|
+
rejectBang(block: (key: K, value: V) => unknown): this | null;
|
|
777
|
+
/**
|
|
778
|
+
* `Hash#keep_if` (`vendor/ruby/v3.3.11/hash.c:2844` `rb_hash_keep_if`): drops
|
|
779
|
+
* every pair the block answers falsily for (`keep_if_i`, `:2757`).
|
|
780
|
+
*
|
|
781
|
+
* @noRailsEquivalent PERMANENT
|
|
782
|
+
*/
|
|
783
|
+
keepIf(block: (key: K, value: V) => unknown): this;
|
|
784
|
+
/**
|
|
785
|
+
* `Hash#select!` (`vendor/ruby/v3.3.11/hash.c:2813` `rb_hash_select_bang`):
|
|
786
|
+
* `keep_if`, answering `nil` when nothing was deleted.
|
|
787
|
+
*
|
|
788
|
+
* @noRailsEquivalent PERMANENT
|
|
789
|
+
*/
|
|
790
|
+
selectBang(block: (key: K, value: V) => unknown): this | null;
|
|
791
|
+
/**
|
|
792
|
+
* `Hash#transform_values!` (`vendor/ruby/v3.3.11/hash.c:3398`
|
|
793
|
+
* `rb_hash_transform_values_bang`).
|
|
794
|
+
*
|
|
795
|
+
* @noRailsEquivalent PERMANENT
|
|
796
|
+
*/
|
|
797
|
+
transformValuesBang(block: (value: V) => V): this;
|
|
798
|
+
/**
|
|
799
|
+
* `Hash#store` (`vendor/ruby/v3.3.11/hash.c:7177`), `rb_hash_aset`.
|
|
800
|
+
*
|
|
801
|
+
* @noRailsEquivalent PERMANENT
|
|
802
|
+
*/
|
|
803
|
+
store(key: K, value: V): this;
|
|
804
|
+
/**
|
|
805
|
+
* `Hash#fetch` (`vendor/ruby/v3.3.11/hash.c:2176` `rb_hash_fetch_m`); the body is
|
|
806
|
+
* {@link fetch}'s.
|
|
807
|
+
*
|
|
808
|
+
* @noRailsEquivalent PERMANENT
|
|
809
|
+
*/
|
|
810
|
+
fetch(key: K, ...rest: unknown[]): unknown;
|
|
811
|
+
/**
|
|
812
|
+
* `Hash#key?` / `#has_key?` (`vendor/ruby/v3.3.11/hash.c:3671` `rb_hash_has_key`).
|
|
813
|
+
*
|
|
814
|
+
* @noRailsEquivalent PERMANENT
|
|
815
|
+
*/
|
|
816
|
+
hasKey(key: K): boolean;
|
|
817
|
+
/**
|
|
818
|
+
* `Hash#member?` (`vendor/ruby/v3.3.11/hash.c:7239`), `rb_hash_has_key`.
|
|
819
|
+
*
|
|
820
|
+
* @noRailsEquivalent PERMANENT
|
|
821
|
+
*/
|
|
822
|
+
isMember(key: K): boolean;
|
|
823
|
+
/**
|
|
824
|
+
* `Hash#invert` (`vendor/ruby/v3.3.11/hash.c:3900` `rb_hash_invert`): a new bare
|
|
825
|
+
* Hash mapping each value to its key.
|
|
826
|
+
*
|
|
827
|
+
* @noRailsEquivalent PERMANENT
|
|
828
|
+
*/
|
|
829
|
+
invert(): Map<unknown, K>;
|
|
830
|
+
/**
|
|
831
|
+
* `Hash#to_proc` (`vendor/ruby/v3.3.11/hash.c:4752` `rb_hash_to_proc`): a lambda
|
|
832
|
+
* answering `hash[key]`.
|
|
833
|
+
*
|
|
834
|
+
* @noRailsEquivalent PERMANENT
|
|
835
|
+
*/
|
|
836
|
+
toProc(): (key: never) => V | undefined | null;
|
|
837
|
+
/**
|
|
838
|
+
* `Hash#transform_values` (`vendor/ruby/v3.3.11/hash.c:3366`
|
|
839
|
+
* `rb_hash_transform_values`): a new Hash with each value replaced by the
|
|
840
|
+
* block's result.
|
|
841
|
+
*
|
|
842
|
+
* @noRailsEquivalent PERMANENT
|
|
843
|
+
*/
|
|
844
|
+
transformValues(block: (value: NoInfer<V>) => NoInfer<V>): Hash<K, V>;
|
|
845
|
+
/**
|
|
846
|
+
* `Hash#update` (`vendor/ruby/v3.3.11/hash.c:4028` `rb_hash_update`); the body is
|
|
847
|
+
* {@link update}'s.
|
|
848
|
+
*
|
|
849
|
+
* @noRailsEquivalent PERMANENT
|
|
850
|
+
*/
|
|
851
|
+
update(...others: unknown[]): this;
|
|
852
|
+
/**
|
|
853
|
+
* `Hash#merge!` (`vendor/ruby/v3.3.11/hash.c:7247`), defined onto `rb_hash_update`.
|
|
854
|
+
*
|
|
855
|
+
* @noRailsEquivalent PERMANENT
|
|
856
|
+
*/
|
|
857
|
+
mergeBang(...others: unknown[]): this;
|
|
858
|
+
/**
|
|
859
|
+
* `Hash#values_at` (`vendor/ruby/v3.3.11/hash.c:2713` `rb_hash_values_at`): each
|
|
860
|
+
* key's `rb_hash_aref`, the default included.
|
|
861
|
+
*
|
|
862
|
+
* @noRailsEquivalent PERMANENT
|
|
863
|
+
*/
|
|
864
|
+
valuesAt(...keys: K[]): (V | undefined | null)[];
|
|
865
|
+
/**
|
|
866
|
+
* `Hash#slice` (`vendor/ruby/v3.3.11/hash.c:2651` `rb_hash_slice`); the body is
|
|
867
|
+
* {@link slice}'s.
|
|
868
|
+
*
|
|
869
|
+
* @noRailsEquivalent PERMANENT
|
|
870
|
+
*/
|
|
871
|
+
slice(...keys: K[]): Hash<K, V>;
|
|
872
|
+
/**
|
|
873
|
+
* `Hash#transform_keys` (`vendor/ruby/v3.3.11/hash.c:3227` `rb_hash_transform_keys`):
|
|
874
|
+
* a new bare Hash keyed by `hash2`'s mapping, else the block's result, else
|
|
875
|
+
* the key itself (`transform_keys_hash_i`, `:3166`), or by the block alone
|
|
876
|
+
* (`transform_keys_i`, `:3182`). The blockless Enumerator arm is not ported.
|
|
877
|
+
*
|
|
878
|
+
* @noRailsEquivalent PERMANENT
|
|
879
|
+
*/
|
|
880
|
+
transformKeys(hash2: object | ((key: NoInfer<K>) => NoInfer<K>), block?: (key: NoInfer<K>) => NoInfer<K>): Hash<K, V>;
|
|
881
|
+
/**
|
|
882
|
+
* `Hash#transform_keys!` (`vendor/ruby/v3.3.11/hash.c:3267`
|
|
883
|
+
* `rb_hash_transform_keys_bang`).
|
|
884
|
+
*
|
|
885
|
+
* @noRailsEquivalent PERMANENT
|
|
886
|
+
*/
|
|
887
|
+
transformKeysBang(hash2: object | ((key: NoInfer<K>) => NoInfer<K>), block?: (key: NoInfer<K>) => NoInfer<K>): this;
|
|
888
|
+
/**
|
|
889
|
+
* `Hash#except` (`vendor/ruby/v3.3.11/hash.c:2683` `rb_hash_except`); the body is
|
|
890
|
+
* {@link except}'s.
|
|
891
|
+
*
|
|
892
|
+
* @noRailsEquivalent PERMANENT
|
|
893
|
+
*/
|
|
894
|
+
except(...keys: K[]): Hash<K, V>;
|
|
895
|
+
/**
|
|
896
|
+
* `Hash#to_a` (`vendor/ruby/v3.3.11/hash.c:3428` `rb_hash_to_a`).
|
|
897
|
+
*
|
|
898
|
+
* @noRailsEquivalent PERMANENT
|
|
899
|
+
*/
|
|
900
|
+
toA(): [K, V][];
|
|
901
|
+
/**
|
|
902
|
+
* `Hash#to_hash` (`vendor/ruby/v3.3.11/hash.c:3497` `rb_hash_to_hash`): the
|
|
903
|
+
* receiver itself.
|
|
904
|
+
*
|
|
905
|
+
* @noRailsEquivalent PERMANENT
|
|
906
|
+
*/
|
|
907
|
+
toHash(): object;
|
|
908
|
+
/**
|
|
909
|
+
* `Hash#assoc` (`vendor/ruby/v3.3.11/hash.c:4193` `rb_hash_assoc`): the stored
|
|
910
|
+
* key and its value for `key`, else `nil`.
|
|
911
|
+
*
|
|
912
|
+
* @noRailsEquivalent PERMANENT
|
|
913
|
+
*/
|
|
914
|
+
assoc(key: K): [K, V] | null;
|
|
915
|
+
/**
|
|
916
|
+
* `Hash#dig` (`vendor/ruby/v3.3.11/hash.c:4627` `rb_hash_dig`): `self[key]`,
|
|
917
|
+
* then `rb_obj_dig` (`vendor/ruby/v3.3.11/object.c:3906`) over the rest, which
|
|
918
|
+
* answers `nil` through a `nil` and sends `dig` to anything else.
|
|
919
|
+
*
|
|
920
|
+
* @noRailsEquivalent PERMANENT
|
|
921
|
+
*/
|
|
922
|
+
dig(key: K, ...rest: unknown[]): unknown;
|
|
923
|
+
/**
|
|
924
|
+
* `Hash#fetch_values` (`vendor/ruby/v3.3.11/hash.c:2745`
|
|
925
|
+
* `rb_hash_fetch_values`): `rb_hash_fetch` for each key.
|
|
926
|
+
*
|
|
927
|
+
* @noRailsEquivalent PERMANENT
|
|
928
|
+
*/
|
|
929
|
+
fetchValues(...argv: K[]): V[];
|
|
930
|
+
/**
|
|
931
|
+
* `Hash#rassoc` (`vendor/ruby/v3.3.11/hash.c:4254` `rb_hash_rassoc`): the
|
|
932
|
+
* first pair whose value is `==` to `obj` (`rassoc_i`), else `nil`.
|
|
933
|
+
*
|
|
934
|
+
* @noRailsEquivalent PERMANENT
|
|
935
|
+
*/
|
|
936
|
+
rassoc(obj: unknown): [K, V] | null;
|
|
937
|
+
/**
|
|
938
|
+
* `Hash#flatten` (`vendor/ruby/v3.3.11/hash.c:4308` `rb_hash_flatten`): the
|
|
939
|
+
* pairs spliced into one Array, then `flatten!(level - 1)` over it, or a
|
|
940
|
+
* recursive `flatten!` for a negative level.
|
|
941
|
+
*
|
|
942
|
+
* @noRailsEquivalent PERMANENT
|
|
943
|
+
*/
|
|
944
|
+
flatten(...argv: [] | [number]): unknown[];
|
|
945
|
+
/**
|
|
946
|
+
* `Hash#compact` (`vendor/ruby/v3.3.11/hash.c:4360` `rb_hash_compact`): a dup
|
|
947
|
+
* with every `nil` value dropped (`delete_if_nil`).
|
|
948
|
+
*
|
|
949
|
+
* @noRailsEquivalent PERMANENT
|
|
950
|
+
*/
|
|
951
|
+
compact(): Hash<K, NonNullable<V>>;
|
|
952
|
+
/**
|
|
953
|
+
* `Hash#compact!` (`vendor/ruby/v3.3.11/hash.c:4385` `rb_hash_compact_bang`).
|
|
954
|
+
*
|
|
955
|
+
* @noRailsEquivalent PERMANENT
|
|
956
|
+
*/
|
|
957
|
+
compactBang(): this | null;
|
|
958
|
+
/**
|
|
959
|
+
* `Hash#deconstruct_keys` (`vendor/ruby/v3.3.11/hash.c:4759`
|
|
960
|
+
* `rb_hash_deconstruct_keys`): the receiver itself.
|
|
961
|
+
*
|
|
962
|
+
* @noRailsEquivalent PERMANENT
|
|
963
|
+
*/
|
|
964
|
+
deconstructKeys(_keys: unknown): this;
|
|
965
|
+
}
|
|
966
|
+
export {};
|
|
967
|
+
//# sourceMappingURL=hash.d.ts.map
|