@@ -306,6 +306,11 @@ extern "C" {
306306 #[ wasm_bindgen( constructor) ]
307307 pub fn new_with_length ( len : u32 ) -> Array ;
308308
309+ /// Retrieves the element at the index, counting from the end if negative
310+ /// (returns `undefined` if the index is out of range).
311+ #[ wasm_bindgen( method) ]
312+ pub fn at ( this : & Array , index : i32 ) -> JsValue ;
313+
309314 /// Retrieves the element at the index (returns `undefined` if the index is out of range).
310315 #[ wasm_bindgen( method, structural, indexing_getter) ]
311316 pub fn get ( this : & Array , index : u32 ) -> JsValue ;
@@ -1483,6 +1488,17 @@ extern "C" {
14831488 /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error)
14841489 #[ wasm_bindgen( constructor) ]
14851490 pub fn new ( message : & str ) -> Error ;
1491+ #[ wasm_bindgen( constructor) ]
1492+ pub fn new_with_options ( message : & str , options : & Object ) -> Error ;
1493+
1494+ /// The cause property is the underlying cause of the error.
1495+ /// Usually this is used to add context to re-thrown errors.
1496+ ///
1497+ /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error#differentiate_between_similar_errors)
1498+ #[ wasm_bindgen( method, getter, structural) ]
1499+ pub fn cause ( this : & Error ) -> JsValue ;
1500+ #[ wasm_bindgen( method, setter, structural) ]
1501+ pub fn set_cause ( this : & Error , cause : & JsValue ) ;
14861502
14871503 /// The message property is a human-readable description of the error.
14881504 ///
@@ -3125,6 +3141,14 @@ extern "C" {
31253141 #[ wasm_bindgen( method, js_name = hasOwnProperty) ]
31263142 pub fn has_own_property ( this : & Object , property : & JsValue ) -> bool ;
31273143
3144+ /// The `Object.hasOwn()` method returns a boolean indicating whether the
3145+ /// object passed in has the specified property as its own property (as
3146+ /// opposed to inheriting it).
3147+ ///
3148+ /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/hasOwn)
3149+ #[ wasm_bindgen( static_method_of = Object , js_name = hasOwn) ]
3150+ pub fn has_own ( instance : & Object , property : & JsValue ) -> bool ;
3151+
31283152 /// The `Object.is()` method determines whether two values are the same value.
31293153 ///
31303154 /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is)
@@ -4304,6 +4328,14 @@ extern "C" {
43044328 #[ wasm_bindgen( method, getter, structural) ]
43054329 pub fn length ( this : & JsString ) -> u32 ;
43064330
4331+ /// The 'at()' method returns a new string consisting of the single UTF-16
4332+ /// code unit located at the specified offset into the string, counting from
4333+ /// the end if it's negative.
4334+ ///
4335+ /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/at)
4336+ #[ wasm_bindgen( method, js_class = "String" ) ]
4337+ pub fn at ( this : & JsString , index : i32 ) -> Option < JsString > ;
4338+
43074339 /// The String object's `charAt()` method returns a new string consisting of
43084340 /// the single UTF-16 code unit located at the specified offset into the
43094341 /// string.
@@ -4461,6 +4493,12 @@ extern "C" {
44614493 #[ wasm_bindgen( method, js_class = "String" , js_name = match ) ]
44624494 pub fn match_ ( this : & JsString , pattern : & RegExp ) -> Option < Object > ;
44634495
4496+ /// The `match_all()` method is similar to `match()`, but gives an iterator of `exec()` arrays, which preserve capture groups.
4497+ ///
4498+ /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/matchAll)
4499+ #[ wasm_bindgen( method, js_class = "String" , js_name = matchAll) ]
4500+ pub fn match_all ( this : & JsString , pattern : & RegExp ) -> Iterator ;
4501+
44644502 /// The `normalize()` method returns the Unicode Normalization Form
44654503 /// of a given string (if the value isn't a string, it will be converted to one first).
44664504 ///
@@ -4522,6 +4560,36 @@ extern "C" {
45224560 replacement : & Function ,
45234561 ) -> JsString ;
45244562
4563+ /// The `replace_all()` method returns a new string with all matches of a pattern
4564+ /// replaced by a replacement. The pattern can be a string or a global RegExp, and
4565+ /// the replacement can be a string or a function to be called for each match.
4566+ ///
4567+ /// Note: The original string will remain unchanged.
4568+ ///
4569+ /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replaceAll)
4570+ #[ wasm_bindgen( method, js_class = "String" , js_name = replaceAll) ]
4571+ pub fn replace_all ( this : & JsString , pattern : & str , replacement : & str ) -> JsString ;
4572+
4573+ /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replaceAll)
4574+ #[ wasm_bindgen( method, js_class = "String" , js_name = replaceAll) ]
4575+ pub fn replace_all_with_function (
4576+ this : & JsString ,
4577+ pattern : & str ,
4578+ replacement : & Function ,
4579+ ) -> JsString ;
4580+
4581+ #[ wasm_bindgen( method, js_class = "String" , js_name = replaceAll) ]
4582+ pub fn replace_all_by_pattern ( this : & JsString , pattern : & RegExp , replacement : & str )
4583+ -> JsString ;
4584+
4585+ /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replaceAll)
4586+ #[ wasm_bindgen( method, js_class = "String" , js_name = replaceAll) ]
4587+ pub fn replace_all_by_pattern_with_function (
4588+ this : & JsString ,
4589+ pattern : & RegExp ,
4590+ replacement : & Function ,
4591+ ) -> JsString ;
4592+
45254593 /// The `search()` method executes a search for a match between
45264594 /// a regular expression and this String object.
45274595 ///
@@ -5323,6 +5391,23 @@ extern "C" {
53235391 #[ wasm_bindgen( static_method_of = Promise ) ]
53245392 pub fn all ( obj : & JsValue ) -> Promise ;
53255393
5394+ /// The `Promise.allSettled(iterable)` method returns a single `Promise` that
5395+ /// resolves when all of the promises in the iterable argument have either
5396+ /// fulfilled or rejected or when the iterable argument contains no promises.
5397+ ///
5398+ /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/allSettled)
5399+ #[ wasm_bindgen( static_method_of = Promise , js_name = allSettled) ]
5400+ pub fn all_settled ( obj : & JsValue ) -> Promise ;
5401+
5402+ /// The `Promise.any(iterable)` method returns a single `Promise` that
5403+ /// resolves when any of the promises in the iterable argument have resolved
5404+ /// or when the iterable argument contains no promises. It rejects with an
5405+ /// `AggregateError` if all promises in the iterable rejected.
5406+ ///
5407+ /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/any)
5408+ #[ wasm_bindgen( static_method_of = Promise ) ]
5409+ pub fn any ( obj : & JsValue ) -> Promise ;
5410+
53265411 /// The `Promise.race(iterable)` method returns a promise that resolves or
53275412 /// rejects as soon as one of the promises in the iterable resolves or
53285413 /// rejects, with the value or reason from that promise.
@@ -5573,6 +5658,10 @@ macro_rules! arrays {
55735658 #[ wasm_bindgen( method) ]
55745659 pub fn set( this: & $name, src: & JsValue , offset: u32 ) ;
55755660
5661+ /// Gets the value at `idx`, counting from the end if negative.
5662+ #[ wasm_bindgen( method) ]
5663+ pub fn at( this: & $name, idx: i32 ) -> Option <$ty>;
5664+
55765665 /// Gets the value at `idx`, equivalent to the javascript `my_var = arr[idx]`.
55775666 #[ wasm_bindgen( method, structural, indexing_getter) ]
55785667 pub fn get_index( this: & $name, idx: u32 ) -> $ty;
0 commit comments