Skip to content
This repository was archived by the owner on Nov 17, 2020. It is now read-only.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 5786b84

Browse files
committedApr 29, 2015
Convert to Ecmarkup
1 parent 1889fac commit 5786b84

File tree

6 files changed

+88
-36
lines changed

6 files changed

+88
-36
lines changed
 

‎.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
/node_modules/
2+
npm-debug.log
3+
out/

‎.travis.yml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
script: bash ./deploy.sh
2+
env:
3+
global:
4+
- GH_REF: github.com/tc39/Array.prototype.includes.git
5+
- secure: "gVIgu2xOcIx7lxtBr4MY3Ql4DnaV8hbL5/kB0ANAiXp10+5Rx4HyGEFMayYKWOS2CLhKhsWMJ3d2RPJTOewUKYofeGq3OC1UQvyLzdCZCGNNvBwIc4jIaUiHNfF9s3t8BsfyD48PvZZTaWbmijaXlPKX1VZF7jaEWJjWHV920Vo="
6+
language: node_js
7+
node_js:
8+
- iojs

‎deploy.sh

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/bin/bash
2+
set -e # exit with nonzero exit code if anything fails
3+
4+
# clear and re-create the out directory
5+
rm -rf out || exit 0;
6+
mkdir out;
7+
8+
# run our compile script
9+
ecmarkup spec.html out/index.html
10+
11+
# go to the out directory and create a *new* Git repo
12+
cd out
13+
git init
14+
15+
# inside this git repo we'll pretend to be a new user
16+
git config user.name "Travis CI"
17+
git config user.email "d@domenic.me"
18+
19+
# The first and only commit to this new Git repo contains all the
20+
# files present with the commit message "Deploy to GitHub Pages".
21+
git add .
22+
git commit -m "Deploy to GitHub Pages"
23+
24+
# Force push from the current repo's master branch to the remote
25+
# repo's gh-pages branch. (All previous history on the gh-pages branch
26+
# will be lost, since we are overwriting it.) We redirect any output to
27+
# /dev/null to hide any sensitive credential data that might otherwise be exposed.
28+
git push --force --quiet "https://${GH_TOKEN}@${GH_REF}" master:gh-pages > /dev/null 2>&1

‎package.json

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"author": "Domenic Denicola <d@domenic.me> (https://domenic.me/)",
1818
"license": "BSD-2-Clause",
1919
"devDependencies": {
20+
"ecmarkup": "domenic/ecmarkup#jsdom-update",
2021
"test262-harness": "domenic/test262-harness#assert-throws"
2122
},
2223
"dependencies": {

‎spec.html

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<!DOCTYPE html>
2+
<meta charset="utf-8">
3+
<title>Array.prototype.includes</title>
4+
<link rel="stylesheet" href="https://bterlson.github.io/ecmarkup/elements.css">
5+
6+
<emu-clause id="array-prototype-includes">
7+
<h1>Array.prototype.includes ( searchElement [ , fromIndex ] )</h1>
8+
9+
<emu-note>
10+
`includes` compares _searchElement_ to the elements of the array, in ascending order, using the SameValueZero algorithm, and if found at any position, returns *true*; otherwise, *false* is returned.
11+
</emu-note>
12+
13+
<p>The optional second argument _fromIndex_ defaults to 0 (i.e. the whole array is searched). If it is greater than or equal to the length of the array, *false* is returned, i.e. the array will not be searched. If it is negative, it is used as the offset from the end of the array to compute _fromIndex_. If the computed index is less than 0, the whole array will be searched.</p>
14+
15+
<p>When the `includes` method is called, the following steps are taken:</p>
16+
17+
<emu-alg>
18+
1. Let _O_ be the result of calling ToObject passing the *this* value as the argument.
19+
1. ReturnIfAbrupt(_O_).
20+
1. Let _len_ be ToLength(Get(_O_, "length")).
21+
1. ReturnIfAbrupt(_len_).
22+
1. If _len_ is 0, return *false*.
23+
1. Let _n_ be ToInteger(_fromIndex_). (If _fromIndex_ is *undefined*, this step produces the value 0.)
24+
1. ReturnIfAbrupt(_n_).
25+
1. If _n_ ≥ 0, then
26+
1. Let _k_ be _n_.
27+
1. Else _n_ < 0,
28+
1. Let _k_ be _len_ + _n_.
29+
1. If _k_ < 0, then let _k_ be 0.
30+
1. Repeat, while _k_ _len_
31+
1. Let _elementK_ be the result of Get(_O_, ToString(_k_)).
32+
1. ReturnIfAbrupt(_elementK_).
33+
1. If SameValueZero(_searchElement_, _elementK_) is *true*, return *true*.
34+
1. Increase _k_ by 1.
35+
1. Return *false*.
36+
</emu-alg>
37+
38+
<p>The `length` property of the `includes` method is *1*.</p>
39+
</emu-clause>
40+
41+
<emu-clause id="typedarray-prototype-includes">
42+
<h1>%TypedArray%.prototype.includes ( searchElement [ , fromIndex ] )</h1>
43+
44+
<p>`%TypedArray%.prototype.includes` is a distinct function that implements the same algorithm as `Array.prototype.includes` except that the *this* object’s [[ArrayLength]] internal slot is accessed in place of performing a [[Get]] of <code>"length"</code>. The implementation of the algorithm may be optimized with the knowledge that the *this* value is an object that has a fixed length and whose integer indexed properties are not sparse. However, such optimization must not introduce any observable changes in the specified behaviour of the algorithm.</p>
45+
46+
<p>This function is not generic. If the *this* value is not a object with a [[TypedArrayName]] internal slot, a *TypeError* exception is immediately thrown when this function is called.</p>
47+
48+
<p>The `length` property of the `includes` method is *1*.</p>
49+
</emu-clause>

‎spec.md

-36
This file was deleted.

0 commit comments

Comments
 (0)
This repository has been archived.