Skip to content

Commit 85730bb

Browse files
Merge pull request #6 from es-shims/updates
2 parents c3b6231 + 524d34b commit 85730bb

File tree

14 files changed

+120
-28
lines changed

14 files changed

+120
-28
lines changed

.eslintrc

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"root": true,
3+
4+
"extends": "@ljharb",
5+
6+
"rules": {
7+
"id-length": "off",
8+
"new-cap": ["error", {
9+
"capIsNewExceptions": [
10+
"StringCharCodeAt",
11+
"RequireObjectCoercible",
12+
"ToIntegerOrInfinity",
13+
"ToString",
14+
],
15+
}],
16+
"no-magic-numbers": "off",
17+
},
18+
19+
"overrides": [
20+
{
21+
"files": ["tests/**/*"],
22+
"rules": {
23+
"max-lines-per-function": "off",
24+
"max-statements-per-line": "off",
25+
},
26+
},
27+
]
28+
}

.github/workflows/node-aught.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
name: 'Tests: node.js < 10'
2+
3+
on: [pull_request, push]
4+
5+
jobs:
6+
tests:
7+
uses: ljharb/actions/.github/workflows/node.yml@main
8+
with:
9+
range: '< 10'
10+
type: minors
11+
command: npm run tests-only

.github/workflows/node-pretest.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
name: 'Tests: pretest/posttest'
2+
3+
on: [pull_request, push]
4+
5+
jobs:
6+
tests:
7+
uses: ljharb/actions/.github/workflows/pretest.yml@main

.github/workflows/node-tens.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
name: 'Tests: node.js >= 10'
2+
3+
on: [pull_request, push]
4+
5+
jobs:
6+
tests:
7+
uses: ljharb/actions/.github/workflows/node.yml@main
8+
with:
9+
range: '>= 10'
10+
type: minors
11+
command: npm run tests-only

.github/workflows/publish-on-tag.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- name: Checkout
13-
uses: actions/checkout@v2
13+
uses: actions/checkout@v4
1414
- name: Set up Node.js
1515
uses: actions/setup-node@v3
1616
with:

.github/workflows/rebase.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
name: Automatic Rebase
2+
3+
on: [pull_request_target]
4+
5+
jobs:
6+
_:
7+
uses: ljharb/actions/.github/workflows/rebase.yml@main
8+
secrets:
9+
token: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: Require “Allow Edits”
2+
3+
on: [pull_request_target]
4+
5+
jobs:
6+
_:
7+
name: "Require “Allow Edits”"
8+
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- uses: ljharb/require-allow-edits@main

LICENSE-MIT.txt renamed to LICENSE

File renamed without changes.

auto.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
/*! https://mths.be/codepointat v1.0.0 by @mathias */
22

3+
'use strict';
4+
35
require('./shim')();

implementation.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@
22

33
'use strict';
44

5-
var callBound = require('es-abstract/helpers/callBound');
6-
var RequireObjectCoercible = require('es-abstract/2019/RequireObjectCoercible');
7-
var ToString = require('es-abstract/2019/ToString');
8-
var ToInteger = require('es-abstract/2019/ToInteger');
5+
var callBound = require('call-bind/callBound');
6+
var RequireObjectCoercible = require('es-abstract/2024/RequireObjectCoercible');
7+
var ToString = require('es-abstract/2024/ToString');
8+
var ToIntegerOrInfinity = require('es-abstract/2024/ToIntegerOrInfinity');
99
var StringCharCodeAt = callBound('String.prototype.charCodeAt');
1010

1111
module.exports = function codePointAt(position) {
1212
var O = RequireObjectCoercible(this);
1313
var string = ToString(O);
1414
var size = string.length;
15-
var index = ToInteger(position);
15+
var index = ToIntegerOrInfinity(position);
1616
// Account for out-of-bounds indices:
1717
if (index < 0 || index >= size) {
1818
return undefined;
@@ -21,13 +21,13 @@ module.exports = function codePointAt(position) {
2121
var first = StringCharCodeAt(string, index);
2222
var second;
2323
if ( // check if it’s the start of a surrogate pair
24-
first >= 0xD800 && first <= 0xDBFF && // high surrogate
25-
size > index + 1 // there is a next code unit
24+
first >= 0xD800 && first <= 0xDBFF // high surrogate
25+
&& size > index + 1 // there is a next code unit
2626
) {
2727
second = StringCharCodeAt(string, index + 1);
2828
if (second >= 0xDC00 && second <= 0xDFFF) { // low surrogate
2929
// https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
30-
return (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000;
30+
return ((first - 0xD800) * 0x400) + second - 0xDC00 + 0x10000;
3131
}
3232
}
3333
return first;

0 commit comments

Comments
 (0)