Skip to content

Move DataView get / set Uint8Clamped methods proposal to stage 2 #1374

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@
- `Math.clamp`
- Moved to stage 2, [May 2025 TC39 meeting](https://github.com/tc39/proposal-math-clamp/commit/a005f28a6a03e175b9671de1c8c70dd5b7b08c2d)
- Removed a `RangeError` if `min <= max` or `+0` min and `-0` max, [tc39/proposal-math-clamp/#22](https://github.com/tc39/proposal-math-clamp/issues/22)
- [`DataView` get / set `Uint8Clamped` methods proposal](https://github.com/tc39/proposal-dataview-get-set-uint8clamped):
- Methods:
- `DataView.prototype.getUint8Clamped`
- `DataView.prototype.setUint8Clamped`
- Moved to stage 2, October 2024 TC39 meeting
- Always check regular expression flags by `flags` getter [PR](https://github.com/tc39/ecma262/pull/2791). Native methods are not fixed, only own implementation updated for:
- `RegExp.prototype[@@match]`
- `RegExp.prototype[@@replace]`
Expand Down
44 changes: 22 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ structuredClone(new Set([1, 2, 3])); // => new Set([1, 2, 3])
- [`AsyncIterator` helpers](#asynciterator-helpers)
- [`Iterator.range`](#iteratorrange)
- [`Array.isTemplateObject`](#arrayistemplateobject)
- [`DataView` get / set `Uint8Clamped` methods](#dataview-get-set-iint8clamped-methods)
- [`Math.clamp`](#mathclamp)
- [`String.dedent`](#stringdedent)
- [`Symbol` predicates](#symbol-predicates)
Expand All @@ -188,7 +189,6 @@ structuredClone(new Set([1, 2, 3])); // => new Set([1, 2, 3])
- [`compositeKey` and `compositeSymbol`](#compositekey-and-compositesymbol)
- [`Array` filtering](#array-filtering)
- [`Array` deduplication](#array-deduplication)
- [`DataView` get / set `Uint8Clamped` methods](#dataview-get-set-iint8clamped-methods)
- [`Number.fromString`](#numberfromstring)
- [`String.cooked`](#stringcooked)
- [`String.prototype.codePoints`](#stringprototypecodepoints)
Expand Down Expand Up @@ -2978,6 +2978,27 @@ core-js(-pure)/full/array/is-template-object
console.log(Array.isTemplateObject((it => it)`qwe${ 123 }asd`)); // => true
```

##### [`DataView` get / set `Uint8Clamped` methods](https://github.com/tc39/proposal-dataview-get-set-uint8clamped)[⬆](#index)
Modules [`esnext.data-view.get-uint8-clamped`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.data-view.get-uint8-clamped.js) and [`esnext.data-view.set-uint8-clamped`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.data-view.set-uint8-clamped.js)
```ts
class DataView {
getUint8Clamped(offset: any): uint8
setUint8Clamped(offset: any, value: any): void;
}
```
[*CommonJS entry points:*](#commonjs-api)
```
core-js/proposals/data-view-get-set-uint8-clamped
core-js/full/dataview/get-uint8-clamped
core-js/full/dataview/set-uint8-clamped
```
[Examples](https://tinyurl.com/2h4zv8sw):
```js
const view = new DataView(new ArrayBuffer(1));
view.setUint8Clamped(0, 100500);
console.log(view.getUint8Clamped(0)); // => 255
```

##### [`Math.clamp`](https://github.com/tc39/proposal-math-clamp)[⬆](#index)
Module [`esnext.math.clamp`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.math.clamp.js)
```ts
Expand Down Expand Up @@ -3280,27 +3301,6 @@ core-js/full/typed-array/unique-by
].uniqueBy(it => it.uid); // => [{ id: 1, uid: 10000 }, { id: 3, uid: 10001 }]
```

##### [`DataView` get / set `Uint8Clamped` methods](https://github.com/tc39/proposal-dataview-get-set-uint8clamped)[⬆](#index)
Modules [`esnext.data-view.get-uint8-clamped`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.data-view.get-uint8-clamped.js) and [`esnext.data-view.set-uint8-clamped`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.data-view.set-uint8-clamped.js)
```ts
class DataView {
getUint8Clamped(offset: any): uint8
setUint8Clamped(offset: any, value: any): void;
}
```
[*CommonJS entry points:*](#commonjs-api)
```
core-js/proposals/data-view-get-set-uint8-clamped
core-js/full/dataview/get-uint8-clamped
core-js/full/dataview/set-uint8-clamped
```
[Examples](https://tinyurl.com/2h4zv8sw):
```js
const view = new DataView(new ArrayBuffer(1));
view.setUint8Clamped(0, 100500);
console.log(view.getUint8Clamped(0)); // => 255
```

##### [`Number.fromString`](https://github.com/tc39/proposal-number-fromstring)[⬆](#index)
Module [`esnext.number.from-string`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.number.from-string.js)
```ts
Expand Down
1 change: 0 additions & 1 deletion packages/core-js/stage/1.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ require('../proposals/array-last');
require('../proposals/array-unique');
require('../proposals/collection-methods');
require('../proposals/collection-of-from');
require('../proposals/data-view-get-set-uint8-clamped');
require('../proposals/keys-composition');
require('../proposals/math-extensions');
require('../proposals/math-signbit');
Expand Down
1 change: 1 addition & 0 deletions packages/core-js/stage/2.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ var parent = require('./2.7');

require('../proposals/array-is-template-object');
require('../proposals/async-iterator-helpers');
require('../proposals/data-view-get-set-uint8-clamped');
require('../proposals/extractors');
require('../proposals/iterator-range');
require('../proposals/string-dedent');
Expand Down