Some checks failed
CI / go (push) Waiting to run
CI / docker (push) Waiting to run
CI / lint-go (push) Waiting to run
CI / lint-docs (push) Waiting to run
CI / check-paperclip (push) Waiting to run
Deploy static site / Deploy to GitHub Pages (push) Has been cancelled
Deploy static site / Deploy via Docker to hatch.surf (push) Has been cancelled
Resolved conflicts by taking GitHub versions for: - .dockerignore, .gitignore, Dockerfile, README.md, docker-compose.yml Kept deploy.sh updated to: - Pull from GitHub (primary source) - Push to Gitea (push-mirror) - Build from site/ directory (GitHub structure) Co-Authored-By: Paperclip <noreply@paperclip.ing>
33 lines
1.0 KiB
JavaScript
33 lines
1.0 KiB
JavaScript
'use strict';
|
|
|
|
var $TypeError = require('es-errors/type');
|
|
|
|
var GetIteratorFlattenable = require('es-abstract/2025/GetIteratorFlattenable');
|
|
var OrdinaryHasInstance = require('es-abstract/2025/OrdinaryHasInstance');
|
|
var OrdinaryObjectCreate = require('es-abstract/2025/OrdinaryObjectCreate');
|
|
|
|
var $Iterator = require('../Iterator/polyfill')();
|
|
var $WrapForValidIteratorPrototype = require('../WrapForValidIteratorPrototype');
|
|
|
|
var SLOT = require('internal-slot');
|
|
|
|
module.exports = function from(O) {
|
|
if (this instanceof from) {
|
|
throw new $TypeError('`Iterator.from` is not a constructor');
|
|
}
|
|
|
|
var iteratorRecord = GetIteratorFlattenable(O, 'ITERATE-STRING-PRIMITIVES'); // step 1
|
|
|
|
var hasInstance = OrdinaryHasInstance($Iterator, iteratorRecord['[[Iterator]]']); // step 2
|
|
|
|
if (hasInstance) { // step 3
|
|
return iteratorRecord['[[Iterator]]']; // step 3.a
|
|
}
|
|
|
|
var wrapper = OrdinaryObjectCreate($WrapForValidIteratorPrototype); // , ['[[Iterated]]']); // step 4
|
|
|
|
SLOT.set(wrapper, '[[Iterated]]', iteratorRecord); // step 5
|
|
|
|
return wrapper; // step 6
|
|
};
|