Skip to content

Commit

Permalink
[Refactor] add SetDataSize
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Feb 6, 2024
1 parent 6daa5ca commit 1cbafc8
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
1 change: 1 addition & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"IteratorStep",
"IteratorValue",
"NormalCompletion",
"SetDataSize",
"ToBoolean",

// GetSetRecord
Expand Down
8 changes: 8 additions & 0 deletions aos/SetDataSize.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
'use strict';

var tools = require('es-set/tools');
var $setSize = tools.size;

module.exports = function SetDataSize(setData) {
return $setSize(setData);
};
7 changes: 4 additions & 3 deletions implementation.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@ var IteratorClose = require('es-abstract/2023/IteratorClose');
var IteratorStep = require('es-abstract/2023/IteratorStep');
var IteratorValue = require('es-abstract/2023/IteratorValue');
var NormalCompletion = require('es-abstract/2023/NormalCompletion');
var SetDataSize = require('./aos/SetDataSize');
var ToBoolean = require('es-abstract/2023/ToBoolean');

var isSet = require('is-set');

var tools = require('es-set/tools');
var $setForEach = tools.forEach;
var $setHas = tools.has;
var setSize = tools.size;
var $setSize = tools.size;

module.exports = function isDisjointFrom(other) {
var O = this; // step 1
Expand All @@ -30,7 +31,7 @@ module.exports = function isDisjointFrom(other) {

var otherRec = GetSetRecord(other); // step 3

var thisSize = setSize(O); // step 4
var thisSize = SetDataSize(O); // step 4

if (thisSize <= otherRec['[[Size]]']) { // step 5
try {
Expand All @@ -43,7 +44,7 @@ module.exports = function isDisjointFrom(other) {
// eslint-disable-next-line no-throw-literal
throw false; // step 5.b.iii.2, kinda
}
thisSize += setSize(O); // step 5.b.iii.4
thisSize += $setSize(O); // step 5.b.iii.4
}
});
} catch (e) {
Expand Down

0 comments on commit 1cbafc8

Please sign in to comment.