-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #945 from zloirock/annex-b
close #336
- Loading branch information
Showing
48 changed files
with
473 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
require('../../modules/es.date.get-year'); | ||
var entryUnbind = require('../../internals/entry-unbind'); | ||
|
||
module.exports = entryUnbind('Date', 'getYear'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
require('../../modules/es.date.set-year'); | ||
var entryUnbind = require('../../internals/entry-unbind'); | ||
|
||
module.exports = entryUnbind('Date', 'setYear'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
require('../../modules/es.date.to-gmt-string'); | ||
var entryUnbind = require('../../internals/entry-unbind'); | ||
|
||
module.exports = entryUnbind('Date', 'toGMTString'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
require('../modules/es.escape'); | ||
var global = require('../internals/global'); | ||
|
||
module.exports = global.escape; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
require('../../modules/es.string.substr'); | ||
var entryUnbind = require('../../internals/entry-unbind'); | ||
|
||
module.exports = entryUnbind('String', 'substr'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
require('../../../modules/es.string.substr'); | ||
var entryVirtual = require('../../../internals/entry-virtual'); | ||
|
||
module.exports = entryVirtual('String').substr; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
require('../modules/es.unescape'); | ||
var global = require('../internals/global'); | ||
|
||
module.exports = global.unescape; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
var parent = require('../../stable/date/get-year'); | ||
|
||
module.exports = parent; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
var parent = require('../../stable/date/set-year'); | ||
|
||
module.exports = parent; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
var parent = require('../../stable/date/to-gmt-string'); | ||
|
||
module.exports = parent; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
var parent = require('../stable/escape'); | ||
|
||
module.exports = parent; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
var parent = require('../../stable/string/substr'); | ||
|
||
module.exports = parent; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
var parent = require('../../../stable/string/virtual/substr'); | ||
|
||
module.exports = parent; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
var parent = require('../stable/unescape'); | ||
|
||
module.exports = parent; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
'use strict'; | ||
var $ = require('../internals/export'); | ||
|
||
var getFullYear = Date.prototype.getFullYear; | ||
|
||
// `Date.prototype.getYear` method | ||
// https://tc39.es/ecma262/#sec-date.prototype.getyear | ||
$({ target: 'Date', proto: true }, { | ||
getYear: function getYear() { | ||
return getFullYear.call(this) - 1900; | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
'use strict'; | ||
var $ = require('../internals/export'); | ||
var toInteger = require('../internals/to-integer'); | ||
|
||
var getTime = Date.prototype.getTime; | ||
var setFullYear = Date.prototype.setFullYear; | ||
|
||
// `Date.prototype.setYear` method | ||
// https://tc39.es/ecma262/#sec-date.prototype.setyear | ||
$({ target: 'Date', proto: true }, { | ||
setYear: function setYear(year) { | ||
// validate | ||
getTime.call(this); | ||
var yi = toInteger(year); | ||
var yyyy = 0 <= yi && yi <= 99 ? yi + 1900 : yi; | ||
return setFullYear.call(this, yyyy); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
var $ = require('../internals/export'); | ||
|
||
// `Date.prototype.toGMTString` method | ||
// https://tc39.es/ecma262/#sec-date.prototype.togmtstring | ||
$({ target: 'Date', proto: true }, { | ||
toGMTString: Date.prototype.toUTCString | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
'use strict'; | ||
var $ = require('../internals/export'); | ||
|
||
var raw = /[\w*+\-./@]/; | ||
|
||
var hex = function (code, length) { | ||
var result = code.toString(16); | ||
while (result.length < length) result = '0' + result; | ||
return result; | ||
}; | ||
|
||
// `escape` method | ||
// https://tc39.es/ecma262/#sec-escape-string | ||
$({ global: true }, { | ||
escape: function escape(string) { | ||
var str = String(string); | ||
var result = ''; | ||
var length = str.length; | ||
var index = 0; | ||
var chr, code; | ||
while (index < length) { | ||
chr = str.charAt(index++); | ||
if (raw.test(chr)) { | ||
result += chr; | ||
} else { | ||
code = chr.charCodeAt(0); | ||
if (code < 256) { | ||
result += '%' + hex(code, 2); | ||
} else { | ||
result += '%u' + hex(code, 4).toUpperCase(); | ||
} | ||
} | ||
} return result; | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
'use strict'; | ||
var $ = require('../internals/export'); | ||
var requireObjectCoercible = require('../internals/require-object-coercible'); | ||
var toInteger = require('../internals/to-integer'); | ||
|
||
var slice = ''.slice; | ||
var max = Math.max; | ||
var min = Math.min; | ||
|
||
// `String.prototype.substr` method | ||
// https://tc39.es/ecma262/#sec-string.prototype.substr | ||
$({ target: 'String', proto: true }, { | ||
substr: function substr(start, length) { | ||
var that = String(requireObjectCoercible(this)); | ||
var size = that.length; | ||
var intStart = toInteger(start); | ||
var intLength, intEnd; | ||
if (intStart === Infinity) intStart = 0; | ||
if (intStart < 0) intStart = max(size + intStart, 0); | ||
intLength = length === undefined ? size : toInteger(length); | ||
if (intLength <= 0 || intLength === Infinity) return ''; | ||
intEnd = min(intStart + intLength, size); | ||
return intStart >= intEnd ? '' : slice.call(that, intStart, intEnd); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
'use strict'; | ||
var $ = require('../internals/export'); | ||
|
||
var fromCharCode = String.fromCharCode; | ||
var hex2 = /^[\da-f]{2}$/i; | ||
var hex4 = /^[\da-f]{4}$/i; | ||
|
||
// `unescape` method | ||
// https://tc39.es/ecma262/#sec-unescape-string | ||
$({ global: true }, { | ||
unescape: function unescape(string) { | ||
var str = String(string); | ||
var result = ''; | ||
var length = str.length; | ||
var index = 0; | ||
var chr, slice; | ||
while (index < length) { | ||
chr = str.charAt(index++); | ||
if (chr === '%') { | ||
if (str.charAt(index) === 'u') { | ||
slice = str.slice(index + 1, index + 5); | ||
if (hex4.test(slice)) { | ||
result += fromCharCode(parseInt(slice, 16)); | ||
index += 5; | ||
continue; | ||
} | ||
} else { | ||
slice = str.slice(index, index + 2); | ||
if (hex2.test(slice)) { | ||
result += fromCharCode(parseInt(slice, 16)); | ||
index += 2; | ||
continue; | ||
} | ||
} | ||
} | ||
result += chr; | ||
} return result; | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
var parent = require('../../es/date/get-year'); | ||
|
||
module.exports = parent; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
var parent = require('../../es/date/set-year'); | ||
|
||
module.exports = parent; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
var parent = require('../../es/date/to-gmt-string'); | ||
|
||
module.exports = parent; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
var parent = require('../es/escape'); | ||
|
||
module.exports = parent; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
var parent = require('../../es/string/substr'); | ||
|
||
module.exports = parent; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
var parent = require('../../../es/string/virtual/substr'); | ||
|
||
module.exports = parent; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
var parent = require('../es/unescape'); | ||
|
||
module.exports = parent; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.