김용재

날씨 api적용 최종본

Showing 1000 changed files with 4451 additions and 16 deletions

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.

1 +<h1 style="width: 100%; text-align: center; font-size: 40px;">오늘은 얼마나 먹었어요?</h1>
2 +<form action="/logout" method="get">
3 + <input id ="logout" type="submit" value="Logout" class="btn btn-default" style=" width:100px;font-weight: bold; font-size: 18px; background-color: white;">
4 + </form>
5 + <br><br><br>
6 +
7 + <div id = "input-ing" style="width:100%; text-align: center;">
8 + <form action="/foods" method="post">
9 + <div class="form-inline">
10 +
11 + <p style="text-decoration-line: underline; font-weight:bold;">오늘 먹은 것들을 적어주세요!</p>
12 +
13 + <input type="text" name="name" style="width:30%; height:130px;" placeholder="ex) coffee and croissant">
14 + <br><br><br><br>
15 +
16 + <input id="go" type="submit" value="Go!" style=" width:100px; height:80px; font-weight: bold; color:white; font-size: 25px; background-color: rgb(104, 211, 104); border-radius: 2em;">
17 +
18 +
19 + </div>
20 + </form>
21 + </div>
1 +<h1 style="width: 100%; text-align: center; font-size: 40px;">오늘은 얼마나 먹었어요?</h1>
2 +<form action="/logout" method="get">
3 +<input id ="logout" type="submit" value="Logout" class="btn btn-default" style=" width:100px;font-weight: bold; font-size: 18px; background-color: white;">
4 +</form>
5 +<br><br><br>
6 +
7 +
1 +<h1 style="width: 100%; text-align: center; font-size: 50px;">오늘은 얼마나 먹었어요?</h1>
2 +
3 +
4 + <br><br><br>
5 +
6 + <div id = "login-ing" style="width:100%; text-align: center; margin-top: 5ch">
7 + <div class="form-inline">
8 + <form action="/login_process" method="post">
9 + <label>ID</label>
10 + <input type="text" name="ID" class="form-control" placeholder="홍길동" style="width:200px;">
11 + &nbsp &nbsp&nbsp&nbsp
12 +
13 + <label>Password</label>
14 + <input type="password" name="pwd" class="form-control" placeholder="*******" style="width:200px;">
15 + <br><br><br>
16 + <input type="submit" value="login" style=" width:100px;font-weight: bold; font-size: 18px; background-color: white;">
17 + </form>
18 + <br><br>
19 + <form action="/signup" method="get">
20 + <input type="submit" value="Sign Up" class="btn btn-default" style=" width:100px;font-weight: bold; font-size: 18px; background-color: white;">
21 + </form>
22 + </div>
23 +
24 + </div>
...\ No newline at end of file ...\ No newline at end of file
1 +<h1 style="width: 100%; text-align: center; font-size: 40px;">오늘은 얼마나 먹었어요?</h1>
2 +
3 +
4 + <br><br><br>
5 +
6 + <div id = "signup-ing" style="width:100%; text-align: center;">
7 + <form action="/signup_process" method="post">
8 + <div class="form-inline">
9 + <div class="input-area">
10 + <span class="input-label">
11 + <label name="ID">ID</label>
12 + </span>
13 + <span class="input-box">
14 + <input type="text" name="ID" >
15 + </span>
16 + </div>
17 +
18 + <div class="input-area">
19 + <span class="input-label">
20 + <label name="pwd">Password</label>
21 + </span>
22 + <span class="input-box">
23 + <input type="text" name="pwd" >
24 + </span>
25 + </div>
26 +
27 + <div class="input-area">
28 + <span class="input-label">
29 + <label name="age">나이(세)</label>
30 + </span>
31 + <span class="input-box">
32 + <input type="text" name="age" >
33 + </span>
34 + </div>
35 +
36 + <div class="input-area">
37 + <span class="input-label">
38 + <label name="gender">성별</label>
39 + </span>
40 + <select name="gender" style="width: 200px; ">
41 + <optgroup label="성별 선택">
42 + <option value="male">남자</option>
43 + <option value="female">여자</option>
44 + </optgroup>
45 +
46 + </select>
47 + </div>
48 +
49 + <div class="input-area">
50 + <span class="input-label">
51 + <label name="height">키(cm)</label>
52 + </span>
53 + <span class="input-box">
54 + <input type="text" name="height" >
55 + </span>
56 +
57 + </div>
58 +
59 + <div class="input-area">
60 + <span class="input-label">
61 + <label name="weight">체중(kg)</label>
62 + </span>
63 + <span class="input-box">
64 + <input type="text" name="weight" >
65 + </span>
66 + </div>
67 +
68 + <br><br><br>
69 +
70 + <input type="submit" value="Sign Up" class="btn btn-default" style=" width:100px;font-weight: bold; font-size: 18px; background-color: white;">
71 + </div>
72 + </form>
73 + </div>
...\ No newline at end of file ...\ No newline at end of file
1 +{
2 + "users": [
3 + {
4 + "ID": "1",
5 + "password": "1",
6 + "age": "1",
7 + "gender": "male",
8 + "height": "1",
9 + "weight": "1"
10 + }
11 + ]
12 +}
...\ No newline at end of file ...\ No newline at end of file
1 +module.exports = {
2 + L:function(co1,co2,co3){
3 + return `
4 + <div id="section">
5 + <div id="container1">${co1}</div>
6 + <br><br><br>
7 +
8 + <div id="container2">${co2}</div>
9 + </div>
10 +
11 + <div id="container3">${co3}</div>
12 + `;
13 + }
14 + }
1 module.exports = { 1 module.exports = {
2 - HTML:function(title,ch,line, body){ 2 + HTML:function(title,ch,line, body,logout,con){
3 return ` 3 return `
4 <!DOCTYPE html> 4 <!DOCTYPE html>
5 <html lang="en"> 5 <html lang="en">
...@@ -10,8 +10,8 @@ module.exports = { ...@@ -10,8 +10,8 @@ module.exports = {
10 <title>${title}</title> 10 <title>${title}</title>
11 <script src="jquery.js"></script> 11 <script src="jquery.js"></script>
12 <script> 12 <script>
13 - 13 +
14 - 14 +
15 </script> 15 </script>
16 <style > 16 <style >
17 17
...@@ -22,7 +22,7 @@ module.exports = { ...@@ -22,7 +22,7 @@ module.exports = {
22 margin-top: ${ch}; 22 margin-top: ${ch};
23 color: white; 23 color: white;
24 } 24 }
25 - 25 +
26 #footer { 26 #footer {
27 position: absolute; 27 position: absolute;
28 bottom: 0; 28 bottom: 0;
...@@ -31,14 +31,16 @@ module.exports = { ...@@ -31,14 +31,16 @@ module.exports = {
31 text-align: center; 31 text-align: center;
32 color: white; 32 color: white;
33 } 33 }
34 - 34 + ${logout}
35 +
35 </style> 36 </style>
36 ${line} 37 ${line}
37 </head> 38 </head>
38 <body> 39 <body>
39 - <img src = "images/main_background.jpg" alt="" style="z-index:-1; min-width: 100%; height: 700px;"></img> 40 + <img src = "main_background.jpg" alt="" style="z-index:-1; min-width: 100%; height: 700px;"></img>
40 - <div id="banner"> 41 + <div id="banner">
41 ${body} 42 ${body}
43 + ${con}
42 </div> 44 </div>
43 45
44 <div id="footer">오픈소스SW Project 2019-1 고다경 김용재 김태희</div> 46 <div id="footer">오픈소스SW Project 2019-1 고다경 김용재 김태희</div>
...@@ -47,4 +49,3 @@ module.exports = { ...@@ -47,4 +49,3 @@ module.exports = {
47 `; 49 `;
48 } 50 }
49 } 51 }
50 -
...\ No newline at end of file ...\ No newline at end of file
......
1 var express = require('express') 1 var express = require('express')
2 var app = express() 2 var app = express()
3 var fs = require('fs'); 3 var fs = require('fs');
4 -// var path = require('path'); 4 +var bodyParser = require('body-parser');
5 -// var qs = require('querystring'); 5 +var helmet = require('helmet')
6 -// var sanitizeHtml = require('sanitize-html'); 6 +app.use(helmet());
7 +var session = require('express-session');
8 +var FileStore= require('session-file-store')(session);
9 +
10 +
11 +
7 var template = require('./lib/template.js'); 12 var template = require('./lib/template.js');
13 +var container = require('./lib/container.js');
14 +
15 +var axios = require('axios');
16 +var request = require("request");
17 +
18 +var low =require('lowdb')
19 +var FileSync = require('lowdb/adapters/FileSync');
20 +var adapter = new FileSync('db.json');
21 +var db=low(adapter);
22 +db.defaults({users:[]}).write();
23 +
24 +
25 +app.use(bodyParser.urlencoded({ extended: false }));
26 +app.use(bodyParser.json());
27 +app.use(session({
28 + secret: 'asadlfkj!@#!@#dfgasdg',
29 + resave: false,
30 + saveUninitialized: true,
31 + store: new FileStore()
32 +}))
33 +
34 +var app_id = "a59b8963";
35 +
36 +
37 +var api_key = "1c4c66e13fa8bf8d4d5c5a6c8ba1cf5b";
38 +
39 +var foodkind;
40 +
41 +var ingr;
8 42
9 -app.use(express.static('data')); 43 +var sID;
44 +
45 +app.use(function(req, res, next) {
46 + res.header("Access-Control-Allow-Origin", "*");
47 + res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
48 + next();
49 +});
50 +
51 +const OpenWeatherMapHelper = require("openweathermap-node");
52 +const helper = new OpenWeatherMapHelper({
53 +
54 + APPID: 'afea3779ccf698668f89764635ac580f',
55 + units:"imperial"
56 +})
57 +
58 +
59 +
60 +
61 +app.use(express.static('data/images'));
10 app.get('/', function(request, response) { 62 app.get('/', function(request, response) {
11 - fs.readFile('./contents/main', function(error, body){ 63 +
64 + fs.readFile('./contents/main.html', function(error, body){
12 var title = 'Health Care'; 65 var title = 'Health Care';
13 var ch='15ch' 66 var ch='15ch'
14 - var html = template.HTML(title,ch,'',body); 67 + var html = template.HTML(title,ch,'',body,'','');
15 response.send(html); 68 response.send(html);
16 }); 69 });
17 }); 70 });
18 71
72 + app.post('/login_process', function(request, response) {
73 + var post = request.body;
74 + var ID=post.ID;
75 + var password=post.pwd;
76 + var user = db.get('users').find({ID:ID,password:password}).value();
77 + if(user){
78 + request.session.is_logined = true;
79 + request.session.ID=ID;
80 + sID=ID;
81 + request.session.save(function(){
82 + response.redirect('/InputPage')
83 + });
84 + }
85 + });
86 +
19 app.get('/signup', function(request, response) { 87 app.get('/signup', function(request, response) {
20 - fs.readFile('./contents/signup', function(error, body){ 88 + fs.readFile('./contents/signup.html', function(error, body){
21 var title = 'Sign Up Page'; 89 var title = 'Sign Up Page';
22 var ch='5ch' 90 var ch='5ch'
23 - var html = template.HTML(title,ch,`<link rel="stylesheet" type="text/css" href="./a.css" />`,body); 91 + var html = template.HTML(title,ch,'<link rel="stylesheet" type="text/css" href="./a.css" />',body,'','');
24 response.send(html); 92 response.send(html);
25 }); 93 });
26 }); 94 });
27 95
96 +
97 + app.post('/signup_process', function(request, response) {
98 + var post = request.body;
99 + var ID=post.ID;
100 + var pwd=post.pwd;
101 + var age=post.age;
102 + var gender=post.gender;
103 + var height=post.height;
104 + var weight=post.weight;
105 + db.get('users').push({
106 + ID:ID,
107 + password:pwd,
108 + age:age,
109 + gender:gender,
110 + height:height,
111 + weight:weight
112 + }).write();
113 + request.session.is_logined = true;
114 + request.session.ID = ID;
115 + request.session.save(function(){
116 + response.redirect('/InputPage')
117 + });
118 +
119 + });
120 +
121 +
122 + app.get('/InputPage', function(request, response){
123 + fs.readFile('./contents/Input.html', function(error, body){
124 + var title = 'Input Page';
125 + var ch='5ch'
126 + var html = template.HTML(title,ch,``,body,`#logout{
127 + position:absolute;
128 + right: 20ch;
129 + }`,'');
130 + response.send(html);
131 + });
132 + });
133 +
134 + app.post('/foods', function(request, response){
135 + foodkind=request.body;
136 + ingr=foodkind.name;
137 + response.redirect('/ingr');
138 + });
139 +
140 + app.get('/ingr',function(req, res){
141 + var city;
142 + var temper;
143 + var weather;
144 + var detweather;
145 + var wind;
146 + var cloud;
147 +
148 +helper.getCurrentWeatherByCityName("Seoul", (err, currentWeather) => {
149 + if(err){
150 + console.log(err);
151 + }
152 + else{
153 + console.log(currentWeather);
154 + }
155 + city=currentWeather.name;
156 + temper=currentWeather.main.temp;
157 + weather=currentWeather.weather[0].main;
158 + detweather=currentWeather.weather[0].description;
159 + wind=currentWeather.wind.speed;
160 + cloud=currentWeather.clouds.all;
161 +
162 +
163 +});
164 + request(
165 + { method: 'GET'
166 + , uri: 'https://api.edamam.com/api/nutrition-data?app_id=' + app_id + '&app_key=' + api_key + '&ingr=' + ingr
167 + , gzip: true
168 + }
169 + , function (error, response, result) {
170 + fs.readFile('./contents/Result.html', function(error, body){
171 + var title = 'Result Page';
172 + var ch='5ch'
173 + var jresult=JSON.parse(result);
174 + var cal = jresult.calories;
175 + var user = db.get('users').find({ID:sID}).value();
176 + var bmi = user.weight/(user.height*user.height/100/100);
177 + var ccc = container.L(`<h2>칼로리 : ${cal}kcal`,`<p style="margin-left: 10%">"Weather NOW"</p>
178 + <p id="w1" style="margin-left: 10%">도시 = ${city}</p>
179 + <p id="w3" style="margin-left: 10%">현재온도 = ${temper}(+" ℃")</p>
180 + <span id="w2" style="margin-left: 10%">현재날씨 = ${weather}</span>
181 + <span id="w4" style="margin-left: 10%">날씨상세 = ${detweather}</span>
182 + <br><br>
183 + <span id="w5" style="margin-left: 10%">바람 = ${wind}(+"m/s")</span>
184 + <span id="w6" style="margin-left: 10%">구름 = ${cloud} (+"%")</span>`,`<h2>bmi: ${bmi}</h2>`)
185 + var html = template.HTML(title,ch,``,body,`#logout{
186 + position:absolute;
187 + right: 20ch;
188 + }
189 +
190 + #section{
191 + position: absolute;
192 + margin-left:5%;
193 + float:left;
194 + width: 40%;
195 + height: 90%;
196 + }
197 +
198 + #container1{
199 + float: left;
200 + border: 1px solid white;
201 + width: 100%;
202 + height: 90%;
203 + }
204 + #container2{
205 + float: left;
206 + border: 1px solid white;
207 + background-color: rgb(102, 219, 180);
208 + width: 100%;
209 + height: 120%;
210 + }
211 + #container3{
212 + float: right;
213 + border: 1px solid white;
214 + margin-right:5%;
215 + width: 40%;
216 + height: 90%;
217 + }`,ccc);
218 + res.send(html);
219 +
220 +
221 + });
222 + });
223 +});
224 +
225 +
226 +
227 +
228 + app.get('/logout', function(request, response) {
229 + request.session.destroy(function(err){
230 + response.redirect('/');
231 + })
232 + });
233 +
28 app.listen(3000, function() { 234 app.listen(3000, function() {
29 console.log('Example app listening on port 3000!') 235 console.log('Example app listening on port 3000!')
30 }); 236 });
......
1 +#!/bin/sh
2 +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
3 +
4 +case `uname` in
5 + *CYGWIN*) basedir=`cygpath -w "$basedir"`;;
6 +esac
7 +
8 +if [ -x "$basedir/node" ]; then
9 + "$basedir/node" "$basedir/../acorn/bin/acorn" "$@"
10 + ret=$?
11 +else
12 + node "$basedir/../acorn/bin/acorn" "$@"
13 + ret=$?
14 +fi
15 +exit $ret
1 +@IF EXIST "%~dp0\node.exe" (
2 + "%~dp0\node.exe" "%~dp0\..\acorn\bin\acorn" %*
3 +) ELSE (
4 + @SETLOCAL
5 + @SET PATHEXT=%PATHEXT:;.JS;=;%
6 + node "%~dp0\..\acorn\bin\acorn" %*
7 +)
...\ No newline at end of file ...\ No newline at end of file
1 +#!/bin/sh
2 +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
3 +
4 +case `uname` in
5 + *CYGWIN*) basedir=`cygpath -w "$basedir"`;;
6 +esac
7 +
8 +if [ -x "$basedir/node" ]; then
9 + "$basedir/node" "$basedir/../escodegen/bin/escodegen.js" "$@"
10 + ret=$?
11 +else
12 + node "$basedir/../escodegen/bin/escodegen.js" "$@"
13 + ret=$?
14 +fi
15 +exit $ret
1 +@IF EXIST "%~dp0\node.exe" (
2 + "%~dp0\node.exe" "%~dp0\..\escodegen\bin\escodegen.js" %*
3 +) ELSE (
4 + @SETLOCAL
5 + @SET PATHEXT=%PATHEXT:;.JS;=;%
6 + node "%~dp0\..\escodegen\bin\escodegen.js" %*
7 +)
...\ No newline at end of file ...\ No newline at end of file
1 +#!/bin/sh
2 +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
3 +
4 +case `uname` in
5 + *CYGWIN*) basedir=`cygpath -w "$basedir"`;;
6 +esac
7 +
8 +if [ -x "$basedir/node" ]; then
9 + "$basedir/node" "$basedir/../escodegen/bin/esgenerate.js" "$@"
10 + ret=$?
11 +else
12 + node "$basedir/../escodegen/bin/esgenerate.js" "$@"
13 + ret=$?
14 +fi
15 +exit $ret
1 +@IF EXIST "%~dp0\node.exe" (
2 + "%~dp0\node.exe" "%~dp0\..\escodegen\bin\esgenerate.js" %*
3 +) ELSE (
4 + @SETLOCAL
5 + @SET PATHEXT=%PATHEXT:;.JS;=;%
6 + node "%~dp0\..\escodegen\bin\esgenerate.js" %*
7 +)
...\ No newline at end of file ...\ No newline at end of file
1 +#!/bin/sh
2 +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
3 +
4 +case `uname` in
5 + *CYGWIN*) basedir=`cygpath -w "$basedir"`;;
6 +esac
7 +
8 +if [ -x "$basedir/node" ]; then
9 + "$basedir/node" "$basedir/../esprima/bin/esparse.js" "$@"
10 + ret=$?
11 +else
12 + node "$basedir/../esprima/bin/esparse.js" "$@"
13 + ret=$?
14 +fi
15 +exit $ret
1 +@IF EXIST "%~dp0\node.exe" (
2 + "%~dp0\node.exe" "%~dp0\..\esprima\bin\esparse.js" %*
3 +) ELSE (
4 + @SETLOCAL
5 + @SET PATHEXT=%PATHEXT:;.JS;=;%
6 + node "%~dp0\..\esprima\bin\esparse.js" %*
7 +)
...\ No newline at end of file ...\ No newline at end of file
1 +#!/bin/sh
2 +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
3 +
4 +case `uname` in
5 + *CYGWIN*) basedir=`cygpath -w "$basedir"`;;
6 +esac
7 +
8 +if [ -x "$basedir/node" ]; then
9 + "$basedir/node" "$basedir/../esprima/bin/esvalidate.js" "$@"
10 + ret=$?
11 +else
12 + node "$basedir/../esprima/bin/esvalidate.js" "$@"
13 + ret=$?
14 +fi
15 +exit $ret
1 +@IF EXIST "%~dp0\node.exe" (
2 + "%~dp0\node.exe" "%~dp0\..\esprima\bin\esvalidate.js" %*
3 +) ELSE (
4 + @SETLOCAL
5 + @SET PATHEXT=%PATHEXT:;.JS;=;%
6 + node "%~dp0\..\esprima\bin\esvalidate.js" %*
7 +)
...\ No newline at end of file ...\ No newline at end of file
1 +#!/bin/sh
2 +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
3 +
4 +case `uname` in
5 + *CYGWIN*) basedir=`cygpath -w "$basedir"`;;
6 +esac
7 +
8 +if [ -x "$basedir/node" ]; then
9 + "$basedir/node" "$basedir/../mime/cli.js" "$@"
10 + ret=$?
11 +else
12 + node "$basedir/../mime/cli.js" "$@"
13 + ret=$?
14 +fi
15 +exit $ret
1 +@IF EXIST "%~dp0\node.exe" (
2 + "%~dp0\node.exe" "%~dp0\..\mime\cli.js" %*
3 +) ELSE (
4 + @SETLOCAL
5 + @SET PATHEXT=%PATHEXT:;.JS;=;%
6 + node "%~dp0\..\mime\cli.js" %*
7 +)
...\ No newline at end of file ...\ No newline at end of file
1 +#!/bin/sh
2 +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
3 +
4 +case `uname` in
5 + *CYGWIN*) basedir=`cygpath -w "$basedir"`;;
6 +esac
7 +
8 +if [ -x "$basedir/node" ]; then
9 + "$basedir/node" "$basedir/../sshpk/bin/sshpk-conv" "$@"
10 + ret=$?
11 +else
12 + node "$basedir/../sshpk/bin/sshpk-conv" "$@"
13 + ret=$?
14 +fi
15 +exit $ret
1 +@IF EXIST "%~dp0\node.exe" (
2 + "%~dp0\node.exe" "%~dp0\..\sshpk\bin\sshpk-conv" %*
3 +) ELSE (
4 + @SETLOCAL
5 + @SET PATHEXT=%PATHEXT:;.JS;=;%
6 + node "%~dp0\..\sshpk\bin\sshpk-conv" %*
7 +)
...\ No newline at end of file ...\ No newline at end of file
1 +#!/bin/sh
2 +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
3 +
4 +case `uname` in
5 + *CYGWIN*) basedir=`cygpath -w "$basedir"`;;
6 +esac
7 +
8 +if [ -x "$basedir/node" ]; then
9 + "$basedir/node" "$basedir/../sshpk/bin/sshpk-sign" "$@"
10 + ret=$?
11 +else
12 + node "$basedir/../sshpk/bin/sshpk-sign" "$@"
13 + ret=$?
14 +fi
15 +exit $ret
1 +@IF EXIST "%~dp0\node.exe" (
2 + "%~dp0\node.exe" "%~dp0\..\sshpk\bin\sshpk-sign" %*
3 +) ELSE (
4 + @SETLOCAL
5 + @SET PATHEXT=%PATHEXT:;.JS;=;%
6 + node "%~dp0\..\sshpk\bin\sshpk-sign" %*
7 +)
...\ No newline at end of file ...\ No newline at end of file
1 +#!/bin/sh
2 +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
3 +
4 +case `uname` in
5 + *CYGWIN*) basedir=`cygpath -w "$basedir"`;;
6 +esac
7 +
8 +if [ -x "$basedir/node" ]; then
9 + "$basedir/node" "$basedir/../sshpk/bin/sshpk-verify" "$@"
10 + ret=$?
11 +else
12 + node "$basedir/../sshpk/bin/sshpk-verify" "$@"
13 + ret=$?
14 +fi
15 +exit $ret
1 +@IF EXIST "%~dp0\node.exe" (
2 + "%~dp0\node.exe" "%~dp0\..\sshpk\bin\sshpk-verify" %*
3 +) ELSE (
4 + @SETLOCAL
5 + @SET PATHEXT=%PATHEXT:;.JS;=;%
6 + node "%~dp0\..\sshpk\bin\sshpk-verify" %*
7 +)
...\ No newline at end of file ...\ No newline at end of file
1 +#!/bin/sh
2 +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
3 +
4 +case `uname` in
5 + *CYGWIN*) basedir=`cygpath -w "$basedir"`;;
6 +esac
7 +
8 +if [ -x "$basedir/node" ]; then
9 + "$basedir/node" "$basedir/../uuid/bin/uuid" "$@"
10 + ret=$?
11 +else
12 + node "$basedir/../uuid/bin/uuid" "$@"
13 + ret=$?
14 +fi
15 +exit $ret
1 +@IF EXIST "%~dp0\node.exe" (
2 + "%~dp0\node.exe" "%~dp0\..\uuid\bin\uuid" %*
3 +) ELSE (
4 + @SETLOCAL
5 + @SET PATHEXT=%PATHEXT:;.JS;=;%
6 + node "%~dp0\..\uuid\bin\uuid" %*
7 +)
...\ No newline at end of file ...\ No newline at end of file
1 +## 2.0.0
2 +
3 +Modernization updates thanks to @TimothyGu:
4 +
5 +- Use jsdom's eslint config, remove jscs
6 +- Move syntax to ES6
7 +- Remove Babel
8 +- Via: https://github.com/jsdom/abab/pull/26
9 +
10 +## 1.0.4
11 +
12 +- Added license file
13 +
14 +## 1.0.3
15 +
16 +- Replaced `let` with `var` in `lib/btoa.js`
17 + - Follow up from `1.0.2`
18 + - Resolves https://github.com/jsdom/abab/issues/18
19 +
20 +## 1.0.2
21 +
22 +- Replaced `const` with `var` in `index.js`
23 + - Allows use of `abab` in the browser without a transpilation step
24 + - Resolves https://github.com/jsdom/abab/issues/15
1 +Both the original source code and new contributions in this repository are released under the [W3C 3-clause BSD license](https://github.com/w3c/web-platform-tests/blob/master/LICENSE.md#w3c-3-clause-bsd-license).
2 +
3 +# W3C 3-clause BSD License
4 +
5 +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6 +
7 +* Redistributions of works must retain the original copyright notice, this list of conditions and the following disclaimer.
8 +* Redistributions in binary form must reproduce the original copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9 +* Neither the name of the W3C nor the names of its contributors may be used to endorse or promote products derived from this work without specific prior written permission.
10 +
11 +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1 +# abab [![npm version](https://badge.fury.io/js/abab.svg)](https://www.npmjs.com/package/abab) [![Build Status](https://travis-ci.org/jsdom/abab.svg?branch=master)](https://travis-ci.org/jsdom/abab)
2 +
3 +A JavaScript module that implements `window.atob` and `window.btoa` according the forgiving-base64 algorithm in the [Infra Standard](https://infra.spec.whatwg.org/#forgiving-base64). The original code was forked from [w3c/web-platform-tests](https://github.com/w3c/web-platform-tests/blob/master/html/webappapis/atob/base64.html).
4 +
5 +Compatibility: Node.js version 3+ and all major browsers.
6 +
7 +Install with `npm`:
8 +
9 +```sh
10 +npm install abab
11 +```
12 +
13 +## API
14 +
15 +### `btoa` (base64 encode)
16 +
17 +```js
18 +const { btoa } = require('abab');
19 +btoa('Hello, world!'); // 'SGVsbG8sIHdvcmxkIQ=='
20 +```
21 +
22 +### `atob` (base64 decode)
23 +
24 +```js
25 +const { atob } = require('abab');
26 +atob('SGVsbG8sIHdvcmxkIQ=='); // 'Hello, world!'
27 +```
28 +
29 +#### Valid characters
30 +
31 +[Per the spec](https://html.spec.whatwg.org/multipage/webappapis.html#atob:dom-windowbase64-btoa-3), `btoa` will accept strings "containing only characters in the range `U+0000` to `U+00FF`." If passed a string with characters above `U+00FF`, `btoa` will return `null`. If `atob` is passed a string that is not base64-valid, it will also return `null`. In both cases when `null` is returned, the spec calls for throwing a `DOMException` of type `InvalidCharacterError`.
32 +
33 +## Browsers
34 +
35 +If you want to include just one of the methods to save bytes in your client-side code, you can `require` the desired module directly.
36 +
37 +```js
38 +const atob = require('abab/lib/atob');
39 +const btoa = require('abab/lib/btoa');
40 +```
41 +
42 +-----
43 +
44 +### Checklists
45 +
46 +If you're **submitting a PR** or **deploying to npm**, please use the [checklists in CONTRIBUTING.md](https://github.com/jsdom/abab/blob/master/CONTRIBUTING.md#checklists)
47 +
48 +### Remembering `atob` vs. `btoa`
49 +
50 +Here's a mnemonic that might be useful: if you have a plain string and want to base64 encode it, then decode it, `btoa` is what you run before (**b**efore - **b**toa), and `atob` is what you run after (**a**fter - **a**tob).
1 +"use strict";
2 +
3 +const atob = require("./lib/atob");
4 +const btoa = require("./lib/btoa");
5 +
6 +module.exports = {
7 + atob,
8 + btoa
9 +};
1 +"use strict";
2 +
3 +/**
4 + * Implementation of atob() according to the HTML and Infra specs, except that
5 + * instead of throwing INVALID_CHARACTER_ERR we return null.
6 + */
7 +function atob(data) {
8 + // Web IDL requires DOMStrings to just be converted using ECMAScript
9 + // ToString, which in our case amounts to using a template literal.
10 + data = `${data}`;
11 + // "Remove all ASCII whitespace from data."
12 + data = data.replace(/[ \t\n\f\r]/g, "");
13 + // "If data's length divides by 4 leaving no remainder, then: if data ends
14 + // with one or two U+003D (=) code points, then remove them from data."
15 + if (data.length % 4 === 0) {
16 + data = data.replace(/==?$/, "");
17 + }
18 + // "If data's length divides by 4 leaving a remainder of 1, then return
19 + // failure."
20 + //
21 + // "If data contains a code point that is not one of
22 + //
23 + // U+002B (+)
24 + // U+002F (/)
25 + // ASCII alphanumeric
26 + //
27 + // then return failure."
28 + if (data.length % 4 === 1 || /[^+/0-9A-Za-z]/.test(data)) {
29 + return null;
30 + }
31 + // "Let output be an empty byte sequence."
32 + let output = "";
33 + // "Let buffer be an empty buffer that can have bits appended to it."
34 + //
35 + // We append bits via left-shift and or. accumulatedBits is used to track
36 + // when we've gotten to 24 bits.
37 + let buffer = 0;
38 + let accumulatedBits = 0;
39 + // "Let position be a position variable for data, initially pointing at the
40 + // start of data."
41 + //
42 + // "While position does not point past the end of data:"
43 + for (let i = 0; i < data.length; i++) {
44 + // "Find the code point pointed to by position in the second column of
45 + // Table 1: The Base 64 Alphabet of RFC 4648. Let n be the number given in
46 + // the first cell of the same row.
47 + //
48 + // "Append to buffer the six bits corresponding to n, most significant bit
49 + // first."
50 + //
51 + // atobLookup() implements the table from RFC 4648.
52 + buffer <<= 6;
53 + buffer |= atobLookup(data[i]);
54 + accumulatedBits += 6;
55 + // "If buffer has accumulated 24 bits, interpret them as three 8-bit
56 + // big-endian numbers. Append three bytes with values equal to those
57 + // numbers to output, in the same order, and then empty buffer."
58 + if (accumulatedBits === 24) {
59 + output += String.fromCharCode((buffer & 0xff0000) >> 16);
60 + output += String.fromCharCode((buffer & 0xff00) >> 8);
61 + output += String.fromCharCode(buffer & 0xff);
62 + buffer = accumulatedBits = 0;
63 + }
64 + // "Advance position by 1."
65 + }
66 + // "If buffer is not empty, it contains either 12 or 18 bits. If it contains
67 + // 12 bits, then discard the last four and interpret the remaining eight as
68 + // an 8-bit big-endian number. If it contains 18 bits, then discard the last
69 + // two and interpret the remaining 16 as two 8-bit big-endian numbers. Append
70 + // the one or two bytes with values equal to those one or two numbers to
71 + // output, in the same order."
72 + if (accumulatedBits === 12) {
73 + buffer >>= 4;
74 + output += String.fromCharCode(buffer);
75 + } else if (accumulatedBits === 18) {
76 + buffer >>= 2;
77 + output += String.fromCharCode((buffer & 0xff00) >> 8);
78 + output += String.fromCharCode(buffer & 0xff);
79 + }
80 + // "Return output."
81 + return output;
82 +}
83 +/**
84 + * A lookup table for atob(), which converts an ASCII character to the
85 + * corresponding six-bit number.
86 + */
87 +function atobLookup(chr) {
88 + if (/[A-Z]/.test(chr)) {
89 + return chr.charCodeAt(0) - "A".charCodeAt(0);
90 + }
91 + if (/[a-z]/.test(chr)) {
92 + return chr.charCodeAt(0) - "a".charCodeAt(0) + 26;
93 + }
94 + if (/[0-9]/.test(chr)) {
95 + return chr.charCodeAt(0) - "0".charCodeAt(0) + 52;
96 + }
97 + if (chr === "+") {
98 + return 62;
99 + }
100 + if (chr === "/") {
101 + return 63;
102 + }
103 + // Throw exception; should not be hit in tests
104 + return undefined;
105 +}
106 +
107 +module.exports = atob;
1 +"use strict";
2 +
3 +/**
4 + * btoa() as defined by the HTML and Infra specs, which mostly just references
5 + * RFC 4648.
6 + */
7 +function btoa(s) {
8 + let i;
9 + // String conversion as required by Web IDL.
10 + s = `${s}`;
11 + // "The btoa() method must throw an "InvalidCharacterError" DOMException if
12 + // data contains any character whose code point is greater than U+00FF."
13 + for (i = 0; i < s.length; i++) {
14 + if (s.charCodeAt(i) > 255) {
15 + return null;
16 + }
17 + }
18 + let out = "";
19 + for (i = 0; i < s.length; i += 3) {
20 + const groupsOfSix = [undefined, undefined, undefined, undefined];
21 + groupsOfSix[0] = s.charCodeAt(i) >> 2;
22 + groupsOfSix[1] = (s.charCodeAt(i) & 0x03) << 4;
23 + if (s.length > i + 1) {
24 + groupsOfSix[1] |= s.charCodeAt(i + 1) >> 4;
25 + groupsOfSix[2] = (s.charCodeAt(i + 1) & 0x0f) << 2;
26 + }
27 + if (s.length > i + 2) {
28 + groupsOfSix[2] |= s.charCodeAt(i + 2) >> 6;
29 + groupsOfSix[3] = s.charCodeAt(i + 2) & 0x3f;
30 + }
31 + for (let j = 0; j < groupsOfSix.length; j++) {
32 + if (typeof groupsOfSix[j] === "undefined") {
33 + out += "=";
34 + } else {
35 + out += btoaLookup(groupsOfSix[j]);
36 + }
37 + }
38 + }
39 + return out;
40 +}
41 +
42 +/**
43 + * Lookup table for btoa(), which converts a six-bit number into the
44 + * corresponding ASCII character.
45 + */
46 +function btoaLookup(idx) {
47 + if (idx < 26) {
48 + return String.fromCharCode(idx + "A".charCodeAt(0));
49 + }
50 + if (idx < 52) {
51 + return String.fromCharCode(idx - 26 + "a".charCodeAt(0));
52 + }
53 + if (idx < 62) {
54 + return String.fromCharCode(idx - 52 + "0".charCodeAt(0));
55 + }
56 + if (idx === 62) {
57 + return "+";
58 + }
59 + if (idx === 63) {
60 + return "/";
61 + }
62 + // Throw INVALID_CHARACTER_ERR exception here -- won't be hit in the tests.
63 + return undefined;
64 +}
65 +
66 +module.exports = btoa;
1 +{
2 + "_from": "abab@^2.0.0",
3 + "_id": "abab@2.0.0",
4 + "_inBundle": false,
5 + "_integrity": "sha512-sY5AXXVZv4Y1VACTtR11UJCPHHudgY5i26Qj5TypE6DKlIApbwb5uqhXcJ5UUGbvZNRh7EeIoW+LrJumBsKp7w==",
6 + "_location": "/abab",
7 + "_phantomChildren": {},
8 + "_requested": {
9 + "type": "range",
10 + "registry": true,
11 + "raw": "abab@^2.0.0",
12 + "name": "abab",
13 + "escapedName": "abab",
14 + "rawSpec": "^2.0.0",
15 + "saveSpec": null,
16 + "fetchSpec": "^2.0.0"
17 + },
18 + "_requiredBy": [
19 + "/data-urls",
20 + "/jsdom"
21 + ],
22 + "_resolved": "https://registry.npmjs.org/abab/-/abab-2.0.0.tgz",
23 + "_shasum": "aba0ab4c5eee2d4c79d3487d85450fb2376ebb0f",
24 + "_spec": "abab@^2.0.0",
25 + "_where": "C:\\Users\\김용재\\Desktop\\2019 공부\\Open_Source_project\\node_modules\\jsdom",
26 + "author": {
27 + "name": "Jeff Carpenter",
28 + "email": "gcarpenterv@gmail.com"
29 + },
30 + "bugs": {
31 + "url": "https://github.com/jsdom/abab/issues"
32 + },
33 + "bundleDependencies": false,
34 + "deprecated": false,
35 + "description": "WHATWG spec-compliant implementations of window.atob and window.btoa.",
36 + "devDependencies": {
37 + "eslint": "^4.19.1",
38 + "karma": "^2.0.0",
39 + "karma-cli": "^1.0.1",
40 + "karma-firefox-launcher": "^1.1.0",
41 + "karma-mocha": "^1.3.0",
42 + "karma-webpack": "^3.0.0",
43 + "mocha": "^5.1.0",
44 + "webpack": "^4.5.0"
45 + },
46 + "files": [
47 + "index.js",
48 + "lib/"
49 + ],
50 + "homepage": "https://github.com/jsdom/abab#readme",
51 + "keywords": [
52 + "atob",
53 + "btoa",
54 + "browser"
55 + ],
56 + "license": "SEE LICENSE IN LICENSE.md",
57 + "main": "index.js",
58 + "name": "abab",
59 + "repository": {
60 + "type": "git",
61 + "url": "git+https://github.com/jsdom/abab.git"
62 + },
63 + "scripts": {
64 + "karma": "karma start",
65 + "lint": "eslint .",
66 + "mocha": "mocha test/node",
67 + "test": "npm run lint && npm run mocha && npm run karma"
68 + },
69 + "version": "2.0.0"
70 +}
1 +1.3.7 / 2019-04-29
2 +==================
3 +
4 + * deps: negotiator@0.6.2
5 + - Fix sorting charset, encoding, and language with extra parameters
6 +
7 +1.3.6 / 2019-04-28
8 +==================
9 +
10 + * deps: mime-types@~2.1.24
11 + - deps: mime-db@~1.40.0
12 +
13 +1.3.5 / 2018-02-28
14 +==================
15 +
16 + * deps: mime-types@~2.1.18
17 + - deps: mime-db@~1.33.0
18 +
19 +1.3.4 / 2017-08-22
20 +==================
21 +
22 + * deps: mime-types@~2.1.16
23 + - deps: mime-db@~1.29.0
24 +
25 +1.3.3 / 2016-05-02
26 +==================
27 +
28 + * deps: mime-types@~2.1.11
29 + - deps: mime-db@~1.23.0
30 + * deps: negotiator@0.6.1
31 + - perf: improve `Accept` parsing speed
32 + - perf: improve `Accept-Charset` parsing speed
33 + - perf: improve `Accept-Encoding` parsing speed
34 + - perf: improve `Accept-Language` parsing speed
35 +
36 +1.3.2 / 2016-03-08
37 +==================
38 +
39 + * deps: mime-types@~2.1.10
40 + - Fix extension of `application/dash+xml`
41 + - Update primary extension for `audio/mp4`
42 + - deps: mime-db@~1.22.0
43 +
44 +1.3.1 / 2016-01-19
45 +==================
46 +
47 + * deps: mime-types@~2.1.9
48 + - deps: mime-db@~1.21.0
49 +
50 +1.3.0 / 2015-09-29
51 +==================
52 +
53 + * deps: mime-types@~2.1.7
54 + - deps: mime-db@~1.19.0
55 + * deps: negotiator@0.6.0
56 + - Fix including type extensions in parameters in `Accept` parsing
57 + - Fix parsing `Accept` parameters with quoted equals
58 + - Fix parsing `Accept` parameters with quoted semicolons
59 + - Lazy-load modules from main entry point
60 + - perf: delay type concatenation until needed
61 + - perf: enable strict mode
62 + - perf: hoist regular expressions
63 + - perf: remove closures getting spec properties
64 + - perf: remove a closure from media type parsing
65 + - perf: remove property delete from media type parsing
66 +
67 +1.2.13 / 2015-09-06
68 +===================
69 +
70 + * deps: mime-types@~2.1.6
71 + - deps: mime-db@~1.18.0
72 +
73 +1.2.12 / 2015-07-30
74 +===================
75 +
76 + * deps: mime-types@~2.1.4
77 + - deps: mime-db@~1.16.0
78 +
79 +1.2.11 / 2015-07-16
80 +===================
81 +
82 + * deps: mime-types@~2.1.3
83 + - deps: mime-db@~1.15.0
84 +
85 +1.2.10 / 2015-07-01
86 +===================
87 +
88 + * deps: mime-types@~2.1.2
89 + - deps: mime-db@~1.14.0
90 +
91 +1.2.9 / 2015-06-08
92 +==================
93 +
94 + * deps: mime-types@~2.1.1
95 + - perf: fix deopt during mapping
96 +
97 +1.2.8 / 2015-06-07
98 +==================
99 +
100 + * deps: mime-types@~2.1.0
101 + - deps: mime-db@~1.13.0
102 + * perf: avoid argument reassignment & argument slice
103 + * perf: avoid negotiator recursive construction
104 + * perf: enable strict mode
105 + * perf: remove unnecessary bitwise operator
106 +
107 +1.2.7 / 2015-05-10
108 +==================
109 +
110 + * deps: negotiator@0.5.3
111 + - Fix media type parameter matching to be case-insensitive
112 +
113 +1.2.6 / 2015-05-07
114 +==================
115 +
116 + * deps: mime-types@~2.0.11
117 + - deps: mime-db@~1.9.1
118 + * deps: negotiator@0.5.2
119 + - Fix comparing media types with quoted values
120 + - Fix splitting media types with quoted commas
121 +
122 +1.2.5 / 2015-03-13
123 +==================
124 +
125 + * deps: mime-types@~2.0.10
126 + - deps: mime-db@~1.8.0
127 +
128 +1.2.4 / 2015-02-14
129 +==================
130 +
131 + * Support Node.js 0.6
132 + * deps: mime-types@~2.0.9
133 + - deps: mime-db@~1.7.0
134 + * deps: negotiator@0.5.1
135 + - Fix preference sorting to be stable for long acceptable lists
136 +
137 +1.2.3 / 2015-01-31
138 +==================
139 +
140 + * deps: mime-types@~2.0.8
141 + - deps: mime-db@~1.6.0
142 +
143 +1.2.2 / 2014-12-30
144 +==================
145 +
146 + * deps: mime-types@~2.0.7
147 + - deps: mime-db@~1.5.0
148 +
149 +1.2.1 / 2014-12-30
150 +==================
151 +
152 + * deps: mime-types@~2.0.5
153 + - deps: mime-db@~1.3.1
154 +
155 +1.2.0 / 2014-12-19
156 +==================
157 +
158 + * deps: negotiator@0.5.0
159 + - Fix list return order when large accepted list
160 + - Fix missing identity encoding when q=0 exists
161 + - Remove dynamic building of Negotiator class
162 +
163 +1.1.4 / 2014-12-10
164 +==================
165 +
166 + * deps: mime-types@~2.0.4
167 + - deps: mime-db@~1.3.0
168 +
169 +1.1.3 / 2014-11-09
170 +==================
171 +
172 + * deps: mime-types@~2.0.3
173 + - deps: mime-db@~1.2.0
174 +
175 +1.1.2 / 2014-10-14
176 +==================
177 +
178 + * deps: negotiator@0.4.9
179 + - Fix error when media type has invalid parameter
180 +
181 +1.1.1 / 2014-09-28
182 +==================
183 +
184 + * deps: mime-types@~2.0.2
185 + - deps: mime-db@~1.1.0
186 + * deps: negotiator@0.4.8
187 + - Fix all negotiations to be case-insensitive
188 + - Stable sort preferences of same quality according to client order
189 +
190 +1.1.0 / 2014-09-02
191 +==================
192 +
193 + * update `mime-types`
194 +
195 +1.0.7 / 2014-07-04
196 +==================
197 +
198 + * Fix wrong type returned from `type` when match after unknown extension
199 +
200 +1.0.6 / 2014-06-24
201 +==================
202 +
203 + * deps: negotiator@0.4.7
204 +
205 +1.0.5 / 2014-06-20
206 +==================
207 +
208 + * fix crash when unknown extension given
209 +
210 +1.0.4 / 2014-06-19
211 +==================
212 +
213 + * use `mime-types`
214 +
215 +1.0.3 / 2014-06-11
216 +==================
217 +
218 + * deps: negotiator@0.4.6
219 + - Order by specificity when quality is the same
220 +
221 +1.0.2 / 2014-05-29
222 +==================
223 +
224 + * Fix interpretation when header not in request
225 + * deps: pin negotiator@0.4.5
226 +
227 +1.0.1 / 2014-01-18
228 +==================
229 +
230 + * Identity encoding isn't always acceptable
231 + * deps: negotiator@~0.4.0
232 +
233 +1.0.0 / 2013-12-27
234 +==================
235 +
236 + * Genesis
1 +(The MIT License)
2 +
3 +Copyright (c) 2014 Jonathan Ong <me@jongleberry.com>
4 +Copyright (c) 2015 Douglas Christopher Wilson <doug@somethingdoug.com>
5 +
6 +Permission is hereby granted, free of charge, to any person obtaining
7 +a copy of this software and associated documentation files (the
8 +'Software'), to deal in the Software without restriction, including
9 +without limitation the rights to use, copy, modify, merge, publish,
10 +distribute, sublicense, and/or sell copies of the Software, and to
11 +permit persons to whom the Software is furnished to do so, subject to
12 +the following conditions:
13 +
14 +The above copyright notice and this permission notice shall be
15 +included in all copies or substantial portions of the Software.
16 +
17 +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
18 +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20 +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
21 +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22 +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23 +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1 +# accepts
2 +
3 +[![NPM Version][npm-version-image]][npm-url]
4 +[![NPM Downloads][npm-downloads-image]][npm-url]
5 +[![Node.js Version][node-version-image]][node-version-url]
6 +[![Build Status][travis-image]][travis-url]
7 +[![Test Coverage][coveralls-image]][coveralls-url]
8 +
9 +Higher level content negotiation based on [negotiator](https://www.npmjs.com/package/negotiator).
10 +Extracted from [koa](https://www.npmjs.com/package/koa) for general use.
11 +
12 +In addition to negotiator, it allows:
13 +
14 +- Allows types as an array or arguments list, ie `(['text/html', 'application/json'])`
15 + as well as `('text/html', 'application/json')`.
16 +- Allows type shorthands such as `json`.
17 +- Returns `false` when no types match
18 +- Treats non-existent headers as `*`
19 +
20 +## Installation
21 +
22 +This is a [Node.js](https://nodejs.org/en/) module available through the
23 +[npm registry](https://www.npmjs.com/). Installation is done using the
24 +[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):
25 +
26 +```sh
27 +$ npm install accepts
28 +```
29 +
30 +## API
31 +
32 +<!-- eslint-disable no-unused-vars -->
33 +
34 +```js
35 +var accepts = require('accepts')
36 +```
37 +
38 +### accepts(req)
39 +
40 +Create a new `Accepts` object for the given `req`.
41 +
42 +#### .charset(charsets)
43 +
44 +Return the first accepted charset. If nothing in `charsets` is accepted,
45 +then `false` is returned.
46 +
47 +#### .charsets()
48 +
49 +Return the charsets that the request accepts, in the order of the client's
50 +preference (most preferred first).
51 +
52 +#### .encoding(encodings)
53 +
54 +Return the first accepted encoding. If nothing in `encodings` is accepted,
55 +then `false` is returned.
56 +
57 +#### .encodings()
58 +
59 +Return the encodings that the request accepts, in the order of the client's
60 +preference (most preferred first).
61 +
62 +#### .language(languages)
63 +
64 +Return the first accepted language. If nothing in `languages` is accepted,
65 +then `false` is returned.
66 +
67 +#### .languages()
68 +
69 +Return the languages that the request accepts, in the order of the client's
70 +preference (most preferred first).
71 +
72 +#### .type(types)
73 +
74 +Return the first accepted type (and it is returned as the same text as what
75 +appears in the `types` array). If nothing in `types` is accepted, then `false`
76 +is returned.
77 +
78 +The `types` array can contain full MIME types or file extensions. Any value
79 +that is not a full MIME types is passed to `require('mime-types').lookup`.
80 +
81 +#### .types()
82 +
83 +Return the types that the request accepts, in the order of the client's
84 +preference (most preferred first).
85 +
86 +## Examples
87 +
88 +### Simple type negotiation
89 +
90 +This simple example shows how to use `accepts` to return a different typed
91 +respond body based on what the client wants to accept. The server lists it's
92 +preferences in order and will get back the best match between the client and
93 +server.
94 +
95 +```js
96 +var accepts = require('accepts')
97 +var http = require('http')
98 +
99 +function app (req, res) {
100 + var accept = accepts(req)
101 +
102 + // the order of this list is significant; should be server preferred order
103 + switch (accept.type(['json', 'html'])) {
104 + case 'json':
105 + res.setHeader('Content-Type', 'application/json')
106 + res.write('{"hello":"world!"}')
107 + break
108 + case 'html':
109 + res.setHeader('Content-Type', 'text/html')
110 + res.write('<b>hello, world!</b>')
111 + break
112 + default:
113 + // the fallback is text/plain, so no need to specify it above
114 + res.setHeader('Content-Type', 'text/plain')
115 + res.write('hello, world!')
116 + break
117 + }
118 +
119 + res.end()
120 +}
121 +
122 +http.createServer(app).listen(3000)
123 +```
124 +
125 +You can test this out with the cURL program:
126 +```sh
127 +curl -I -H'Accept: text/html' http://localhost:3000/
128 +```
129 +
130 +## License
131 +
132 +[MIT](LICENSE)
133 +
134 +[coveralls-image]: https://badgen.net/coveralls/c/github/jshttp/accepts/master
135 +[coveralls-url]: https://coveralls.io/r/jshttp/accepts?branch=master
136 +[node-version-image]: https://badgen.net/npm/node/accepts
137 +[node-version-url]: https://nodejs.org/en/download
138 +[npm-downloads-image]: https://badgen.net/npm/dm/accepts
139 +[npm-url]: https://npmjs.org/package/accepts
140 +[npm-version-image]: https://badgen.net/npm/v/accepts
141 +[travis-image]: https://badgen.net/travis/jshttp/accepts/master
142 +[travis-url]: https://travis-ci.org/jshttp/accepts
1 +/*!
2 + * accepts
3 + * Copyright(c) 2014 Jonathan Ong
4 + * Copyright(c) 2015 Douglas Christopher Wilson
5 + * MIT Licensed
6 + */
7 +
8 +'use strict'
9 +
10 +/**
11 + * Module dependencies.
12 + * @private
13 + */
14 +
15 +var Negotiator = require('negotiator')
16 +var mime = require('mime-types')
17 +
18 +/**
19 + * Module exports.
20 + * @public
21 + */
22 +
23 +module.exports = Accepts
24 +
25 +/**
26 + * Create a new Accepts object for the given req.
27 + *
28 + * @param {object} req
29 + * @public
30 + */
31 +
32 +function Accepts (req) {
33 + if (!(this instanceof Accepts)) {
34 + return new Accepts(req)
35 + }
36 +
37 + this.headers = req.headers
38 + this.negotiator = new Negotiator(req)
39 +}
40 +
41 +/**
42 + * Check if the given `type(s)` is acceptable, returning
43 + * the best match when true, otherwise `undefined`, in which
44 + * case you should respond with 406 "Not Acceptable".
45 + *
46 + * The `type` value may be a single mime type string
47 + * such as "application/json", the extension name
48 + * such as "json" or an array `["json", "html", "text/plain"]`. When a list
49 + * or array is given the _best_ match, if any is returned.
50 + *
51 + * Examples:
52 + *
53 + * // Accept: text/html
54 + * this.types('html');
55 + * // => "html"
56 + *
57 + * // Accept: text/*, application/json
58 + * this.types('html');
59 + * // => "html"
60 + * this.types('text/html');
61 + * // => "text/html"
62 + * this.types('json', 'text');
63 + * // => "json"
64 + * this.types('application/json');
65 + * // => "application/json"
66 + *
67 + * // Accept: text/*, application/json
68 + * this.types('image/png');
69 + * this.types('png');
70 + * // => undefined
71 + *
72 + * // Accept: text/*;q=.5, application/json
73 + * this.types(['html', 'json']);
74 + * this.types('html', 'json');
75 + * // => "json"
76 + *
77 + * @param {String|Array} types...
78 + * @return {String|Array|Boolean}
79 + * @public
80 + */
81 +
82 +Accepts.prototype.type =
83 +Accepts.prototype.types = function (types_) {
84 + var types = types_
85 +
86 + // support flattened arguments
87 + if (types && !Array.isArray(types)) {
88 + types = new Array(arguments.length)
89 + for (var i = 0; i < types.length; i++) {
90 + types[i] = arguments[i]
91 + }
92 + }
93 +
94 + // no types, return all requested types
95 + if (!types || types.length === 0) {
96 + return this.negotiator.mediaTypes()
97 + }
98 +
99 + // no accept header, return first given type
100 + if (!this.headers.accept) {
101 + return types[0]
102 + }
103 +
104 + var mimes = types.map(extToMime)
105 + var accepts = this.negotiator.mediaTypes(mimes.filter(validMime))
106 + var first = accepts[0]
107 +
108 + return first
109 + ? types[mimes.indexOf(first)]
110 + : false
111 +}
112 +
113 +/**
114 + * Return accepted encodings or best fit based on `encodings`.
115 + *
116 + * Given `Accept-Encoding: gzip, deflate`
117 + * an array sorted by quality is returned:
118 + *
119 + * ['gzip', 'deflate']
120 + *
121 + * @param {String|Array} encodings...
122 + * @return {String|Array}
123 + * @public
124 + */
125 +
126 +Accepts.prototype.encoding =
127 +Accepts.prototype.encodings = function (encodings_) {
128 + var encodings = encodings_
129 +
130 + // support flattened arguments
131 + if (encodings && !Array.isArray(encodings)) {
132 + encodings = new Array(arguments.length)
133 + for (var i = 0; i < encodings.length; i++) {
134 + encodings[i] = arguments[i]
135 + }
136 + }
137 +
138 + // no encodings, return all requested encodings
139 + if (!encodings || encodings.length === 0) {
140 + return this.negotiator.encodings()
141 + }
142 +
143 + return this.negotiator.encodings(encodings)[0] || false
144 +}
145 +
146 +/**
147 + * Return accepted charsets or best fit based on `charsets`.
148 + *
149 + * Given `Accept-Charset: utf-8, iso-8859-1;q=0.2, utf-7;q=0.5`
150 + * an array sorted by quality is returned:
151 + *
152 + * ['utf-8', 'utf-7', 'iso-8859-1']
153 + *
154 + * @param {String|Array} charsets...
155 + * @return {String|Array}
156 + * @public
157 + */
158 +
159 +Accepts.prototype.charset =
160 +Accepts.prototype.charsets = function (charsets_) {
161 + var charsets = charsets_
162 +
163 + // support flattened arguments
164 + if (charsets && !Array.isArray(charsets)) {
165 + charsets = new Array(arguments.length)
166 + for (var i = 0; i < charsets.length; i++) {
167 + charsets[i] = arguments[i]
168 + }
169 + }
170 +
171 + // no charsets, return all requested charsets
172 + if (!charsets || charsets.length === 0) {
173 + return this.negotiator.charsets()
174 + }
175 +
176 + return this.negotiator.charsets(charsets)[0] || false
177 +}
178 +
179 +/**
180 + * Return accepted languages or best fit based on `langs`.
181 + *
182 + * Given `Accept-Language: en;q=0.8, es, pt`
183 + * an array sorted by quality is returned:
184 + *
185 + * ['es', 'pt', 'en']
186 + *
187 + * @param {String|Array} langs...
188 + * @return {Array|String}
189 + * @public
190 + */
191 +
192 +Accepts.prototype.lang =
193 +Accepts.prototype.langs =
194 +Accepts.prototype.language =
195 +Accepts.prototype.languages = function (languages_) {
196 + var languages = languages_
197 +
198 + // support flattened arguments
199 + if (languages && !Array.isArray(languages)) {
200 + languages = new Array(arguments.length)
201 + for (var i = 0; i < languages.length; i++) {
202 + languages[i] = arguments[i]
203 + }
204 + }
205 +
206 + // no languages, return all requested languages
207 + if (!languages || languages.length === 0) {
208 + return this.negotiator.languages()
209 + }
210 +
211 + return this.negotiator.languages(languages)[0] || false
212 +}
213 +
214 +/**
215 + * Convert extnames to mime.
216 + *
217 + * @param {String} type
218 + * @return {String}
219 + * @private
220 + */
221 +
222 +function extToMime (type) {
223 + return type.indexOf('/') === -1
224 + ? mime.lookup(type)
225 + : type
226 +}
227 +
228 +/**
229 + * Check if mime is valid.
230 + *
231 + * @param {String} type
232 + * @return {String}
233 + * @private
234 + */
235 +
236 +function validMime (type) {
237 + return typeof type === 'string'
238 +}
1 +{
2 + "_from": "accepts@~1.3.7",
3 + "_id": "accepts@1.3.7",
4 + "_inBundle": false,
5 + "_integrity": "sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA==",
6 + "_location": "/accepts",
7 + "_phantomChildren": {},
8 + "_requested": {
9 + "type": "range",
10 + "registry": true,
11 + "raw": "accepts@~1.3.7",
12 + "name": "accepts",
13 + "escapedName": "accepts",
14 + "rawSpec": "~1.3.7",
15 + "saveSpec": null,
16 + "fetchSpec": "~1.3.7"
17 + },
18 + "_requiredBy": [
19 + "/express"
20 + ],
21 + "_resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz",
22 + "_shasum": "531bc726517a3b2b41f850021c6cc15eaab507cd",
23 + "_spec": "accepts@~1.3.7",
24 + "_where": "C:\\Users\\kyjoon\\Desktop\\거위\\Open_Source_project\\node_modules\\express",
25 + "bugs": {
26 + "url": "https://github.com/jshttp/accepts/issues"
27 + },
28 + "bundleDependencies": false,
29 + "contributors": [
30 + {
31 + "name": "Douglas Christopher Wilson",
32 + "email": "doug@somethingdoug.com"
33 + },
34 + {
35 + "name": "Jonathan Ong",
36 + "email": "me@jongleberry.com",
37 + "url": "http://jongleberry.com"
38 + }
39 + ],
40 + "dependencies": {
41 + "mime-types": "~2.1.24",
42 + "negotiator": "0.6.2"
43 + },
44 + "deprecated": false,
45 + "description": "Higher-level content negotiation",
46 + "devDependencies": {
47 + "deep-equal": "1.0.1",
48 + "eslint": "5.16.0",
49 + "eslint-config-standard": "12.0.0",
50 + "eslint-plugin-import": "2.17.2",
51 + "eslint-plugin-markdown": "1.0.0",
52 + "eslint-plugin-node": "8.0.1",
53 + "eslint-plugin-promise": "4.1.1",
54 + "eslint-plugin-standard": "4.0.0",
55 + "mocha": "6.1.4",
56 + "nyc": "14.0.0"
57 + },
58 + "engines": {
59 + "node": ">= 0.6"
60 + },
61 + "files": [
62 + "LICENSE",
63 + "HISTORY.md",
64 + "index.js"
65 + ],
66 + "homepage": "https://github.com/jshttp/accepts#readme",
67 + "keywords": [
68 + "content",
69 + "negotiation",
70 + "accept",
71 + "accepts"
72 + ],
73 + "license": "MIT",
74 + "name": "accepts",
75 + "repository": {
76 + "type": "git",
77 + "url": "git+https://github.com/jshttp/accepts.git"
78 + },
79 + "scripts": {
80 + "lint": "eslint --plugin markdown --ext js,md .",
81 + "test": "mocha --reporter spec --check-leaks --bail test/",
82 + "test-cov": "nyc --reporter=html --reporter=text npm test",
83 + "test-travis": "nyc --reporter=text npm test"
84 + },
85 + "version": "1.3.7"
86 +}
1 +Copyright (c) 2014 Forbes Lindesay
2 +
3 +Permission is hereby granted, free of charge, to any person obtaining a copy
4 +of this software and associated documentation files (the "Software"), to deal
5 +in the Software without restriction, including without limitation the rights
6 +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 +copies of the Software, and to permit persons to whom the Software is
8 +furnished to do so, subject to the following conditions:
9 +
10 +The above copyright notice and this permission notice shall be included in
11 +all copies or substantial portions of the Software.
12 +
13 +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 +THE SOFTWARE.
...\ No newline at end of file ...\ No newline at end of file
1 +# acorn-globals
2 +
3 +Detect global variables in JavaScript using acorn
4 +
5 +[Get supported acorn-globals with the Tidelift Subscription](https://tidelift.com/subscription/pkg/npm-acorn_globals?utm_source=npm-acorn-globals&utm_medium=referral&utm_campaign=readme)
6 +
7 +[![Build Status](https://img.shields.io/travis/ForbesLindesay/acorn-globals/master.svg)](https://travis-ci.org/ForbesLindesay/acorn-globals)
8 +[![Dependency Status](https://img.shields.io/david/ForbesLindesay/acorn-globals.svg)](https://david-dm.org/ForbesLindesay/acorn-globals)
9 +[![NPM version](https://img.shields.io/npm/v/acorn-globals.svg)](https://www.npmjs.org/package/acorn-globals)
10 +
11 +## Installation
12 +
13 + npm install acorn-globals
14 +
15 +## Usage
16 +
17 +detect.js
18 +
19 +```js
20 +var fs = require('fs');
21 +var detect = require('acorn-globals');
22 +
23 +var src = fs.readFileSync(__dirname + '/input.js', 'utf8');
24 +
25 +var scope = detect(src);
26 +console.dir(scope);
27 +```
28 +
29 +input.js
30 +
31 +```js
32 +var x = 5;
33 +var y = 3, z = 2;
34 +
35 +w.foo();
36 +w = 2;
37 +
38 +RAWR=444;
39 +RAWR.foo();
40 +
41 +BLARG=3;
42 +
43 +foo(function () {
44 + var BAR = 3;
45 + process.nextTick(function (ZZZZZZZZZZZZ) {
46 + console.log('beep boop');
47 + var xyz = 4;
48 + x += 10;
49 + x.zzzzzz;
50 + ZZZ=6;
51 + });
52 + function doom () {
53 + }
54 + ZZZ.foo();
55 +
56 +});
57 +
58 +console.log(xyz);
59 +```
60 +
61 +output:
62 +
63 +```
64 +$ node example/detect.js
65 +[ { name: 'BLARG', nodes: [ [Object] ] },
66 + { name: 'RAWR', nodes: [ [Object], [Object] ] },
67 + { name: 'ZZZ', nodes: [ [Object], [Object] ] },
68 + { name: 'console', nodes: [ [Object], [Object] ] },
69 + { name: 'foo', nodes: [ [Object] ] },
70 + { name: 'process', nodes: [ [Object] ] },
71 + { name: 'w', nodes: [ [Object], [Object] ] },
72 + { name: 'xyz', nodes: [ [Object] ] } ]
73 +```
74 +
75 +## Security contact information
76 +
77 +To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security). Tidelift will coordinate the fix and disclosure.
78 +
79 +## License
80 +
81 + MIT
1 +'use strict';
2 +
3 +var acorn = require('acorn');
4 +var walk = require('acorn-walk');
5 +
6 +function isScope(node) {
7 + return node.type === 'FunctionExpression' || node.type === 'FunctionDeclaration' || node.type === 'ArrowFunctionExpression' || node.type === 'Program';
8 +}
9 +function isBlockScope(node) {
10 + return node.type === 'BlockStatement' || isScope(node);
11 +}
12 +
13 +function declaresArguments(node) {
14 + return node.type === 'FunctionExpression' || node.type === 'FunctionDeclaration';
15 +}
16 +
17 +function declaresThis(node) {
18 + return node.type === 'FunctionExpression' || node.type === 'FunctionDeclaration';
19 +}
20 +
21 +function reallyParse(source, options) {
22 + var parseOptions = Object.assign({}, options,
23 + {
24 + allowReturnOutsideFunction: true,
25 + allowImportExportEverywhere: true,
26 + allowHashBang: true
27 + }
28 + );
29 + return acorn.parse(source, parseOptions);
30 +}
31 +module.exports = findGlobals;
32 +module.exports.parse = reallyParse;
33 +function findGlobals(source, options) {
34 + options = options || {};
35 + var globals = [];
36 + var ast;
37 + // istanbul ignore else
38 + if (typeof source === 'string') {
39 + ast = reallyParse(source, options);
40 + } else {
41 + ast = source;
42 + }
43 + // istanbul ignore if
44 + if (!(ast && typeof ast === 'object' && ast.type === 'Program')) {
45 + throw new TypeError('Source must be either a string of JavaScript or an acorn AST');
46 + }
47 + var declareFunction = function (node) {
48 + var fn = node;
49 + fn.locals = fn.locals || {};
50 + node.params.forEach(function (node) {
51 + declarePattern(node, fn);
52 + });
53 + if (node.id) {
54 + fn.locals[node.id.name] = true;
55 + }
56 + };
57 + var declarePattern = function (node, parent) {
58 + switch (node.type) {
59 + case 'Identifier':
60 + parent.locals[node.name] = true;
61 + break;
62 + case 'ObjectPattern':
63 + node.properties.forEach(function (node) {
64 + declarePattern(node.value || node.argument, parent);
65 + });
66 + break;
67 + case 'ArrayPattern':
68 + node.elements.forEach(function (node) {
69 + if (node) declarePattern(node, parent);
70 + });
71 + break;
72 + case 'RestElement':
73 + declarePattern(node.argument, parent);
74 + break;
75 + case 'AssignmentPattern':
76 + declarePattern(node.left, parent);
77 + break;
78 + // istanbul ignore next
79 + default:
80 + throw new Error('Unrecognized pattern type: ' + node.type);
81 + }
82 + };
83 + var declareModuleSpecifier = function (node, parents) {
84 + ast.locals = ast.locals || {};
85 + ast.locals[node.local.name] = true;
86 + };
87 + walk.ancestor(ast, {
88 + 'VariableDeclaration': function (node, parents) {
89 + var parent = null;
90 + for (var i = parents.length - 1; i >= 0 && parent === null; i--) {
91 + if (node.kind === 'var' ? isScope(parents[i]) : isBlockScope(parents[i])) {
92 + parent = parents[i];
93 + }
94 + }
95 + parent.locals = parent.locals || {};
96 + node.declarations.forEach(function (declaration) {
97 + declarePattern(declaration.id, parent);
98 + });
99 + },
100 + 'FunctionDeclaration': function (node, parents) {
101 + var parent = null;
102 + for (var i = parents.length - 2; i >= 0 && parent === null; i--) {
103 + if (isScope(parents[i])) {
104 + parent = parents[i];
105 + }
106 + }
107 + parent.locals = parent.locals || {};
108 + if (node.id) {
109 + parent.locals[node.id.name] = true;
110 + }
111 + declareFunction(node);
112 + },
113 + 'Function': declareFunction,
114 + 'ClassDeclaration': function (node, parents) {
115 + var parent = null;
116 + for (var i = parents.length - 2; i >= 0 && parent === null; i--) {
117 + if (isBlockScope(parents[i])) {
118 + parent = parents[i];
119 + }
120 + }
121 + parent.locals = parent.locals || {};
122 + if (node.id) {
123 + parent.locals[node.id.name] = true;
124 + }
125 + },
126 + 'TryStatement': function (node) {
127 + if (node.handler === null) return;
128 + node.handler.locals = node.handler.locals || {};
129 + node.handler.locals[node.handler.param.name] = true;
130 + },
131 + 'ImportDefaultSpecifier': declareModuleSpecifier,
132 + 'ImportSpecifier': declareModuleSpecifier,
133 + 'ImportNamespaceSpecifier': declareModuleSpecifier
134 + });
135 + function identifier(node, parents) {
136 + var name = node.name;
137 + if (name === 'undefined') return;
138 + for (var i = 0; i < parents.length; i++) {
139 + if (name === 'arguments' && declaresArguments(parents[i])) {
140 + return;
141 + }
142 + if (parents[i].locals && name in parents[i].locals) {
143 + return;
144 + }
145 + }
146 + node.parents = parents.slice();
147 + globals.push(node);
148 + }
149 + walk.ancestor(ast, {
150 + 'VariablePattern': identifier,
151 + 'Identifier': identifier,
152 + 'ThisExpression': function (node, parents) {
153 + for (var i = 0; i < parents.length; i++) {
154 + if (declaresThis(parents[i])) {
155 + return;
156 + }
157 + }
158 + node.parents = parents.slice();
159 + globals.push(node);
160 + }
161 + });
162 + var groupedGlobals = {};
163 + globals.forEach(function (node) {
164 + var name = node.type === 'ThisExpression' ? 'this' : node.name;
165 + groupedGlobals[name] = (groupedGlobals[name] || []);
166 + groupedGlobals[name].push(node);
167 + });
168 + return Object.keys(groupedGlobals).sort().map(function (name) {
169 + return {name: name, nodes: groupedGlobals[name]};
170 + });
171 +}
1 +{
2 + "_from": "acorn-globals@^4.3.2",
3 + "_id": "acorn-globals@4.3.2",
4 + "_inBundle": false,
5 + "_integrity": "sha512-BbzvZhVtZP+Bs1J1HcwrQe8ycfO0wStkSGxuul3He3GkHOIZ6eTqOkPuw9IP1X3+IkOo4wiJmwkobzXYz4wewQ==",
6 + "_location": "/acorn-globals",
7 + "_phantomChildren": {},
8 + "_requested": {
9 + "type": "range",
10 + "registry": true,
11 + "raw": "acorn-globals@^4.3.2",
12 + "name": "acorn-globals",
13 + "escapedName": "acorn-globals",
14 + "rawSpec": "^4.3.2",
15 + "saveSpec": null,
16 + "fetchSpec": "^4.3.2"
17 + },
18 + "_requiredBy": [
19 + "/jsdom"
20 + ],
21 + "_resolved": "https://registry.npmjs.org/acorn-globals/-/acorn-globals-4.3.2.tgz",
22 + "_shasum": "4e2c2313a597fd589720395f6354b41cd5ec8006",
23 + "_spec": "acorn-globals@^4.3.2",
24 + "_where": "C:\\Users\\김용재\\Desktop\\2019 공부\\Open_Source_project\\node_modules\\jsdom",
25 + "author": {
26 + "name": "ForbesLindesay"
27 + },
28 + "bugs": {
29 + "url": "https://github.com/ForbesLindesay/acorn-globals/issues"
30 + },
31 + "bundleDependencies": false,
32 + "dependencies": {
33 + "acorn": "^6.0.1",
34 + "acorn-walk": "^6.0.1"
35 + },
36 + "deprecated": false,
37 + "description": "Detect global variables in JavaScript using acorn",
38 + "devDependencies": {
39 + "testit": "^3.0.0"
40 + },
41 + "files": [
42 + "index.js",
43 + "LICENSE"
44 + ],
45 + "homepage": "https://github.com/ForbesLindesay/acorn-globals#readme",
46 + "keywords": [
47 + "ast",
48 + "variable",
49 + "name",
50 + "lexical",
51 + "scope",
52 + "local",
53 + "global",
54 + "implicit"
55 + ],
56 + "license": "MIT",
57 + "name": "acorn-globals",
58 + "repository": {
59 + "type": "git",
60 + "url": "git+https://github.com/ForbesLindesay/acorn-globals.git"
61 + },
62 + "scripts": {
63 + "test": "node test"
64 + },
65 + "version": "4.3.2"
66 +}
1 +## 6.1.0 (2018-09-28)
2 +
3 +### New features
4 +
5 +The walker now walks `TemplateElement` nodes.
6 +
7 +## 6.0.1 (2018-09-14)
8 +
9 +### Bug fixes
10 +
11 +Fix bad "main" field in package.json.
12 +
13 +## 6.0.0 (2018-09-14)
14 +
15 +### Breaking changes
16 +
17 +This is now a separate package, `acorn-walk`, rather than part of the main `acorn` package.
18 +
19 +The `ScopeBody` and `ScopeExpression` meta-node-types are no longer supported.
20 +
21 +## 5.7.1 (2018-06-15)
22 +
23 +### Bug fixes
24 +
25 +Make sure the walker and bin files are rebuilt on release (the previous release didn't get the up-to-date versions).
26 +
27 +## 5.7.0 (2018-06-15)
28 +
29 +### Bug fixes
30 +
31 +Fix crash in walker when walking a binding-less catch node.
32 +
33 +## 5.6.2 (2018-06-05)
34 +
35 +### Bug fixes
36 +
37 +In the walker, go back to allowing the `baseVisitor` argument to be null to default to the default base everywhere.
38 +
39 +## 5.6.1 (2018-06-01)
40 +
41 +### Bug fixes
42 +
43 +Fix regression when passing `null` as fourth argument to `walk.recursive`.
44 +
45 +## 5.6.0 (2018-05-31)
46 +
47 +### Bug fixes
48 +
49 +Fix a bug in the walker that caused a crash when walking an object pattern spread.
50 +
51 +## 5.5.1 (2018-03-06)
52 +
53 +### Bug fixes
54 +
55 +Fix regression in walker causing property values in object patterns to be walked as expressions.
56 +
57 +## 5.5.0 (2018-02-27)
58 +
59 +### Bug fixes
60 +
61 +Support object spread in the AST walker.
62 +
63 +## 5.4.1 (2018-02-02)
64 +
65 +### Bug fixes
66 +
67 +5.4.0 somehow accidentally included an old version of walk.js.
68 +
69 +## 5.2.0 (2017-10-30)
70 +
71 +### Bug fixes
72 +
73 +The `full` and `fullAncestor` walkers no longer visit nodes multiple times.
74 +
75 +## 5.1.0 (2017-07-05)
76 +
77 +### New features
78 +
79 +New walker functions `full` and `fullAncestor`.
80 +
81 +## 3.2.0 (2016-06-07)
82 +
83 +### New features
84 +
85 +Make it possible to use `visit.ancestor` with a walk state.
86 +
87 +## 3.1.0 (2016-04-18)
88 +
89 +### New features
90 +
91 +The walker now allows defining handlers for `CatchClause` nodes.
92 +
93 +## 2.5.2 (2015-10-27)
94 +
95 +### Fixes
96 +
97 +Fix bug where the walker walked an exported `let` statement as an expression.
1 +Copyright (C) 2012-2018 by various contributors (see AUTHORS)
2 +
3 +Permission is hereby granted, free of charge, to any person obtaining a copy
4 +of this software and associated documentation files (the "Software"), to deal
5 +in the Software without restriction, including without limitation the rights
6 +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 +copies of the Software, and to permit persons to whom the Software is
8 +furnished to do so, subject to the following conditions:
9 +
10 +The above copyright notice and this permission notice shall be included in
11 +all copies or substantial portions of the Software.
12 +
13 +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 +THE SOFTWARE.
1 +# Acorn AST walker
2 +
3 +An abstract syntax tree walker for the
4 +[ESTree](https://github.com/estree/estree) format.
5 +
6 +## Community
7 +
8 +Acorn is open source software released under an
9 +[MIT license](https://github.com/acornjs/acorn/blob/master/LICENSE).
10 +
11 +You are welcome to
12 +[report bugs](https://github.com/acornjs/acorn/issues) or create pull
13 +requests on [github](https://github.com/acornjs/acorn). For questions
14 +and discussion, please use the
15 +[Tern discussion forum](https://discuss.ternjs.net).
16 +
17 +## Installation
18 +
19 +The easiest way to install acorn is from [`npm`](https://www.npmjs.com/):
20 +
21 +```sh
22 +npm install acorn-walk
23 +```
24 +
25 +Alternately, you can download the source and build acorn yourself:
26 +
27 +```sh
28 +git clone https://github.com/acornjs/acorn.git
29 +cd acorn
30 +npm install
31 +```
32 +
33 +## Interface
34 +
35 +An algorithm for recursing through a syntax tree is stored as an
36 +object, with a property for each tree node type holding a function
37 +that will recurse through such a node. There are several ways to run
38 +such a walker.
39 +
40 +**simple**`(node, visitors, base, state)` does a 'simple' walk over a
41 +tree. `node` should be the AST node to walk, and `visitors` an object
42 +with properties whose names correspond to node types in the [ESTree
43 +spec](https://github.com/estree/estree). The properties should contain
44 +functions that will be called with the node object and, if applicable
45 +the state at that point. The last two arguments are optional. `base`
46 +is a walker algorithm, and `state` is a start state. The default
47 +walker will simply visit all statements and expressions and not
48 +produce a meaningful state. (An example of a use of state is to track
49 +scope at each point in the tree.)
50 +
51 +```js
52 +const acorn = require("acorn")
53 +const walk = require("acorn-walk")
54 +
55 +walk.simple(acorn.parse("let x = 10"), {
56 + Literal(node) {
57 + console.log(`Found a literal: ${node.value}`)
58 + }
59 +})
60 +```
61 +
62 +**ancestor**`(node, visitors, base, state)` does a 'simple' walk over
63 +a tree, building up an array of ancestor nodes (including the current node)
64 +and passing the array to the callbacks as a third parameter.
65 +
66 +```js
67 +const acorn = require("acorn")
68 +const walk = require("acorn-walk")
69 +
70 +walk.ancestor(acorn.parse("foo('hi')"), {
71 + Literal(_, ancestors) {
72 + console.log("This literal's ancestors are:", ancestors.map(n => n.type))
73 + }
74 +})
75 +```
76 +
77 +**recursive**`(node, state, functions, base)` does a 'recursive'
78 +walk, where the walker functions are responsible for continuing the
79 +walk on the child nodes of their target node. `state` is the start
80 +state, and `functions` should contain an object that maps node types
81 +to walker functions. Such functions are called with `(node, state, c)`
82 +arguments, and can cause the walk to continue on a sub-node by calling
83 +the `c` argument on it with `(node, state)` arguments. The optional
84 +`base` argument provides the fallback walker functions for node types
85 +that aren't handled in the `functions` object. If not given, the
86 +default walkers will be used.
87 +
88 +**make**`(functions, base)` builds a new walker object by using the
89 +walker functions in `functions` and filling in the missing ones by
90 +taking defaults from `base`.
91 +
92 +**full**`(node, callback, base, state)` does a 'full' walk over a
93 +tree, calling the callback with the arguments (node, state, type) for
94 +each node
95 +
96 +**fullAncestor**`(node, callback, base, state)` does a 'full' walk
97 +over a tree, building up an array of ancestor nodes (including the
98 +current node) and passing the array to the callbacks as a third
99 +parameter.
100 +
101 +```js
102 +const acorn = require("acorn")
103 +const walk = require("acorn-walk")
104 +
105 +walk.full(acorn.parse("1 + 1"), node => {
106 + console.log(`There's a ${node.type} node at ${node.ch}`)
107 +})
108 +```
109 +
110 +**findNodeAt**`(node, start, end, test, base, state)` tries to locate
111 +a node in a tree at the given start and/or end offsets, which
112 +satisfies the predicate `test`. `start` and `end` can be either `null`
113 +(as wildcard) or a number. `test` may be a string (indicating a node
114 +type) or a function that takes `(nodeType, node)` arguments and
115 +returns a boolean indicating whether this node is interesting. `base`
116 +and `state` are optional, and can be used to specify a custom walker.
117 +Nodes are tested from inner to outer, so if two nodes match the
118 +boundaries, the inner one will be preferred.
119 +
120 +**findNodeAround**`(node, pos, test, base, state)` is a lot like
121 +`findNodeAt`, but will match any node that exists 'around' (spanning)
122 +the given position.
123 +
124 +**findNodeAfter**`(node, pos, test, base, state)` is similar to
125 +`findNodeAround`, but will match all nodes *after* the given position
126 +(testing outer nodes before inner nodes).
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
1 +{
2 + "_from": "acorn-walk@^6.0.1",
3 + "_id": "acorn-walk@6.1.1",
4 + "_inBundle": false,
5 + "_integrity": "sha512-OtUw6JUTgxA2QoqqmrmQ7F2NYqiBPi/L2jqHyFtllhOUvXYQXf0Z1CYUinIfyT4bTCGmrA7gX9FvHA81uzCoVw==",
6 + "_location": "/acorn-walk",
7 + "_phantomChildren": {},
8 + "_requested": {
9 + "type": "range",
10 + "registry": true,
11 + "raw": "acorn-walk@^6.0.1",
12 + "name": "acorn-walk",
13 + "escapedName": "acorn-walk",
14 + "rawSpec": "^6.0.1",
15 + "saveSpec": null,
16 + "fetchSpec": "^6.0.1"
17 + },
18 + "_requiredBy": [
19 + "/acorn-globals"
20 + ],
21 + "_resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-6.1.1.tgz",
22 + "_shasum": "d363b66f5fac5f018ff9c3a1e7b6f8e310cc3913",
23 + "_spec": "acorn-walk@^6.0.1",
24 + "_where": "C:\\Users\\김용재\\Desktop\\2019 공부\\Open_Source_project\\node_modules\\acorn-globals",
25 + "bugs": {
26 + "url": "https://github.com/acornjs/acorn/issues"
27 + },
28 + "bundleDependencies": false,
29 + "deprecated": false,
30 + "description": "ECMAScript (ESTree) AST walker",
31 + "engines": {
32 + "node": ">=0.4.0"
33 + },
34 + "homepage": "https://github.com/acornjs/acorn",
35 + "license": "MIT",
36 + "main": "dist/walk.js",
37 + "maintainers": [
38 + {
39 + "name": "Marijn Haverbeke",
40 + "email": "marijnh@gmail.com",
41 + "url": "https://marijnhaverbeke.nl"
42 + },
43 + {
44 + "name": "Ingvar Stepanyan",
45 + "email": "me@rreverser.com",
46 + "url": "https://rreverser.com/"
47 + },
48 + {
49 + "name": "Adrian Heine",
50 + "url": "http://adrianheine.de"
51 + }
52 + ],
53 + "module": "dist/walk.mjs",
54 + "name": "acorn-walk",
55 + "repository": {
56 + "type": "git",
57 + "url": "git+https://github.com/acornjs/acorn.git"
58 + },
59 + "scripts": {
60 + "prepare": "cd ..; npm run build:walk"
61 + },
62 + "version": "6.1.1"
63 +}
This diff is collapsed. Click to expand it.
1 +Copyright (C) 2012-2018 by various contributors (see AUTHORS)
2 +
3 +Permission is hereby granted, free of charge, to any person obtaining a copy
4 +of this software and associated documentation files (the "Software"), to deal
5 +in the Software without restriction, including without limitation the rights
6 +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 +copies of the Software, and to permit persons to whom the Software is
8 +furnished to do so, subject to the following conditions:
9 +
10 +The above copyright notice and this permission notice shall be included in
11 +all copies or substantial portions of the Software.
12 +
13 +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 +THE SOFTWARE.
This diff is collapsed. Click to expand it.
1 +#!/usr/bin/env node
2 +'use strict';
3 +
4 +require('../dist/bin.js');
1 +export as namespace acorn
2 +export = acorn
3 +
4 +declare namespace acorn {
5 + function parse(input: string, options?: Options): Node
6 +
7 + function parseExpressionAt(input: string, pos?: number, options?: Options): Node
8 +
9 + function tokenizer(input: string, options?: Options): {
10 + getToken(): Token
11 + [Symbol.iterator](): Iterator<Token>
12 + }
13 +
14 + interface Options {
15 + ecmaVersion?: 3 | 5 | 6 | 7 | 8 | 9 | 10 | 2015 | 2016 | 2017 | 2018 | 2019
16 + sourceType?: 'script' | 'module'
17 + onInsertedSemicolon?: (lastTokEnd: number, lastTokEndLoc?: Position) => void
18 + onTrailingComma?: (lastTokEnd: number, lastTokEndLoc?: Position) => void
19 + allowReserved?: boolean
20 + allowReturnOutsideFunction?: boolean
21 + allowImportExportEverywhere?: boolean
22 + allowAwaitOutsideFunction?: boolean
23 + allowHashBang?: boolean
24 + locations?: boolean
25 + onToken?: ((token: Token) => any) | Token[]
26 + onComment?: ((
27 + isBlock: boolean, text: string, start: number, end: number, startLoc?: Position,
28 + endLoc?: Position
29 + ) => void) | Comment[]
30 + ranges?: boolean
31 + program?: Node
32 + sourceFile?: string
33 + directSourceFile?: string
34 + preserveParens?: boolean
35 + }
36 +
37 + class Parser {
38 + constructor(options: Options, input: string, startPos?: number)
39 + parse(): Node
40 + static parse(input: string, options?: Options): Node
41 + static parseExpressionAt(input: string, pos: number, options?: Options): Node
42 + static tokenizer(input: string, options?: Options): {
43 + getToken(): Token
44 + [Symbol.iterator](): Iterator<Token>
45 + }
46 + static extend(...plugins: ((BaseParser: typeof Parser) => typeof Parser)[]): typeof Parser
47 + }
48 +
49 + interface Position { line: number; column: number; offset: number }
50 +
51 + const defaultOptions: Options
52 +
53 + function getLineInfo(input: string, offset: number): Position
54 +
55 + class SourceLocation {
56 + start: Position
57 + end: Position
58 + source?: string | null
59 + constructor(p: Parser, start: Position, end: Position)
60 + }
61 +
62 + class Node {
63 + type: string
64 + start: number
65 + end: number
66 + loc?: SourceLocation
67 + sourceFile?: string
68 + range?: [number, number]
69 + constructor(parser: Parser, pos: number, loc?: SourceLocation)
70 + }
71 +
72 + class TokenType {
73 + label: string
74 + keyword: string
75 + beforeExpr: boolean
76 + startsExpr: boolean
77 + isLoop: boolean
78 + isAssign: boolean
79 + prefix: boolean
80 + postfix: boolean
81 + binop: number
82 + updateContext?: (prevType: TokenType) => void
83 + constructor(label: string, conf?: any)
84 + }
85 +
86 + const tokTypes: {
87 + num: TokenType
88 + regexp: TokenType
89 + string: TokenType
90 + name: TokenType
91 + eof: TokenType
92 + bracketL: TokenType
93 + bracketR: TokenType
94 + braceL: TokenType
95 + braceR: TokenType
96 + parenL: TokenType
97 + parenR: TokenType
98 + comma: TokenType
99 + semi: TokenType
100 + colon: TokenType
101 + dot: TokenType
102 + question: TokenType
103 + arrow: TokenType
104 + template: TokenType
105 + ellipsis: TokenType
106 + backQuote: TokenType
107 + dollarBraceL: TokenType
108 + eq: TokenType
109 + assign: TokenType
110 + incDec: TokenType
111 + prefix: TokenType
112 + logicalOR: TokenType
113 + logicalAND: TokenType
114 + bitwiseOR: TokenType
115 + bitwiseXOR: TokenType
116 + bitwiseAND: TokenType
117 + equality: TokenType
118 + relational: TokenType
119 + bitShift: TokenType
120 + plusMin: TokenType
121 + modulo: TokenType
122 + star: TokenType
123 + slash: TokenType
124 + starstar: TokenType
125 + _break: TokenType
126 + _case: TokenType
127 + _catch: TokenType
128 + _continue: TokenType
129 + _debugger: TokenType
130 + _default: TokenType
131 + _do: TokenType
132 + _else: TokenType
133 + _finally: TokenType
134 + _for: TokenType
135 + _function: TokenType
136 + _if: TokenType
137 + _return: TokenType
138 + _switch: TokenType
139 + _throw: TokenType
140 + _try: TokenType
141 + _var: TokenType
142 + _const: TokenType
143 + _while: TokenType
144 + _with: TokenType
145 + _new: TokenType
146 + _this: TokenType
147 + _super: TokenType
148 + _class: TokenType
149 + _extends: TokenType
150 + _export: TokenType
151 + _import: TokenType
152 + _null: TokenType
153 + _true: TokenType
154 + _false: TokenType
155 + _in: TokenType
156 + _instanceof: TokenType
157 + _typeof: TokenType
158 + _void: TokenType
159 + _delete: TokenType
160 + }
161 +
162 + class TokContext {
163 + constructor(token: string, isExpr: boolean, preserveSpace: boolean, override?: (p: Parser) => void)
164 + }
165 +
166 + const tokContexts: {
167 + b_stat: TokContext
168 + b_expr: TokContext
169 + b_tmpl: TokContext
170 + p_stat: TokContext
171 + p_expr: TokContext
172 + q_tmpl: TokContext
173 + f_expr: TokContext
174 + }
175 +
176 + function isIdentifierStart(code: number, astral?: boolean): boolean
177 +
178 + function isIdentifierChar(code: number, astral?: boolean): boolean
179 +
180 + interface AbstractToken {
181 + }
182 +
183 + interface Comment extends AbstractToken {
184 + type: string
185 + value: string
186 + start: number
187 + end: number
188 + loc?: SourceLocation
189 + range?: [number, number]
190 + }
191 +
192 + class Token {
193 + type: TokenType
194 + value: any
195 + start: number
196 + end: number
197 + loc?: SourceLocation
198 + range?: [number, number]
199 + constructor(p: Parser)
200 + }
201 +
202 + function isNewLine(code: number): boolean
203 +
204 + const lineBreak: RegExp
205 +
206 + const lineBreakG: RegExp
207 +
208 + const version: string
209 +}
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
1 +'use strict';
2 +
3 +var path = require('path');
4 +var fs = require('fs');
5 +var acorn = require('./acorn.js');
6 +
7 +var infile;
8 +var forceFile;
9 +var silent = false;
10 +var compact = false;
11 +var tokenize = false;
12 +var options = {};
13 +
14 +function help(status) {
15 + var print = (status === 0) ? console.log : console.error;
16 + print("usage: " + path.basename(process.argv[1]) + " [--ecma3|--ecma5|--ecma6|--ecma7|--ecma8|--ecma9|...|--ecma2015|--ecma2016|--ecma2017|--ecma2018|...]");
17 + print(" [--tokenize] [--locations] [---allow-hash-bang] [--compact] [--silent] [--module] [--help] [--] [infile]");
18 + process.exit(status);
19 +}
20 +
21 +for (var i = 2; i < process.argv.length; ++i) {
22 + var arg = process.argv[i];
23 + if ((arg === "-" || arg[0] !== "-") && !infile) { infile = arg; }
24 + else if (arg === "--" && !infile && i + 2 === process.argv.length) { forceFile = infile = process.argv[++i]; }
25 + else if (arg === "--locations") { options.locations = true; }
26 + else if (arg === "--allow-hash-bang") { options.allowHashBang = true; }
27 + else if (arg === "--silent") { silent = true; }
28 + else if (arg === "--compact") { compact = true; }
29 + else if (arg === "--help") { help(0); }
30 + else if (arg === "--tokenize") { tokenize = true; }
31 + else if (arg === "--module") { options.sourceType = "module"; }
32 + else {
33 + var match = arg.match(/^--ecma(\d+)$/);
34 + if (match)
35 + { options.ecmaVersion = +match[1]; }
36 + else
37 + { help(1); }
38 + }
39 +}
40 +
41 +function run(code) {
42 + var result;
43 + try {
44 + if (!tokenize) {
45 + result = acorn.parse(code, options);
46 + } else {
47 + result = [];
48 + var tokenizer$$1 = acorn.tokenizer(code, options), token;
49 + do {
50 + token = tokenizer$$1.getToken();
51 + result.push(token);
52 + } while (token.type !== acorn.tokTypes.eof)
53 + }
54 + } catch (e) {
55 + console.error(e.message);
56 + process.exit(1);
57 + }
58 + if (!silent) { console.log(JSON.stringify(result, null, compact ? null : 2)); }
59 +}
60 +
61 +if (forceFile || infile && infile !== "-") {
62 + run(fs.readFileSync(infile, "utf8"));
63 +} else {
64 + var code = "";
65 + process.stdin.resume();
66 + process.stdin.on("data", function (chunk) { return code += chunk; });
67 + process.stdin.on("end", function () { return run(code); });
68 +}
1 +{
2 + "_from": "acorn@^6.1.1",
3 + "_id": "acorn@6.1.1",
4 + "_inBundle": false,
5 + "_integrity": "sha512-jPTiwtOxaHNaAPg/dmrJ/beuzLRnXtB0kQPQ8JpotKJgTB6rX6c8mlf315941pyjBSaPg8NHXS9fhP4u17DpGA==",
6 + "_location": "/acorn",
7 + "_phantomChildren": {},
8 + "_requested": {
9 + "type": "range",
10 + "registry": true,
11 + "raw": "acorn@^6.1.1",
12 + "name": "acorn",
13 + "escapedName": "acorn",
14 + "rawSpec": "^6.1.1",
15 + "saveSpec": null,
16 + "fetchSpec": "^6.1.1"
17 + },
18 + "_requiredBy": [
19 + "/acorn-globals",
20 + "/jsdom"
21 + ],
22 + "_resolved": "https://registry.npmjs.org/acorn/-/acorn-6.1.1.tgz",
23 + "_shasum": "7d25ae05bb8ad1f9b699108e1094ecd7884adc1f",
24 + "_spec": "acorn@^6.1.1",
25 + "_where": "C:\\Users\\김용재\\Desktop\\2019 공부\\Open_Source_project\\node_modules\\jsdom",
26 + "bin": {
27 + "acorn": "./bin/acorn"
28 + },
29 + "bugs": {
30 + "url": "https://github.com/acornjs/acorn/issues"
31 + },
32 + "bundleDependencies": false,
33 + "deprecated": false,
34 + "description": "ECMAScript parser",
35 + "engines": {
36 + "node": ">=0.4.0"
37 + },
38 + "homepage": "https://github.com/acornjs/acorn",
39 + "license": "MIT",
40 + "main": "dist/acorn.js",
41 + "maintainers": [
42 + {
43 + "name": "Marijn Haverbeke",
44 + "email": "marijnh@gmail.com",
45 + "url": "https://marijnhaverbeke.nl"
46 + },
47 + {
48 + "name": "Ingvar Stepanyan",
49 + "email": "me@rreverser.com",
50 + "url": "https://rreverser.com/"
51 + },
52 + {
53 + "name": "Adrian Heine",
54 + "url": "http://adrianheine.de"
55 + }
56 + ],
57 + "module": "dist/acorn.mjs",
58 + "name": "acorn",
59 + "repository": {
60 + "type": "git",
61 + "url": "git+https://github.com/acornjs/acorn.git"
62 + },
63 + "scripts": {
64 + "prepare": "cd ..; npm run build:main && npm run build:bin"
65 + },
66 + "version": "6.1.1"
67 +}
1 +var Ajv = require('ajv');
2 +var ajv = new Ajv({allErrors: true});
3 +
4 +var schema = {
5 + "properties": {
6 + "foo": { "type": "string" },
7 + "bar": { "type": "number", "maximum": 3 }
8 + }
9 +};
10 +
11 +var validate = ajv.compile(schema);
12 +
13 +test({"foo": "abc", "bar": 2});
14 +test({"foo": 2, "bar": 4});
15 +
16 +function test(data) {
17 + var valid = validate(data);
18 + if (valid) console.log('Valid!');
19 + else console.log('Invalid: ' + ajv.errorsText(validate.errors));
20 +}
...\ No newline at end of file ...\ No newline at end of file
1 +The MIT License (MIT)
2 +
3 +Copyright (c) 2015-2017 Evgeny Poberezkin
4 +
5 +Permission is hereby granted, free of charge, to any person obtaining a copy
6 +of this software and associated documentation files (the "Software"), to deal
7 +in the Software without restriction, including without limitation the rights
8 +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 +copies of the Software, and to permit persons to whom the Software is
10 +furnished to do so, subject to the following conditions:
11 +
12 +The above copyright notice and this permission notice shall be included in all
13 +copies or substantial portions of the Software.
14 +
15 +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 +SOFTWARE.
22 +
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
No preview for this file type
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
1 +'use strict';
2 +
3 +
4 +var Cache = module.exports = function Cache() {
5 + this._cache = {};
6 +};
7 +
8 +
9 +Cache.prototype.put = function Cache_put(key, value) {
10 + this._cache[key] = value;
11 +};
12 +
13 +
14 +Cache.prototype.get = function Cache_get(key) {
15 + return this._cache[key];
16 +};
17 +
18 +
19 +Cache.prototype.del = function Cache_del(key) {
20 + delete this._cache[key];
21 +};
22 +
23 +
24 +Cache.prototype.clear = function Cache_clear() {
25 + this._cache = {};
26 +};
1 +'use strict';
2 +
3 +var MissingRefError = require('./error_classes').MissingRef;
4 +
5 +module.exports = compileAsync;
6 +
7 +
8 +/**
9 + * Creates validating function for passed schema with asynchronous loading of missing schemas.
10 + * `loadSchema` option should be a function that accepts schema uri and returns promise that resolves with the schema.
11 + * @this Ajv
12 + * @param {Object} schema schema object
13 + * @param {Boolean} meta optional true to compile meta-schema; this parameter can be skipped
14 + * @param {Function} callback an optional node-style callback, it is called with 2 parameters: error (or null) and validating function.
15 + * @return {Promise} promise that resolves with a validating function.
16 + */
17 +function compileAsync(schema, meta, callback) {
18 + /* eslint no-shadow: 0 */
19 + /* global Promise */
20 + /* jshint validthis: true */
21 + var self = this;
22 + if (typeof this._opts.loadSchema != 'function')
23 + throw new Error('options.loadSchema should be a function');
24 +
25 + if (typeof meta == 'function') {
26 + callback = meta;
27 + meta = undefined;
28 + }
29 +
30 + var p = loadMetaSchemaOf(schema).then(function () {
31 + var schemaObj = self._addSchema(schema, undefined, meta);
32 + return schemaObj.validate || _compileAsync(schemaObj);
33 + });
34 +
35 + if (callback) {
36 + p.then(
37 + function(v) { callback(null, v); },
38 + callback
39 + );
40 + }
41 +
42 + return p;
43 +
44 +
45 + function loadMetaSchemaOf(sch) {
46 + var $schema = sch.$schema;
47 + return $schema && !self.getSchema($schema)
48 + ? compileAsync.call(self, { $ref: $schema }, true)
49 + : Promise.resolve();
50 + }
51 +
52 +
53 + function _compileAsync(schemaObj) {
54 + try { return self._compile(schemaObj); }
55 + catch(e) {
56 + if (e instanceof MissingRefError) return loadMissingSchema(e);
57 + throw e;
58 + }
59 +
60 +
61 + function loadMissingSchema(e) {
62 + var ref = e.missingSchema;
63 + if (added(ref)) throw new Error('Schema ' + ref + ' is loaded but ' + e.missingRef + ' cannot be resolved');
64 +
65 + var schemaPromise = self._loadingSchemas[ref];
66 + if (!schemaPromise) {
67 + schemaPromise = self._loadingSchemas[ref] = self._opts.loadSchema(ref);
68 + schemaPromise.then(removePromise, removePromise);
69 + }
70 +
71 + return schemaPromise.then(function (sch) {
72 + if (!added(ref)) {
73 + return loadMetaSchemaOf(sch).then(function () {
74 + if (!added(ref)) self.addSchema(sch, ref, undefined, meta);
75 + });
76 + }
77 + }).then(function() {
78 + return _compileAsync(schemaObj);
79 + });
80 +
81 + function removePromise() {
82 + delete self._loadingSchemas[ref];
83 + }
84 +
85 + function added(ref) {
86 + return self._refs[ref] || self._schemas[ref];
87 + }
88 + }
89 + }
90 +}
1 +'use strict';
2 +
3 +// do NOT remove this file - it would break pre-compiled schemas
4 +// https://github.com/epoberezkin/ajv/issues/889
5 +module.exports = require('fast-deep-equal');
1 +'use strict';
2 +
3 +var resolve = require('./resolve');
4 +
5 +module.exports = {
6 + Validation: errorSubclass(ValidationError),
7 + MissingRef: errorSubclass(MissingRefError)
8 +};
9 +
10 +
11 +function ValidationError(errors) {
12 + this.message = 'validation failed';
13 + this.errors = errors;
14 + this.ajv = this.validation = true;
15 +}
16 +
17 +
18 +MissingRefError.message = function (baseId, ref) {
19 + return 'can\'t resolve reference ' + ref + ' from id ' + baseId;
20 +};
21 +
22 +
23 +function MissingRefError(baseId, ref, message) {
24 + this.message = message || MissingRefError.message(baseId, ref);
25 + this.missingRef = resolve.url(baseId, ref);
26 + this.missingSchema = resolve.normalizeId(resolve.fullPath(this.missingRef));
27 +}
28 +
29 +
30 +function errorSubclass(Subclass) {
31 + Subclass.prototype = Object.create(Error.prototype);
32 + Subclass.prototype.constructor = Subclass;
33 + return Subclass;
34 +}
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
1 +'use strict';
2 +
3 +var URI = require('uri-js')
4 + , equal = require('fast-deep-equal')
5 + , util = require('./util')
6 + , SchemaObject = require('./schema_obj')
7 + , traverse = require('json-schema-traverse');
8 +
9 +module.exports = resolve;
10 +
11 +resolve.normalizeId = normalizeId;
12 +resolve.fullPath = getFullPath;
13 +resolve.url = resolveUrl;
14 +resolve.ids = resolveIds;
15 +resolve.inlineRef = inlineRef;
16 +resolve.schema = resolveSchema;
17 +
18 +/**
19 + * [resolve and compile the references ($ref)]
20 + * @this Ajv
21 + * @param {Function} compile reference to schema compilation funciton (localCompile)
22 + * @param {Object} root object with information about the root schema for the current schema
23 + * @param {String} ref reference to resolve
24 + * @return {Object|Function} schema object (if the schema can be inlined) or validation function
25 + */
26 +function resolve(compile, root, ref) {
27 + /* jshint validthis: true */
28 + var refVal = this._refs[ref];
29 + if (typeof refVal == 'string') {
30 + if (this._refs[refVal]) refVal = this._refs[refVal];
31 + else return resolve.call(this, compile, root, refVal);
32 + }
33 +
34 + refVal = refVal || this._schemas[ref];
35 + if (refVal instanceof SchemaObject) {
36 + return inlineRef(refVal.schema, this._opts.inlineRefs)
37 + ? refVal.schema
38 + : refVal.validate || this._compile(refVal);
39 + }
40 +
41 + var res = resolveSchema.call(this, root, ref);
42 + var schema, v, baseId;
43 + if (res) {
44 + schema = res.schema;
45 + root = res.root;
46 + baseId = res.baseId;
47 + }
48 +
49 + if (schema instanceof SchemaObject) {
50 + v = schema.validate || compile.call(this, schema.schema, root, undefined, baseId);
51 + } else if (schema !== undefined) {
52 + v = inlineRef(schema, this._opts.inlineRefs)
53 + ? schema
54 + : compile.call(this, schema, root, undefined, baseId);
55 + }
56 +
57 + return v;
58 +}
59 +
60 +
61 +/**
62 + * Resolve schema, its root and baseId
63 + * @this Ajv
64 + * @param {Object} root root object with properties schema, refVal, refs
65 + * @param {String} ref reference to resolve
66 + * @return {Object} object with properties schema, root, baseId
67 + */
68 +function resolveSchema(root, ref) {
69 + /* jshint validthis: true */
70 + var p = URI.parse(ref)
71 + , refPath = _getFullPath(p)
72 + , baseId = getFullPath(this._getId(root.schema));
73 + if (Object.keys(root.schema).length === 0 || refPath !== baseId) {
74 + var id = normalizeId(refPath);
75 + var refVal = this._refs[id];
76 + if (typeof refVal == 'string') {
77 + return resolveRecursive.call(this, root, refVal, p);
78 + } else if (refVal instanceof SchemaObject) {
79 + if (!refVal.validate) this._compile(refVal);
80 + root = refVal;
81 + } else {
82 + refVal = this._schemas[id];
83 + if (refVal instanceof SchemaObject) {
84 + if (!refVal.validate) this._compile(refVal);
85 + if (id == normalizeId(ref))
86 + return { schema: refVal, root: root, baseId: baseId };
87 + root = refVal;
88 + } else {
89 + return;
90 + }
91 + }
92 + if (!root.schema) return;
93 + baseId = getFullPath(this._getId(root.schema));
94 + }
95 + return getJsonPointer.call(this, p, baseId, root.schema, root);
96 +}
97 +
98 +
99 +/* @this Ajv */
100 +function resolveRecursive(root, ref, parsedRef) {
101 + /* jshint validthis: true */
102 + var res = resolveSchema.call(this, root, ref);
103 + if (res) {
104 + var schema = res.schema;
105 + var baseId = res.baseId;
106 + root = res.root;
107 + var id = this._getId(schema);
108 + if (id) baseId = resolveUrl(baseId, id);
109 + return getJsonPointer.call(this, parsedRef, baseId, schema, root);
110 + }
111 +}
112 +
113 +
114 +var PREVENT_SCOPE_CHANGE = util.toHash(['properties', 'patternProperties', 'enum', 'dependencies', 'definitions']);
115 +/* @this Ajv */
116 +function getJsonPointer(parsedRef, baseId, schema, root) {
117 + /* jshint validthis: true */
118 + parsedRef.fragment = parsedRef.fragment || '';
119 + if (parsedRef.fragment.slice(0,1) != '/') return;
120 + var parts = parsedRef.fragment.split('/');
121 +
122 + for (var i = 1; i < parts.length; i++) {
123 + var part = parts[i];
124 + if (part) {
125 + part = util.unescapeFragment(part);
126 + schema = schema[part];
127 + if (schema === undefined) break;
128 + var id;
129 + if (!PREVENT_SCOPE_CHANGE[part]) {
130 + id = this._getId(schema);
131 + if (id) baseId = resolveUrl(baseId, id);
132 + if (schema.$ref) {
133 + var $ref = resolveUrl(baseId, schema.$ref);
134 + var res = resolveSchema.call(this, root, $ref);
135 + if (res) {
136 + schema = res.schema;
137 + root = res.root;
138 + baseId = res.baseId;
139 + }
140 + }
141 + }
142 + }
143 + }
144 + if (schema !== undefined && schema !== root.schema)
145 + return { schema: schema, root: root, baseId: baseId };
146 +}
147 +
148 +
149 +var SIMPLE_INLINED = util.toHash([
150 + 'type', 'format', 'pattern',
151 + 'maxLength', 'minLength',
152 + 'maxProperties', 'minProperties',
153 + 'maxItems', 'minItems',
154 + 'maximum', 'minimum',
155 + 'uniqueItems', 'multipleOf',
156 + 'required', 'enum'
157 +]);
158 +function inlineRef(schema, limit) {
159 + if (limit === false) return false;
160 + if (limit === undefined || limit === true) return checkNoRef(schema);
161 + else if (limit) return countKeys(schema) <= limit;
162 +}
163 +
164 +
165 +function checkNoRef(schema) {
166 + var item;
167 + if (Array.isArray(schema)) {
168 + for (var i=0; i<schema.length; i++) {
169 + item = schema[i];
170 + if (typeof item == 'object' && !checkNoRef(item)) return false;
171 + }
172 + } else {
173 + for (var key in schema) {
174 + if (key == '$ref') return false;
175 + item = schema[key];
176 + if (typeof item == 'object' && !checkNoRef(item)) return false;
177 + }
178 + }
179 + return true;
180 +}
181 +
182 +
183 +function countKeys(schema) {
184 + var count = 0, item;
185 + if (Array.isArray(schema)) {
186 + for (var i=0; i<schema.length; i++) {
187 + item = schema[i];
188 + if (typeof item == 'object') count += countKeys(item);
189 + if (count == Infinity) return Infinity;
190 + }
191 + } else {
192 + for (var key in schema) {
193 + if (key == '$ref') return Infinity;
194 + if (SIMPLE_INLINED[key]) {
195 + count++;
196 + } else {
197 + item = schema[key];
198 + if (typeof item == 'object') count += countKeys(item) + 1;
199 + if (count == Infinity) return Infinity;
200 + }
201 + }
202 + }
203 + return count;
204 +}
205 +
206 +
207 +function getFullPath(id, normalize) {
208 + if (normalize !== false) id = normalizeId(id);
209 + var p = URI.parse(id);
210 + return _getFullPath(p);
211 +}
212 +
213 +
214 +function _getFullPath(p) {
215 + return URI.serialize(p).split('#')[0] + '#';
216 +}
217 +
218 +
219 +var TRAILING_SLASH_HASH = /#\/?$/;
220 +function normalizeId(id) {
221 + return id ? id.replace(TRAILING_SLASH_HASH, '') : '';
222 +}
223 +
224 +
225 +function resolveUrl(baseId, id) {
226 + id = normalizeId(id);
227 + return URI.resolve(baseId, id);
228 +}
229 +
230 +
231 +/* @this Ajv */
232 +function resolveIds(schema) {
233 + var schemaId = normalizeId(this._getId(schema));
234 + var baseIds = {'': schemaId};
235 + var fullPaths = {'': getFullPath(schemaId, false)};
236 + var localRefs = {};
237 + var self = this;
238 +
239 + traverse(schema, {allKeys: true}, function(sch, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex) {
240 + if (jsonPtr === '') return;
241 + var id = self._getId(sch);
242 + var baseId = baseIds[parentJsonPtr];
243 + var fullPath = fullPaths[parentJsonPtr] + '/' + parentKeyword;
244 + if (keyIndex !== undefined)
245 + fullPath += '/' + (typeof keyIndex == 'number' ? keyIndex : util.escapeFragment(keyIndex));
246 +
247 + if (typeof id == 'string') {
248 + id = baseId = normalizeId(baseId ? URI.resolve(baseId, id) : id);
249 +
250 + var refVal = self._refs[id];
251 + if (typeof refVal == 'string') refVal = self._refs[refVal];
252 + if (refVal && refVal.schema) {
253 + if (!equal(sch, refVal.schema))
254 + throw new Error('id "' + id + '" resolves to more than one schema');
255 + } else if (id != normalizeId(fullPath)) {
256 + if (id[0] == '#') {
257 + if (localRefs[id] && !equal(sch, localRefs[id]))
258 + throw new Error('id "' + id + '" resolves to more than one schema');
259 + localRefs[id] = sch;
260 + } else {
261 + self._refs[id] = fullPath;
262 + }
263 + }
264 + }
265 + baseIds[jsonPtr] = baseId;
266 + fullPaths[jsonPtr] = fullPath;
267 + });
268 +
269 + return localRefs;
270 +}
1 +'use strict';
2 +
3 +var ruleModules = require('../dotjs')
4 + , toHash = require('./util').toHash;
5 +
6 +module.exports = function rules() {
7 + var RULES = [
8 + { type: 'number',
9 + rules: [ { 'maximum': ['exclusiveMaximum'] },
10 + { 'minimum': ['exclusiveMinimum'] }, 'multipleOf', 'format'] },
11 + { type: 'string',
12 + rules: [ 'maxLength', 'minLength', 'pattern', 'format' ] },
13 + { type: 'array',
14 + rules: [ 'maxItems', 'minItems', 'items', 'contains', 'uniqueItems' ] },
15 + { type: 'object',
16 + rules: [ 'maxProperties', 'minProperties', 'required', 'dependencies', 'propertyNames',
17 + { 'properties': ['additionalProperties', 'patternProperties'] } ] },
18 + { rules: [ '$ref', 'const', 'enum', 'not', 'anyOf', 'oneOf', 'allOf', 'if' ] }
19 + ];
20 +
21 + var ALL = [ 'type', '$comment' ];
22 + var KEYWORDS = [
23 + '$schema', '$id', 'id', '$data', '$async', 'title',
24 + 'description', 'default', 'definitions',
25 + 'examples', 'readOnly', 'writeOnly',
26 + 'contentMediaType', 'contentEncoding',
27 + 'additionalItems', 'then', 'else'
28 + ];
29 + var TYPES = [ 'number', 'integer', 'string', 'array', 'object', 'boolean', 'null' ];
30 + RULES.all = toHash(ALL);
31 + RULES.types = toHash(TYPES);
32 +
33 + RULES.forEach(function (group) {
34 + group.rules = group.rules.map(function (keyword) {
35 + var implKeywords;
36 + if (typeof keyword == 'object') {
37 + var key = Object.keys(keyword)[0];
38 + implKeywords = keyword[key];
39 + keyword = key;
40 + implKeywords.forEach(function (k) {
41 + ALL.push(k);
42 + RULES.all[k] = true;
43 + });
44 + }
45 + ALL.push(keyword);
46 + var rule = RULES.all[keyword] = {
47 + keyword: keyword,
48 + code: ruleModules[keyword],
49 + implements: implKeywords
50 + };
51 + return rule;
52 + });
53 +
54 + RULES.all.$comment = {
55 + keyword: '$comment',
56 + code: ruleModules.$comment
57 + };
58 +
59 + if (group.type) RULES.types[group.type] = group;
60 + });
61 +
62 + RULES.keywords = toHash(ALL.concat(KEYWORDS));
63 + RULES.custom = {};
64 +
65 + return RULES;
66 +};
1 +'use strict';
2 +
3 +var util = require('./util');
4 +
5 +module.exports = SchemaObject;
6 +
7 +function SchemaObject(obj) {
8 + util.copy(obj, this);
9 +}
1 +'use strict';
2 +
3 +// https://mathiasbynens.be/notes/javascript-encoding
4 +// https://github.com/bestiejs/punycode.js - punycode.ucs2.decode
5 +module.exports = function ucs2length(str) {
6 + var length = 0
7 + , len = str.length
8 + , pos = 0
9 + , value;
10 + while (pos < len) {
11 + length++;
12 + value = str.charCodeAt(pos++);
13 + if (value >= 0xD800 && value <= 0xDBFF && pos < len) {
14 + // high surrogate, and there is a next character
15 + value = str.charCodeAt(pos);
16 + if ((value & 0xFC00) == 0xDC00) pos++; // low surrogate
17 + }
18 + }
19 + return length;
20 +};
1 +'use strict';
2 +
3 +
4 +module.exports = {
5 + copy: copy,
6 + checkDataType: checkDataType,
7 + checkDataTypes: checkDataTypes,
8 + coerceToTypes: coerceToTypes,
9 + toHash: toHash,
10 + getProperty: getProperty,
11 + escapeQuotes: escapeQuotes,
12 + equal: require('fast-deep-equal'),
13 + ucs2length: require('./ucs2length'),
14 + varOccurences: varOccurences,
15 + varReplace: varReplace,
16 + cleanUpCode: cleanUpCode,
17 + finalCleanUpCode: finalCleanUpCode,
18 + schemaHasRules: schemaHasRules,
19 + schemaHasRulesExcept: schemaHasRulesExcept,
20 + schemaUnknownRules: schemaUnknownRules,
21 + toQuotedString: toQuotedString,
22 + getPathExpr: getPathExpr,
23 + getPath: getPath,
24 + getData: getData,
25 + unescapeFragment: unescapeFragment,
26 + unescapeJsonPointer: unescapeJsonPointer,
27 + escapeFragment: escapeFragment,
28 + escapeJsonPointer: escapeJsonPointer
29 +};
30 +
31 +
32 +function copy(o, to) {
33 + to = to || {};
34 + for (var key in o) to[key] = o[key];
35 + return to;
36 +}
37 +
38 +
39 +function checkDataType(dataType, data, negate) {
40 + var EQUAL = negate ? ' !== ' : ' === '
41 + , AND = negate ? ' || ' : ' && '
42 + , OK = negate ? '!' : ''
43 + , NOT = negate ? '' : '!';
44 + switch (dataType) {
45 + case 'null': return data + EQUAL + 'null';
46 + case 'array': return OK + 'Array.isArray(' + data + ')';
47 + case 'object': return '(' + OK + data + AND +
48 + 'typeof ' + data + EQUAL + '"object"' + AND +
49 + NOT + 'Array.isArray(' + data + '))';
50 + case 'integer': return '(typeof ' + data + EQUAL + '"number"' + AND +
51 + NOT + '(' + data + ' % 1)' +
52 + AND + data + EQUAL + data + ')';
53 + default: return 'typeof ' + data + EQUAL + '"' + dataType + '"';
54 + }
55 +}
56 +
57 +
58 +function checkDataTypes(dataTypes, data) {
59 + switch (dataTypes.length) {
60 + case 1: return checkDataType(dataTypes[0], data, true);
61 + default:
62 + var code = '';
63 + var types = toHash(dataTypes);
64 + if (types.array && types.object) {
65 + code = types.null ? '(': '(!' + data + ' || ';
66 + code += 'typeof ' + data + ' !== "object")';
67 + delete types.null;
68 + delete types.array;
69 + delete types.object;
70 + }
71 + if (types.number) delete types.integer;
72 + for (var t in types)
73 + code += (code ? ' && ' : '' ) + checkDataType(t, data, true);
74 +
75 + return code;
76 + }
77 +}
78 +
79 +
80 +var COERCE_TO_TYPES = toHash([ 'string', 'number', 'integer', 'boolean', 'null' ]);
81 +function coerceToTypes(optionCoerceTypes, dataTypes) {
82 + if (Array.isArray(dataTypes)) {
83 + var types = [];
84 + for (var i=0; i<dataTypes.length; i++) {
85 + var t = dataTypes[i];
86 + if (COERCE_TO_TYPES[t]) types[types.length] = t;
87 + else if (optionCoerceTypes === 'array' && t === 'array') types[types.length] = t;
88 + }
89 + if (types.length) return types;
90 + } else if (COERCE_TO_TYPES[dataTypes]) {
91 + return [dataTypes];
92 + } else if (optionCoerceTypes === 'array' && dataTypes === 'array') {
93 + return ['array'];
94 + }
95 +}
96 +
97 +
98 +function toHash(arr) {
99 + var hash = {};
100 + for (var i=0; i<arr.length; i++) hash[arr[i]] = true;
101 + return hash;
102 +}
103 +
104 +
105 +var IDENTIFIER = /^[a-z$_][a-z$_0-9]*$/i;
106 +var SINGLE_QUOTE = /'|\\/g;
107 +function getProperty(key) {
108 + return typeof key == 'number'
109 + ? '[' + key + ']'
110 + : IDENTIFIER.test(key)
111 + ? '.' + key
112 + : "['" + escapeQuotes(key) + "']";
113 +}
114 +
115 +
116 +function escapeQuotes(str) {
117 + return str.replace(SINGLE_QUOTE, '\\$&')
118 + .replace(/\n/g, '\\n')
119 + .replace(/\r/g, '\\r')
120 + .replace(/\f/g, '\\f')
121 + .replace(/\t/g, '\\t');
122 +}
123 +
124 +
125 +function varOccurences(str, dataVar) {
126 + dataVar += '[^0-9]';
127 + var matches = str.match(new RegExp(dataVar, 'g'));
128 + return matches ? matches.length : 0;
129 +}
130 +
131 +
132 +function varReplace(str, dataVar, expr) {
133 + dataVar += '([^0-9])';
134 + expr = expr.replace(/\$/g, '$$$$');
135 + return str.replace(new RegExp(dataVar, 'g'), expr + '$1');
136 +}
137 +
138 +
139 +var EMPTY_ELSE = /else\s*{\s*}/g
140 + , EMPTY_IF_NO_ELSE = /if\s*\([^)]+\)\s*\{\s*\}(?!\s*else)/g
141 + , EMPTY_IF_WITH_ELSE = /if\s*\(([^)]+)\)\s*\{\s*\}\s*else(?!\s*if)/g;
142 +function cleanUpCode(out) {
143 + return out.replace(EMPTY_ELSE, '')
144 + .replace(EMPTY_IF_NO_ELSE, '')
145 + .replace(EMPTY_IF_WITH_ELSE, 'if (!($1))');
146 +}
147 +
148 +
149 +var ERRORS_REGEXP = /[^v.]errors/g
150 + , REMOVE_ERRORS = /var errors = 0;|var vErrors = null;|validate.errors = vErrors;/g
151 + , REMOVE_ERRORS_ASYNC = /var errors = 0;|var vErrors = null;/g
152 + , RETURN_VALID = 'return errors === 0;'
153 + , RETURN_TRUE = 'validate.errors = null; return true;'
154 + , RETURN_ASYNC = /if \(errors === 0\) return data;\s*else throw new ValidationError\(vErrors\);/
155 + , RETURN_DATA_ASYNC = 'return data;'
156 + , ROOTDATA_REGEXP = /[^A-Za-z_$]rootData[^A-Za-z0-9_$]/g
157 + , REMOVE_ROOTDATA = /if \(rootData === undefined\) rootData = data;/;
158 +
159 +function finalCleanUpCode(out, async) {
160 + var matches = out.match(ERRORS_REGEXP);
161 + if (matches && matches.length == 2) {
162 + out = async
163 + ? out.replace(REMOVE_ERRORS_ASYNC, '')
164 + .replace(RETURN_ASYNC, RETURN_DATA_ASYNC)
165 + : out.replace(REMOVE_ERRORS, '')
166 + .replace(RETURN_VALID, RETURN_TRUE);
167 + }
168 +
169 + matches = out.match(ROOTDATA_REGEXP);
170 + if (!matches || matches.length !== 3) return out;
171 + return out.replace(REMOVE_ROOTDATA, '');
172 +}
173 +
174 +
175 +function schemaHasRules(schema, rules) {
176 + if (typeof schema == 'boolean') return !schema;
177 + for (var key in schema) if (rules[key]) return true;
178 +}
179 +
180 +
181 +function schemaHasRulesExcept(schema, rules, exceptKeyword) {
182 + if (typeof schema == 'boolean') return !schema && exceptKeyword != 'not';
183 + for (var key in schema) if (key != exceptKeyword && rules[key]) return true;
184 +}
185 +
186 +
187 +function schemaUnknownRules(schema, rules) {
188 + if (typeof schema == 'boolean') return;
189 + for (var key in schema) if (!rules[key]) return key;
190 +}
191 +
192 +
193 +function toQuotedString(str) {
194 + return '\'' + escapeQuotes(str) + '\'';
195 +}
196 +
197 +
198 +function getPathExpr(currentPath, expr, jsonPointers, isNumber) {
199 + var path = jsonPointers // false by default
200 + ? '\'/\' + ' + expr + (isNumber ? '' : '.replace(/~/g, \'~0\').replace(/\\//g, \'~1\')')
201 + : (isNumber ? '\'[\' + ' + expr + ' + \']\'' : '\'[\\\'\' + ' + expr + ' + \'\\\']\'');
202 + return joinPaths(currentPath, path);
203 +}
204 +
205 +
206 +function getPath(currentPath, prop, jsonPointers) {
207 + var path = jsonPointers // false by default
208 + ? toQuotedString('/' + escapeJsonPointer(prop))
209 + : toQuotedString(getProperty(prop));
210 + return joinPaths(currentPath, path);
211 +}
212 +
213 +
214 +var JSON_POINTER = /^\/(?:[^~]|~0|~1)*$/;
215 +var RELATIVE_JSON_POINTER = /^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;
216 +function getData($data, lvl, paths) {
217 + var up, jsonPointer, data, matches;
218 + if ($data === '') return 'rootData';
219 + if ($data[0] == '/') {
220 + if (!JSON_POINTER.test($data)) throw new Error('Invalid JSON-pointer: ' + $data);
221 + jsonPointer = $data;
222 + data = 'rootData';
223 + } else {
224 + matches = $data.match(RELATIVE_JSON_POINTER);
225 + if (!matches) throw new Error('Invalid JSON-pointer: ' + $data);
226 + up = +matches[1];
227 + jsonPointer = matches[2];
228 + if (jsonPointer == '#') {
229 + if (up >= lvl) throw new Error('Cannot access property/index ' + up + ' levels up, current level is ' + lvl);
230 + return paths[lvl - up];
231 + }
232 +
233 + if (up > lvl) throw new Error('Cannot access data ' + up + ' levels up, current level is ' + lvl);
234 + data = 'data' + ((lvl - up) || '');
235 + if (!jsonPointer) return data;
236 + }
237 +
238 + var expr = data;
239 + var segments = jsonPointer.split('/');
240 + for (var i=0; i<segments.length; i++) {
241 + var segment = segments[i];
242 + if (segment) {
243 + data += getProperty(unescapeJsonPointer(segment));
244 + expr += ' && ' + data;
245 + }
246 + }
247 + return expr;
248 +}
249 +
250 +
251 +function joinPaths (a, b) {
252 + if (a == '""') return b;
253 + return (a + ' + ' + b).replace(/' \+ '/g, '');
254 +}
255 +
256 +
257 +function unescapeFragment(str) {
258 + return unescapeJsonPointer(decodeURIComponent(str));
259 +}
260 +
261 +
262 +function escapeFragment(str) {
263 + return encodeURIComponent(escapeJsonPointer(str));
264 +}
265 +
266 +
267 +function escapeJsonPointer(str) {
268 + return str.replace(/~/g, '~0').replace(/\//g, '~1');
269 +}
270 +
271 +
272 +function unescapeJsonPointer(str) {
273 + return str.replace(/~1/g, '/').replace(/~0/g, '~');
274 +}
1 +'use strict';
2 +
3 +var KEYWORDS = [
4 + 'multipleOf',
5 + 'maximum',
6 + 'exclusiveMaximum',
7 + 'minimum',
8 + 'exclusiveMinimum',
9 + 'maxLength',
10 + 'minLength',
11 + 'pattern',
12 + 'additionalItems',
13 + 'maxItems',
14 + 'minItems',
15 + 'uniqueItems',
16 + 'maxProperties',
17 + 'minProperties',
18 + 'required',
19 + 'additionalProperties',
20 + 'enum',
21 + 'format',
22 + 'const'
23 +];
24 +
25 +module.exports = function (metaSchema, keywordsJsonPointers) {
26 + for (var i=0; i<keywordsJsonPointers.length; i++) {
27 + metaSchema = JSON.parse(JSON.stringify(metaSchema));
28 + var segments = keywordsJsonPointers[i].split('/');
29 + var keywords = metaSchema;
30 + var j;
31 + for (j=1; j<segments.length; j++)
32 + keywords = keywords[segments[j]];
33 +
34 + for (j=0; j<KEYWORDS.length; j++) {
35 + var key = KEYWORDS[j];
36 + var schema = keywords[key];
37 + if (schema) {
38 + keywords[key] = {
39 + anyOf: [
40 + schema,
41 + { $ref: 'https://raw.githubusercontent.com/epoberezkin/ajv/master/lib/refs/data.json#' }
42 + ]
43 + };
44 + }
45 + }
46 + }
47 +
48 + return metaSchema;
49 +};
1 +{{# def.definitions }}
2 +{{# def.errors }}
3 +{{# def.setupKeyword }}
4 +{{# def.$data }}
5 +
6 +{{## def.setExclusiveLimit:
7 + $exclusive = true;
8 + $errorKeyword = $exclusiveKeyword;
9 + $errSchemaPath = it.errSchemaPath + '/' + $exclusiveKeyword;
10 +#}}
11 +
12 +{{
13 + var $isMax = $keyword == 'maximum'
14 + , $exclusiveKeyword = $isMax ? 'exclusiveMaximum' : 'exclusiveMinimum'
15 + , $schemaExcl = it.schema[$exclusiveKeyword]
16 + , $isDataExcl = it.opts.$data && $schemaExcl && $schemaExcl.$data
17 + , $op = $isMax ? '<' : '>'
18 + , $notOp = $isMax ? '>' : '<'
19 + , $errorKeyword = undefined;
20 +}}
21 +
22 +{{? $isDataExcl }}
23 + {{
24 + var $schemaValueExcl = it.util.getData($schemaExcl.$data, $dataLvl, it.dataPathArr)
25 + , $exclusive = 'exclusive' + $lvl
26 + , $exclType = 'exclType' + $lvl
27 + , $exclIsNumber = 'exclIsNumber' + $lvl
28 + , $opExpr = 'op' + $lvl
29 + , $opStr = '\' + ' + $opExpr + ' + \'';
30 + }}
31 + var schemaExcl{{=$lvl}} = {{=$schemaValueExcl}};
32 + {{ $schemaValueExcl = 'schemaExcl' + $lvl; }}
33 +
34 + var {{=$exclusive}};
35 + var {{=$exclType}} = typeof {{=$schemaValueExcl}};
36 + if ({{=$exclType}} != 'boolean' && {{=$exclType}} != 'undefined' && {{=$exclType}} != 'number') {
37 + {{ var $errorKeyword = $exclusiveKeyword; }}
38 + {{# def.error:'_exclusiveLimit' }}
39 + } else if ({{# def.$dataNotType:'number' }}
40 + {{=$exclType}} == 'number'
41 + ? (
42 + ({{=$exclusive}} = {{=$schemaValue}} === undefined || {{=$schemaValueExcl}} {{=$op}}= {{=$schemaValue}})
43 + ? {{=$data}} {{=$notOp}}= {{=$schemaValueExcl}}
44 + : {{=$data}} {{=$notOp}} {{=$schemaValue}}
45 + )
46 + : (
47 + ({{=$exclusive}} = {{=$schemaValueExcl}} === true)
48 + ? {{=$data}} {{=$notOp}}= {{=$schemaValue}}
49 + : {{=$data}} {{=$notOp}} {{=$schemaValue}}
50 + )
51 + || {{=$data}} !== {{=$data}}) {
52 + var op{{=$lvl}} = {{=$exclusive}} ? '{{=$op}}' : '{{=$op}}=';
53 + {{
54 + if ($schema === undefined) {
55 + $errorKeyword = $exclusiveKeyword;
56 + $errSchemaPath = it.errSchemaPath + '/' + $exclusiveKeyword;
57 + $schemaValue = $schemaValueExcl;
58 + $isData = $isDataExcl;
59 + }
60 + }}
61 +{{??}}
62 + {{
63 + var $exclIsNumber = typeof $schemaExcl == 'number'
64 + , $opStr = $op; /*used in error*/
65 + }}
66 +
67 + {{? $exclIsNumber && $isData }}
68 + {{ var $opExpr = '\'' + $opStr + '\''; /*used in error*/ }}
69 + if ({{# def.$dataNotType:'number' }}
70 + ( {{=$schemaValue}} === undefined
71 + || {{=$schemaExcl}} {{=$op}}= {{=$schemaValue}}
72 + ? {{=$data}} {{=$notOp}}= {{=$schemaExcl}}
73 + : {{=$data}} {{=$notOp}} {{=$schemaValue}} )
74 + || {{=$data}} !== {{=$data}}) {
75 + {{??}}
76 + {{
77 + if ($exclIsNumber && $schema === undefined) {
78 + {{# def.setExclusiveLimit }}
79 + $schemaValue = $schemaExcl;
80 + $notOp += '=';
81 + } else {
82 + if ($exclIsNumber)
83 + $schemaValue = Math[$isMax ? 'min' : 'max']($schemaExcl, $schema);
84 +
85 + if ($schemaExcl === ($exclIsNumber ? $schemaValue : true)) {
86 + {{# def.setExclusiveLimit }}
87 + $notOp += '=';
88 + } else {
89 + $exclusive = false;
90 + $opStr += '=';
91 + }
92 + }
93 +
94 + var $opExpr = '\'' + $opStr + '\''; /*used in error*/
95 + }}
96 +
97 + if ({{# def.$dataNotType:'number' }}
98 + {{=$data}} {{=$notOp}} {{=$schemaValue}}
99 + || {{=$data}} !== {{=$data}}) {
100 + {{?}}
101 +{{?}}
102 + {{ $errorKeyword = $errorKeyword || $keyword; }}
103 + {{# def.error:'_limit' }}
104 + } {{? $breakOnError }} else { {{?}}
1 +{{# def.definitions }}
2 +{{# def.errors }}
3 +{{# def.setupKeyword }}
4 +{{# def.$data }}
5 +
6 +{{ var $op = $keyword == 'maxItems' ? '>' : '<'; }}
7 +if ({{# def.$dataNotType:'number' }} {{=$data}}.length {{=$op}} {{=$schemaValue}}) {
8 + {{ var $errorKeyword = $keyword; }}
9 + {{# def.error:'_limitItems' }}
10 +} {{? $breakOnError }} else { {{?}}
1 +{{# def.definitions }}
2 +{{# def.errors }}
3 +{{# def.setupKeyword }}
4 +{{# def.$data }}
5 +
6 +{{ var $op = $keyword == 'maxLength' ? '>' : '<'; }}
7 +if ({{# def.$dataNotType:'number' }} {{# def.strLength }} {{=$op}} {{=$schemaValue}}) {
8 + {{ var $errorKeyword = $keyword; }}
9 + {{# def.error:'_limitLength' }}
10 +} {{? $breakOnError }} else { {{?}}
1 +{{# def.definitions }}
2 +{{# def.errors }}
3 +{{# def.setupKeyword }}
4 +{{# def.$data }}
5 +
6 +{{ var $op = $keyword == 'maxProperties' ? '>' : '<'; }}
7 +if ({{# def.$dataNotType:'number' }} Object.keys({{=$data}}).length {{=$op}} {{=$schemaValue}}) {
8 + {{ var $errorKeyword = $keyword; }}
9 + {{# def.error:'_limitProperties' }}
10 +} {{? $breakOnError }} else { {{?}}
1 +{{# def.definitions }}
2 +{{# def.errors }}
3 +{{# def.setupKeyword }}
4 +{{# def.setupNextLevel }}
5 +
6 +{{
7 + var $currentBaseId = $it.baseId
8 + , $allSchemasEmpty = true;
9 +}}
10 +
11 +{{~ $schema:$sch:$i }}
12 + {{? {{# def.nonEmptySchema:$sch }} }}
13 + {{
14 + $allSchemasEmpty = false;
15 + $it.schema = $sch;
16 + $it.schemaPath = $schemaPath + '[' + $i + ']';
17 + $it.errSchemaPath = $errSchemaPath + '/' + $i;
18 + }}
19 +
20 + {{# def.insertSubschemaCode }}
21 +
22 + {{# def.ifResultValid }}
23 + {{?}}
24 +{{~}}
25 +
26 +{{? $breakOnError }}
27 + {{? $allSchemasEmpty }}
28 + if (true) {
29 + {{??}}
30 + {{= $closingBraces.slice(0,-1) }}
31 + {{?}}
32 +{{?}}
33 +
34 +{{# def.cleanUp }}
1 +{{# def.definitions }}
2 +{{# def.errors }}
3 +{{# def.setupKeyword }}
4 +{{# def.setupNextLevel }}
5 +
6 +{{
7 + var $noEmptySchema = $schema.every(function($sch) {
8 + return {{# def.nonEmptySchema:$sch }};
9 + });
10 +}}
11 +{{? $noEmptySchema }}
12 + {{ var $currentBaseId = $it.baseId; }}
13 + var {{=$errs}} = errors;
14 + var {{=$valid}} = false;
15 +
16 + {{# def.setCompositeRule }}
17 +
18 + {{~ $schema:$sch:$i }}
19 + {{
20 + $it.schema = $sch;
21 + $it.schemaPath = $schemaPath + '[' + $i + ']';
22 + $it.errSchemaPath = $errSchemaPath + '/' + $i;
23 + }}
24 +
25 + {{# def.insertSubschemaCode }}
26 +
27 + {{=$valid}} = {{=$valid}} || {{=$nextValid}};
28 +
29 + if (!{{=$valid}}) {
30 + {{ $closingBraces += '}'; }}
31 + {{~}}
32 +
33 + {{# def.resetCompositeRule }}
34 +
35 + {{= $closingBraces }}
36 +
37 + if (!{{=$valid}}) {
38 + {{# def.extraError:'anyOf' }}
39 + } else {
40 + {{# def.resetErrors }}
41 + {{? it.opts.allErrors }} } {{?}}
42 +
43 + {{# def.cleanUp }}
44 +{{??}}
45 + {{? $breakOnError }}
46 + if (true) {
47 + {{?}}
48 +{{?}}
1 +{{## def.coerceType:
2 + {{
3 + var $dataType = 'dataType' + $lvl
4 + , $coerced = 'coerced' + $lvl;
5 + }}
6 + var {{=$dataType}} = typeof {{=$data}};
7 + {{? it.opts.coerceTypes == 'array'}}
8 + if ({{=$dataType}} == 'object' && Array.isArray({{=$data}})) {{=$dataType}} = 'array';
9 + {{?}}
10 +
11 + var {{=$coerced}} = undefined;
12 +
13 + {{ var $bracesCoercion = ''; }}
14 + {{~ $coerceToTypes:$type:$i }}
15 + {{? $i }}
16 + if ({{=$coerced}} === undefined) {
17 + {{ $bracesCoercion += '}'; }}
18 + {{?}}
19 +
20 + {{? it.opts.coerceTypes == 'array' && $type != 'array' }}
21 + if ({{=$dataType}} == 'array' && {{=$data}}.length == 1) {
22 + {{=$coerced}} = {{=$data}} = {{=$data}}[0];
23 + {{=$dataType}} = typeof {{=$data}};
24 + /*if ({{=$dataType}} == 'object' && Array.isArray({{=$data}})) {{=$dataType}} = 'array';*/
25 + }
26 + {{?}}
27 +
28 + {{? $type == 'string' }}
29 + if ({{=$dataType}} == 'number' || {{=$dataType}} == 'boolean')
30 + {{=$coerced}} = '' + {{=$data}};
31 + else if ({{=$data}} === null) {{=$coerced}} = '';
32 + {{?? $type == 'number' || $type == 'integer' }}
33 + if ({{=$dataType}} == 'boolean' || {{=$data}} === null
34 + || ({{=$dataType}} == 'string' && {{=$data}} && {{=$data}} == +{{=$data}}
35 + {{? $type == 'integer' }} && !({{=$data}} % 1){{?}}))
36 + {{=$coerced}} = +{{=$data}};
37 + {{?? $type == 'boolean' }}
38 + if ({{=$data}} === 'false' || {{=$data}} === 0 || {{=$data}} === null)
39 + {{=$coerced}} = false;
40 + else if ({{=$data}} === 'true' || {{=$data}} === 1)
41 + {{=$coerced}} = true;
42 + {{?? $type == 'null' }}
43 + if ({{=$data}} === '' || {{=$data}} === 0 || {{=$data}} === false)
44 + {{=$coerced}} = null;
45 + {{?? it.opts.coerceTypes == 'array' && $type == 'array' }}
46 + if ({{=$dataType}} == 'string' || {{=$dataType}} == 'number' || {{=$dataType}} == 'boolean' || {{=$data}} == null)
47 + {{=$coerced}} = [{{=$data}}];
48 + {{?}}
49 + {{~}}
50 +
51 + {{= $bracesCoercion }}
52 +
53 + if ({{=$coerced}} === undefined) {
54 + {{# def.error:'type' }}
55 + } else {
56 + {{# def.setParentData }}
57 + {{=$data}} = {{=$coerced}};
58 + {{? !$dataLvl }}if ({{=$parentData}} !== undefined){{?}}
59 + {{=$parentData}}[{{=$parentDataProperty}}] = {{=$coerced}};
60 + }
61 +#}}
1 +{{# def.definitions }}
2 +{{# def.setupKeyword }}
3 +
4 +{{ var $comment = it.util.toQuotedString($schema); }}
5 +{{? it.opts.$comment === true }}
6 + console.log({{=$comment}});
7 +{{?? typeof it.opts.$comment == 'function' }}
8 + self._opts.$comment({{=$comment}}, {{=it.util.toQuotedString($errSchemaPath)}}, validate.root.schema);
9 +{{?}}
1 +{{# def.definitions }}
2 +{{# def.errors }}
3 +{{# def.setupKeyword }}
4 +{{# def.$data }}
5 +
6 +{{? !$isData }}
7 + var schema{{=$lvl}} = validate.schema{{=$schemaPath}};
8 +{{?}}
9 +var {{=$valid}} = equal({{=$data}}, schema{{=$lvl}});
10 +{{# def.checkError:'const' }}
11 +{{? $breakOnError }} else { {{?}}
1 +{{# def.definitions }}
2 +{{# def.errors }}
3 +{{# def.setupKeyword }}
4 +{{# def.setupNextLevel }}
5 +
6 +
7 +{{
8 + var $idx = 'i' + $lvl
9 + , $dataNxt = $it.dataLevel = it.dataLevel + 1
10 + , $nextData = 'data' + $dataNxt
11 + , $currentBaseId = it.baseId
12 + , $nonEmptySchema = {{# def.nonEmptySchema:$schema }};
13 +}}
14 +
15 +var {{=$errs}} = errors;
16 +var {{=$valid}};
17 +
18 +{{? $nonEmptySchema }}
19 + {{# def.setCompositeRule }}
20 +
21 + {{
22 + $it.schema = $schema;
23 + $it.schemaPath = $schemaPath;
24 + $it.errSchemaPath = $errSchemaPath;
25 + }}
26 +
27 + var {{=$nextValid}} = false;
28 +
29 + for (var {{=$idx}} = 0; {{=$idx}} < {{=$data}}.length; {{=$idx}}++) {
30 + {{
31 + $it.errorPath = it.util.getPathExpr(it.errorPath, $idx, it.opts.jsonPointers, true);
32 + var $passData = $data + '[' + $idx + ']';
33 + $it.dataPathArr[$dataNxt] = $idx;
34 + }}
35 +
36 + {{# def.generateSubschemaCode }}
37 + {{# def.optimizeValidate }}
38 +
39 + if ({{=$nextValid}}) break;
40 + }
41 +
42 + {{# def.resetCompositeRule }}
43 + {{= $closingBraces }}
44 +
45 + if (!{{=$nextValid}}) {
46 +{{??}}
47 + if ({{=$data}}.length == 0) {
48 +{{?}}
49 +
50 + {{# def.error:'contains' }}
51 + } else {
52 + {{? $nonEmptySchema }}
53 + {{# def.resetErrors }}
54 + {{?}}
55 + {{? it.opts.allErrors }} } {{?}}
56 +
57 +{{# def.cleanUp }}
1 +{{# def.definitions }}
2 +{{# def.errors }}
3 +{{# def.setupKeyword }}
4 +{{# def.$data }}
5 +
6 +{{
7 + var $rule = this
8 + , $definition = 'definition' + $lvl
9 + , $rDef = $rule.definition
10 + , $closingBraces = '';
11 + var $validate = $rDef.validate;
12 + var $compile, $inline, $macro, $ruleValidate, $validateCode;
13 +}}
14 +
15 +{{? $isData && $rDef.$data }}
16 + {{
17 + $validateCode = 'keywordValidate' + $lvl;
18 + var $validateSchema = $rDef.validateSchema;
19 + }}
20 + var {{=$definition}} = RULES.custom['{{=$keyword}}'].definition;
21 + var {{=$validateCode}} = {{=$definition}}.validate;
22 +{{??}}
23 + {{
24 + $ruleValidate = it.useCustomRule($rule, $schema, it.schema, it);
25 + if (!$ruleValidate) return;
26 + $schemaValue = 'validate.schema' + $schemaPath;
27 + $validateCode = $ruleValidate.code;
28 + $compile = $rDef.compile;
29 + $inline = $rDef.inline;
30 + $macro = $rDef.macro;
31 + }}
32 +{{?}}
33 +
34 +{{
35 + var $ruleErrs = $validateCode + '.errors'
36 + , $i = 'i' + $lvl
37 + , $ruleErr = 'ruleErr' + $lvl
38 + , $asyncKeyword = $rDef.async;
39 +
40 + if ($asyncKeyword && !it.async)
41 + throw new Error('async keyword in sync schema');
42 +}}
43 +
44 +
45 +{{? !($inline || $macro) }}{{=$ruleErrs}} = null;{{?}}
46 +var {{=$errs}} = errors;
47 +var {{=$valid}};
48 +
49 +{{## def.callRuleValidate:
50 + {{=$validateCode}}.call(
51 + {{? it.opts.passContext }}this{{??}}self{{?}}
52 + {{? $compile || $rDef.schema === false }}
53 + , {{=$data}}
54 + {{??}}
55 + , {{=$schemaValue}}
56 + , {{=$data}}
57 + , validate.schema{{=it.schemaPath}}
58 + {{?}}
59 + , {{# def.dataPath }}
60 + {{# def.passParentData }}
61 + , rootData
62 + )
63 +#}}
64 +
65 +{{## def.extendErrors:_inline:
66 + for (var {{=$i}}={{=$errs}}; {{=$i}}<errors; {{=$i}}++) {
67 + var {{=$ruleErr}} = vErrors[{{=$i}}];
68 + if ({{=$ruleErr}}.dataPath === undefined)
69 + {{=$ruleErr}}.dataPath = (dataPath || '') + {{= it.errorPath }};
70 + {{# _inline ? 'if (\{\{=$ruleErr\}\}.schemaPath === undefined) {' : '' }}
71 + {{=$ruleErr}}.schemaPath = "{{=$errSchemaPath}}";
72 + {{# _inline ? '}' : '' }}
73 + {{? it.opts.verbose }}
74 + {{=$ruleErr}}.schema = {{=$schemaValue}};
75 + {{=$ruleErr}}.data = {{=$data}};
76 + {{?}}
77 + }
78 +#}}
79 +
80 +
81 +{{? $isData && $rDef.$data }}
82 + {{ $closingBraces += '}'; }}
83 + if ({{=$schemaValue}} === undefined) {
84 + {{=$valid}} = true;
85 + } else {
86 + {{? $validateSchema }}
87 + {{ $closingBraces += '}'; }}
88 + {{=$valid}} = {{=$definition}}.validateSchema({{=$schemaValue}});
89 + if ({{=$valid}}) {
90 + {{?}}
91 +{{?}}
92 +
93 +{{? $inline }}
94 + {{? $rDef.statements }}
95 + {{= $ruleValidate.validate }}
96 + {{??}}
97 + {{=$valid}} = {{= $ruleValidate.validate }};
98 + {{?}}
99 +{{?? $macro }}
100 + {{# def.setupNextLevel }}
101 + {{
102 + $it.schema = $ruleValidate.validate;
103 + $it.schemaPath = '';
104 + }}
105 + {{# def.setCompositeRule }}
106 + {{ var $code = it.validate($it).replace(/validate\.schema/g, $validateCode); }}
107 + {{# def.resetCompositeRule }}
108 + {{= $code }}
109 +{{??}}
110 + {{# def.beginDefOut}}
111 + {{# def.callRuleValidate }}
112 + {{# def.storeDefOut:def_callRuleValidate }}
113 +
114 + {{? $rDef.errors === false }}
115 + {{=$valid}} = {{? $asyncKeyword }}await {{?}}{{= def_callRuleValidate }};
116 + {{??}}
117 + {{? $asyncKeyword }}
118 + {{ $ruleErrs = 'customErrors' + $lvl; }}
119 + var {{=$ruleErrs}} = null;
120 + try {
121 + {{=$valid}} = await {{= def_callRuleValidate }};
122 + } catch (e) {
123 + {{=$valid}} = false;
124 + if (e instanceof ValidationError) {{=$ruleErrs}} = e.errors;
125 + else throw e;
126 + }
127 + {{??}}
128 + {{=$ruleErrs}} = null;
129 + {{=$valid}} = {{= def_callRuleValidate }};
130 + {{?}}
131 + {{?}}
132 +{{?}}
133 +
134 +{{? $rDef.modifying }}
135 + if ({{=$parentData}}) {{=$data}} = {{=$parentData}}[{{=$parentDataProperty}}];
136 +{{?}}
137 +
138 +{{= $closingBraces }}
139 +
140 +{{## def.notValidationResult:
141 + {{? $rDef.valid === undefined }}
142 + !{{? $macro }}{{=$nextValid}}{{??}}{{=$valid}}{{?}}
143 + {{??}}
144 + {{= !$rDef.valid }}
145 + {{?}}
146 +#}}
147 +
148 +{{? $rDef.valid }}
149 + {{? $breakOnError }} if (true) { {{?}}
150 +{{??}}
151 + if ({{# def.notValidationResult }}) {
152 + {{ $errorKeyword = $rule.keyword; }}
153 + {{# def.beginDefOut}}
154 + {{# def.error:'custom' }}
155 + {{# def.storeDefOut:def_customError }}
156 +
157 + {{? $inline }}
158 + {{? $rDef.errors }}
159 + {{? $rDef.errors != 'full' }}
160 + {{# def.extendErrors:true }}
161 + {{?}}
162 + {{??}}
163 + {{? $rDef.errors === false}}
164 + {{= def_customError }}
165 + {{??}}
166 + if ({{=$errs}} == errors) {
167 + {{= def_customError }}
168 + } else {
169 + {{# def.extendErrors:true }}
170 + }
171 + {{?}}
172 + {{?}}
173 + {{?? $macro }}
174 + {{# def.extraError:'custom' }}
175 + {{??}}
176 + {{? $rDef.errors === false}}
177 + {{= def_customError }}
178 + {{??}}
179 + if (Array.isArray({{=$ruleErrs}})) {
180 + if (vErrors === null) vErrors = {{=$ruleErrs}};
181 + else vErrors = vErrors.concat({{=$ruleErrs}});
182 + errors = vErrors.length;
183 + {{# def.extendErrors:false }}
184 + } else {
185 + {{= def_customError }}
186 + }
187 + {{?}}
188 + {{?}}
189 +
190 + } {{? $breakOnError }} else { {{?}}
191 +{{?}}
1 +{{## def.assignDefault:
2 + {{? it.compositeRule }}
3 + {{
4 + if (it.opts.strictDefaults) {
5 + var $defaultMsg = 'default is ignored for: ' + $passData;
6 + if (it.opts.strictDefaults === 'log') it.logger.warn($defaultMsg);
7 + else throw new Error($defaultMsg);
8 + }
9 + }}
10 + {{??}}
11 + if ({{=$passData}} === undefined
12 + {{? it.opts.useDefaults == 'empty' }}
13 + || {{=$passData}} === null
14 + || {{=$passData}} === ''
15 + {{?}}
16 + )
17 + {{=$passData}} = {{? it.opts.useDefaults == 'shared' }}
18 + {{= it.useDefault($sch.default) }}
19 + {{??}}
20 + {{= JSON.stringify($sch.default) }}
21 + {{?}};
22 + {{?}}
23 +#}}
24 +
25 +
26 +{{## def.defaultProperties:
27 + {{
28 + var $schema = it.schema.properties
29 + , $schemaKeys = Object.keys($schema); }}
30 + {{~ $schemaKeys:$propertyKey }}
31 + {{ var $sch = $schema[$propertyKey]; }}
32 + {{? $sch.default !== undefined }}
33 + {{ var $passData = $data + it.util.getProperty($propertyKey); }}
34 + {{# def.assignDefault }}
35 + {{?}}
36 + {{~}}
37 +#}}
38 +
39 +
40 +{{## def.defaultItems:
41 + {{~ it.schema.items:$sch:$i }}
42 + {{? $sch.default !== undefined }}
43 + {{ var $passData = $data + '[' + $i + ']'; }}
44 + {{# def.assignDefault }}
45 + {{?}}
46 + {{~}}
47 +#}}
1 +{{## def.setupKeyword:
2 + {{
3 + var $lvl = it.level;
4 + var $dataLvl = it.dataLevel;
5 + var $schema = it.schema[$keyword];
6 + var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
7 + var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
8 + var $breakOnError = !it.opts.allErrors;
9 + var $errorKeyword;
10 +
11 + var $data = 'data' + ($dataLvl || '');
12 + var $valid = 'valid' + $lvl;
13 + var $errs = 'errs__' + $lvl;
14 + }}
15 +#}}
16 +
17 +
18 +{{## def.setCompositeRule:
19 + {{
20 + var $wasComposite = it.compositeRule;
21 + it.compositeRule = $it.compositeRule = true;
22 + }}
23 +#}}
24 +
25 +
26 +{{## def.resetCompositeRule:
27 + {{ it.compositeRule = $it.compositeRule = $wasComposite; }}
28 +#}}
29 +
30 +
31 +{{## def.setupNextLevel:
32 + {{
33 + var $it = it.util.copy(it);
34 + var $closingBraces = '';
35 + $it.level++;
36 + var $nextValid = 'valid' + $it.level;
37 + }}
38 +#}}
39 +
40 +
41 +{{## def.ifValid:
42 + {{? $breakOnError }}
43 + if ({{=$valid}}) {
44 + {{ $closingBraces += '}'; }}
45 + {{?}}
46 +#}}
47 +
48 +
49 +{{## def.ifResultValid:
50 + {{? $breakOnError }}
51 + if ({{=$nextValid}}) {
52 + {{ $closingBraces += '}'; }}
53 + {{?}}
54 +#}}
55 +
56 +
57 +{{## def.elseIfValid:
58 + {{? $breakOnError }}
59 + {{ $closingBraces += '}'; }}
60 + else {
61 + {{?}}
62 +#}}
63 +
64 +
65 +{{## def.nonEmptySchema:_schema:
66 + it.util.schemaHasRules(_schema, it.RULES.all)
67 +#}}
68 +
69 +
70 +{{## def.strLength:
71 + {{? it.opts.unicode === false }}
72 + {{=$data}}.length
73 + {{??}}
74 + ucs2length({{=$data}})
75 + {{?}}
76 +#}}
77 +
78 +
79 +{{## def.willOptimize:
80 + it.util.varOccurences($code, $nextData) < 2
81 +#}}
82 +
83 +
84 +{{## def.generateSubschemaCode:
85 + {{
86 + var $code = it.validate($it);
87 + $it.baseId = $currentBaseId;
88 + }}
89 +#}}
90 +
91 +
92 +{{## def.insertSubschemaCode:
93 + {{= it.validate($it) }}
94 + {{ $it.baseId = $currentBaseId; }}
95 +#}}
96 +
97 +
98 +{{## def._optimizeValidate:
99 + it.util.varReplace($code, $nextData, $passData)
100 +#}}
101 +
102 +
103 +{{## def.optimizeValidate:
104 + {{? {{# def.willOptimize}} }}
105 + {{= {{# def._optimizeValidate }} }}
106 + {{??}}
107 + var {{=$nextData}} = {{=$passData}};
108 + {{= $code }}
109 + {{?}}
110 +#}}
111 +
112 +
113 +{{## def.cleanUp: {{ out = it.util.cleanUpCode(out); }} #}}
114 +
115 +
116 +{{## def.finalCleanUp: {{ out = it.util.finalCleanUpCode(out, $async); }} #}}
117 +
118 +
119 +{{## def.$data:
120 + {{
121 + var $isData = it.opts.$data && $schema && $schema.$data
122 + , $schemaValue;
123 + }}
124 + {{? $isData }}
125 + var schema{{=$lvl}} = {{= it.util.getData($schema.$data, $dataLvl, it.dataPathArr) }};
126 + {{ $schemaValue = 'schema' + $lvl; }}
127 + {{??}}
128 + {{ $schemaValue = $schema; }}
129 + {{?}}
130 +#}}
131 +
132 +
133 +{{## def.$dataNotType:_type:
134 + {{?$isData}} ({{=$schemaValue}} !== undefined && typeof {{=$schemaValue}} != _type) || {{?}}
135 +#}}
136 +
137 +
138 +{{## def.check$dataIsArray:
139 + if (schema{{=$lvl}} === undefined) {{=$valid}} = true;
140 + else if (!Array.isArray(schema{{=$lvl}})) {{=$valid}} = false;
141 + else {
142 +#}}
143 +
144 +
145 +{{## def.beginDefOut:
146 + {{
147 + var $$outStack = $$outStack || [];
148 + $$outStack.push(out);
149 + out = '';
150 + }}
151 +#}}
152 +
153 +
154 +{{## def.storeDefOut:_variable:
155 + {{
156 + var _variable = out;
157 + out = $$outStack.pop();
158 + }}
159 +#}}
160 +
161 +
162 +{{## def.dataPath:(dataPath || ''){{? it.errorPath != '""'}} + {{= it.errorPath }}{{?}}#}}
163 +
164 +{{## def.setParentData:
165 + {{
166 + var $parentData = $dataLvl ? 'data' + (($dataLvl-1)||'') : 'parentData'
167 + , $parentDataProperty = $dataLvl ? it.dataPathArr[$dataLvl] : 'parentDataProperty';
168 + }}
169 +#}}
170 +
171 +{{## def.passParentData:
172 + {{# def.setParentData }}
173 + , {{= $parentData }}
174 + , {{= $parentDataProperty }}
175 +#}}
176 +
177 +
178 +{{## def.iterateProperties:
179 + {{? $ownProperties }}
180 + {{=$dataProperties}} = {{=$dataProperties}} || Object.keys({{=$data}});
181 + for (var {{=$idx}}=0; {{=$idx}}<{{=$dataProperties}}.length; {{=$idx}}++) {
182 + var {{=$key}} = {{=$dataProperties}}[{{=$idx}}];
183 + {{??}}
184 + for (var {{=$key}} in {{=$data}}) {
185 + {{?}}
186 +#}}
187 +
188 +
189 +{{## def.noPropertyInData:
190 + {{=$useData}} === undefined
191 + {{? $ownProperties }}
192 + || !{{# def.isOwnProperty }}
193 + {{?}}
194 +#}}
195 +
196 +
197 +{{## def.isOwnProperty:
198 + Object.prototype.hasOwnProperty.call({{=$data}}, '{{=it.util.escapeQuotes($propertyKey)}}')
199 +#}}
1 +{{# def.definitions }}
2 +{{# def.errors }}
3 +{{# def.missing }}
4 +{{# def.setupKeyword }}
5 +{{# def.setupNextLevel }}
6 +
7 +
8 +{{## def.propertyInData:
9 + {{=$data}}{{= it.util.getProperty($property) }} !== undefined
10 + {{? $ownProperties }}
11 + && Object.prototype.hasOwnProperty.call({{=$data}}, '{{=it.util.escapeQuotes($property)}}')
12 + {{?}}
13 +#}}
14 +
15 +
16 +{{
17 + var $schemaDeps = {}
18 + , $propertyDeps = {}
19 + , $ownProperties = it.opts.ownProperties;
20 +
21 + for ($property in $schema) {
22 + var $sch = $schema[$property];
23 + var $deps = Array.isArray($sch) ? $propertyDeps : $schemaDeps;
24 + $deps[$property] = $sch;
25 + }
26 +}}
27 +
28 +var {{=$errs}} = errors;
29 +
30 +{{ var $currentErrorPath = it.errorPath; }}
31 +
32 +var missing{{=$lvl}};
33 +{{ for (var $property in $propertyDeps) { }}
34 + {{ $deps = $propertyDeps[$property]; }}
35 + {{? $deps.length }}
36 + if ({{# def.propertyInData }}
37 + {{? $breakOnError }}
38 + && ({{# def.checkMissingProperty:$deps }})) {
39 + {{# def.errorMissingProperty:'dependencies' }}
40 + {{??}}
41 + ) {
42 + {{~ $deps:$propertyKey }}
43 + {{# def.allErrorsMissingProperty:'dependencies' }}
44 + {{~}}
45 + {{?}}
46 + } {{# def.elseIfValid }}
47 + {{?}}
48 +{{ } }}
49 +
50 +{{
51 + it.errorPath = $currentErrorPath;
52 + var $currentBaseId = $it.baseId;
53 +}}
54 +
55 +
56 +{{ for (var $property in $schemaDeps) { }}
57 + {{ var $sch = $schemaDeps[$property]; }}
58 + {{? {{# def.nonEmptySchema:$sch }} }}
59 + {{=$nextValid}} = true;
60 +
61 + if ({{# def.propertyInData }}) {
62 + {{
63 + $it.schema = $sch;
64 + $it.schemaPath = $schemaPath + it.util.getProperty($property);
65 + $it.errSchemaPath = $errSchemaPath + '/' + it.util.escapeFragment($property);
66 + }}
67 +
68 + {{# def.insertSubschemaCode }}
69 + }
70 +
71 + {{# def.ifResultValid }}
72 + {{?}}
73 +{{ } }}
74 +
75 +{{? $breakOnError }}
76 + {{= $closingBraces }}
77 + if ({{=$errs}} == errors) {
78 +{{?}}
79 +
80 +{{# def.cleanUp }}
1 +{{# def.definitions }}
2 +{{# def.errors }}
3 +{{# def.setupKeyword }}
4 +{{# def.$data }}
5 +
6 +{{
7 + var $i = 'i' + $lvl
8 + , $vSchema = 'schema' + $lvl;
9 +}}
10 +
11 +{{? !$isData }}
12 + var {{=$vSchema}} = validate.schema{{=$schemaPath}};
13 +{{?}}
14 +var {{=$valid}};
15 +
16 +{{?$isData}}{{# def.check$dataIsArray }}{{?}}
17 +
18 +{{=$valid}} = false;
19 +
20 +for (var {{=$i}}=0; {{=$i}}<{{=$vSchema}}.length; {{=$i}}++)
21 + if (equal({{=$data}}, {{=$vSchema}}[{{=$i}}])) {
22 + {{=$valid}} = true;
23 + break;
24 + }
25 +
26 +{{? $isData }} } {{?}}
27 +
28 +{{# def.checkError:'enum' }}
29 +
30 +{{? $breakOnError }} else { {{?}}
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.