├── .gitignore ├── .npmignore ├── CONTRIBUTORS.md ├── index.js ├── test ├── Array.js ├── Object.entries.js ├── Object.values.js ├── String.js ├── Array.prototype.js ├── String.prototype.at.js ├── index.js ├── Array.prototype.includes.js ├── String.prototype.padEnd.js ├── String.prototype.padStart.js ├── String.prototype.trimLeft.js ├── Object.getOwnPropertyDescriptors.js ├── String.prototype.trimRight.js ├── Object.js ├── String.prototype.js └── runner.js ├── String.prototype.at.js ├── browser.js ├── Array.prototype.includes.js ├── String.prototype.padEnd.js ├── String.prototype.padStart.js ├── String.prototype.trimLeft.js ├── String.prototype.trimRight.js ├── .eslintrc ├── Array.js ├── Array.prototype.js ├── String.js ├── .editorconfig ├── Object.js ├── component.json ├── es7-shim.js ├── String.prototype.js ├── bower.json ├── LICENSE ├── package.json ├── README.md ├── Makefile ├── CHANGELOG.md ├── .jscs.json └── .travis.yml /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .DS_Store 3 | dist 4 | 5 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | bower.json 3 | component.json 4 | -------------------------------------------------------------------------------- /CONTRIBUTORS.md: -------------------------------------------------------------------------------- 1 | 2 | - Jordan Harband (c) 2015 MIT License 3 | 4 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = require('./es7-shim'); 4 | -------------------------------------------------------------------------------- /test/Array.js: -------------------------------------------------------------------------------- 1 | module.exports = [ 2 | require('./Array.prototype') 3 | ]; 4 | -------------------------------------------------------------------------------- /test/Object.entries.js: -------------------------------------------------------------------------------- 1 | require('./runner')('Object.entries', 'object.entries'); 2 | -------------------------------------------------------------------------------- /test/Object.values.js: -------------------------------------------------------------------------------- 1 | require('./runner')('Object.values', 'object.values'); 2 | -------------------------------------------------------------------------------- /test/String.js: -------------------------------------------------------------------------------- 1 | module.exports = [ 2 | require('./String.prototype') 3 | ]; 4 | -------------------------------------------------------------------------------- /String.prototype.at.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = require('string-at'); 4 | -------------------------------------------------------------------------------- /browser.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = require('./es7-shim').shim(); 4 | -------------------------------------------------------------------------------- /Array.prototype.includes.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = require('array-includes'); 4 | -------------------------------------------------------------------------------- /test/Array.prototype.js: -------------------------------------------------------------------------------- 1 | module.exports = [ 2 | require('./Array.prototype.includes') 3 | ]; 4 | -------------------------------------------------------------------------------- /String.prototype.padEnd.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = require('string.prototype.padend'); 4 | -------------------------------------------------------------------------------- /test/String.prototype.at.js: -------------------------------------------------------------------------------- 1 | module.exports = require('./runner')('String.prototype.at', 'string-at'); 2 | -------------------------------------------------------------------------------- /String.prototype.padStart.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = require('string.prototype.padstart'); 4 | -------------------------------------------------------------------------------- /String.prototype.trimLeft.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = require('string.prototype.trimleft'); 4 | -------------------------------------------------------------------------------- /String.prototype.trimRight.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = require('string.prototype.trimright'); 4 | -------------------------------------------------------------------------------- /test/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | require('./Array'); 4 | require('./Object'); 5 | require('./String'); 6 | -------------------------------------------------------------------------------- /test/Array.prototype.includes.js: -------------------------------------------------------------------------------- 1 | module.exports = require('./runner')('Array.prototype.includes', 'array-includes'); 2 | -------------------------------------------------------------------------------- /test/String.prototype.padEnd.js: -------------------------------------------------------------------------------- 1 | module.exports = require('./runner')('String.prototype.padEnd', 'string.prototype.padend'); 2 | -------------------------------------------------------------------------------- /test/String.prototype.padStart.js: -------------------------------------------------------------------------------- 1 | module.exports = require('./runner')('String.prototype.padStart', 'string.prototype.padstart'); 2 | -------------------------------------------------------------------------------- /test/String.prototype.trimLeft.js: -------------------------------------------------------------------------------- 1 | module.exports = require('./runner')('String.prototype.trimLeft', 'string.prototype.trimleft'); 2 | -------------------------------------------------------------------------------- /test/Object.getOwnPropertyDescriptors.js: -------------------------------------------------------------------------------- 1 | require('./runner')('Object.getOwnPropertyDescriptors', 'object.getownpropertydescriptors'); 2 | -------------------------------------------------------------------------------- /test/String.prototype.trimRight.js: -------------------------------------------------------------------------------- 1 | module.exports = require('./runner')('String.prototype.trimRight', 'string.prototype.trimright'); 2 | -------------------------------------------------------------------------------- /test/Object.js: -------------------------------------------------------------------------------- 1 | module.exports = [ 2 | require('./Object.getOwnPropertyDescriptors'), 3 | require('./Object.entries'), 4 | require('./Object.values') 5 | ]; 6 | -------------------------------------------------------------------------------- /.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "root": true, 3 | 4 | "extends": "@ljharb", 5 | 6 | "rules": { 7 | "id-length": [2, { "max": 30 }], 8 | "sort-keys": [1] 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Array.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var proto = require('./Array.prototype'); 4 | 5 | module.exports = { 6 | prototype: proto, 7 | shim: function shimArray() { 8 | proto.shim(); 9 | } 10 | }; 11 | -------------------------------------------------------------------------------- /Array.prototype.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var includes = require('./Array.prototype.includes'); 4 | 5 | module.exports = { 6 | includes: includes, 7 | shim: function shimArrayPrototype() { 8 | includes.shim(); 9 | } 10 | }; 11 | -------------------------------------------------------------------------------- /String.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var stringPrototype = require('./String.prototype'); 4 | 5 | module.exports = { 6 | prototype: stringPrototype, 7 | shim: function shimString() { 8 | stringPrototype.shim(); 9 | } 10 | }; 11 | -------------------------------------------------------------------------------- /test/String.prototype.js: -------------------------------------------------------------------------------- 1 | module.exports = [ 2 | require('./String.prototype.at'), 3 | require('./String.prototype.padStart'), 4 | require('./String.prototype.padEnd'), 5 | require('./String.prototype.trimLeft'), 6 | require('./String.prototype.trimRight') 7 | ]; 8 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = tab; 5 | insert_final_newline = true; 6 | quote_type = auto; 7 | space_after_anonymous_functions = true; 8 | space_after_control_statements = true; 9 | spaces_around_operators = true; 10 | trim_trailing_whitespace = true; 11 | spaces_in_brackets = false; 12 | end_of_line = lf; 13 | 14 | -------------------------------------------------------------------------------- /Object.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var getDescriptors = require('object.getownpropertydescriptors'); 4 | var entries = require('object.entries'); 5 | var values = require('object.values'); 6 | 7 | module.exports = { 8 | entries: entries, 9 | getOwnPropertyDescriptors: getDescriptors, 10 | shim: function shimObject() { 11 | getDescriptors.shim(); 12 | entries.shim(); 13 | values.shim(); 14 | }, 15 | values: values 16 | }; 17 | -------------------------------------------------------------------------------- /component.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "es7-shim", 3 | "repo": "es-shims/es7-shim", 4 | "description": "ECMAScript 7 compatibility shims for legacy JavaScript engines", 5 | "version": "v4.3.1", 6 | "keywords": [ 7 | "shim", 8 | "es7", 9 | "shim", 10 | "javascript", 11 | "ecmascript", 12 | "polyfill" 13 | ], 14 | "license": "MIT", 15 | "main": "browser.js", 16 | "scripts": [ 17 | "dist/es7-shim.js" 18 | ] 19 | } 20 | 21 | -------------------------------------------------------------------------------- /es7-shim.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * https://github.com/es-shims/es7-shim 3 | * @license es7-shim Copyright 2014 by contributors, MIT License 4 | * see https://github.com/es-shims/es7-shim/blob/master/LICENSE 5 | */ 6 | 7 | 'use strict'; 8 | 9 | var $Array = require('./Array'); 10 | var $Object = require('./Object'); 11 | var $String = require('./String'); 12 | 13 | module.exports = { 14 | Array: $Array, 15 | Object: $Object, 16 | String: $String, 17 | shim: function shimES7() { 18 | $Array.shim(); 19 | $Object.shim(); 20 | $String.shim(); 21 | } 22 | }; 23 | -------------------------------------------------------------------------------- /String.prototype.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var at = require('./String.prototype.at'); 4 | var padStart = require('./String.prototype.padStart'); 5 | var padEnd = require('./String.prototype.padEnd'); 6 | var trimLeft = require('./String.prototype.trimLeft'); 7 | var trimRight = require('./String.prototype.trimRight'); 8 | 9 | module.exports = { 10 | at: at, 11 | padStart: padStart, 12 | padEnd: padEnd, 13 | trimLeft: trimLeft, 14 | trimRight: trimRight, 15 | shim: function shimStringPrototype() { 16 | at.shim(); 17 | padStart.shim(); 18 | padEnd.shim(); 19 | trimLeft.shim(); 20 | trimRight.shim(); 21 | } 22 | }; 23 | -------------------------------------------------------------------------------- /bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "es7-shim", 3 | "main": "browser.js", 4 | "repository": { 5 | "type": "git", 6 | "url": "git://github.com/es-shims/es7-shim" 7 | }, 8 | "homepage": "https://github.com/es-shims/es7-shim", 9 | "authors": [ 10 | "Jordan Harband (https://github.com/ljharb/)" 11 | ], 12 | "description": "ECMAScript 7 compatibility shims for legacy JavaScript engines", 13 | "keywords": [ 14 | "shim", 15 | "es7", 16 | "shim", 17 | "javascript", 18 | "ecmascript", 19 | "polyfill" 20 | ], 21 | "license": "MIT", 22 | "ignore": [ 23 | "**/.*", 24 | "node_modules", 25 | "bower_components", 26 | "test" 27 | ] 28 | } 29 | 30 | -------------------------------------------------------------------------------- /test/runner.js: -------------------------------------------------------------------------------- 1 | var Promise = require('es6-promise').Promise; 2 | var spawn = require('child_process').spawn; 3 | 4 | module.exports = function (method, module) { 5 | console.log(method + ': running tests from "' + module + '"...'); 6 | return new Promise(function (resolve, reject) { 7 | spawn('npm', ['explore', module, 'npm install && npm test'], { stdio: 'inherit' }) 8 | .on('error', reject) 9 | .on('close', function (code) { 10 | (code === 0 ? resolve : reject)(code); 11 | }); 12 | }).then(function (code) { 13 | console.log(method + ': tests passed!'); 14 | }).catch(function (error) { 15 | console.error('Error running tests for ' + method, error); 16 | }); 17 | }; 18 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (C) 2015-2016 Jordan Harband and contributors 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 13 | all 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 21 | THE SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "es7-shim", 3 | "version": "6.0.0", 4 | "description": "ECMAScript 7 compatibility shims for legacy JavaScript engines", 5 | "homepage": "http://github.com/es-shims/es7-shim/", 6 | "author": "Jordan Harband (https://github.com/ljharb/)", 7 | "contributors": [ 8 | "Jordan Harband (https://github.com/ljharb/)" 9 | ], 10 | "bugs": { 11 | "mail": "ljharb@gmail.com", 12 | "url": "http://github.com/es-shims/es7-shim/issues" 13 | }, 14 | "license": "MIT", 15 | "main": "index.js", 16 | "browser": "browser.js", 17 | "repository": { 18 | "type": "git", 19 | "url": "http://github.com/es-shims/es7-shim.git" 20 | }, 21 | "keywords": [ 22 | "ecmascript", 23 | "harmony", 24 | "es7", 25 | "ES2016", 26 | "shim", 27 | "polyfill" 28 | ], 29 | "scripts": { 30 | "pretest": "npm run --silent lint", 31 | "test": "npm run --silent tests-only", 32 | "posttest": "npm run --silent security", 33 | "tests-only": "node test/index.js", 34 | "prepublish": "npm run --silent minify", 35 | "build": "mkdir -p dist && browserify ./ > dist/es7-shim.js", 36 | "minify": "npm run --silent build && uglifyjs dist/es7-shim.js --comments --source-map=dist/es7-shim.map -m -b ascii_only=true,beautify=false > dist/es7-shim.min.js", 37 | "coverage": "covert test/index.js", 38 | "coverage-quiet": "covert test/index.js --quiet", 39 | "lint": "npm run --silent jscs && npm run --silent eslint", 40 | "jscs": "jscs test/index.js *.js", 41 | "eslint": "eslint test/index.js *.js", 42 | "security": "nsp check" 43 | }, 44 | "dependencies": { 45 | "array-includes": "^3.0.3", 46 | "object.entries": "^1.0.4", 47 | "object.getownpropertydescriptors": "^2.0.3", 48 | "object.values": "^1.0.4", 49 | "string-at": "^1.0.1", 50 | "string.prototype.padend": "^3.0.0", 51 | "string.prototype.padstart": "^3.0.0", 52 | "string.prototype.trimleft": "^2.0.0", 53 | "string.prototype.trimright": "^2.0.0" 54 | }, 55 | "devDependencies": { 56 | "@ljharb/eslint-config": "^11.0.0", 57 | "browserify": "^14.4.0", 58 | "covert": "^1.1.0", 59 | "es6-promise": "^4.1.0", 60 | "eslint": "^3.19.0", 61 | "jscs": "^3.0.7", 62 | "nsp": "^2.6.3", 63 | "replace": "^0.3.0", 64 | "semver": "^5.3.0", 65 | "tape": "^4.6.3", 66 | "uglify-js": "^2.8.22" 67 | }, 68 | "engines": { 69 | "node": ">=0.4.0" 70 | }, 71 | "testling": { 72 | "files": "test/index.js", 73 | "browsers": [ 74 | "iexplore/6.0..latest", 75 | "firefox/3.0..6.0", 76 | "firefox/15.0..latest", 77 | "firefox/nightly", 78 | "chrome/4.0..10.0", 79 | "chrome/20.0..latest", 80 | "chrome/canary", 81 | "opera/10.0..latest", 82 | "opera/next", 83 | "safari/4.0..latest", 84 | "ipad/6.0..latest", 85 | "iphone/6.0..latest", 86 | "android-browser/4.2" 87 | ] 88 | }, 89 | "greenkeeper": { 90 | "ignore": [ 91 | "uglify-js" 92 | ] 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # es7-shim [![Version Badge][2]][1] 2 | 3 | [![npm badge][9]][1] 4 | 5 | [![Build Status][3]][4] [![dependency status][5]][6] [![dev dependency status][7]][8] 6 | 7 | ECMAScript 7 compatibility shims for legacy JavaScript engines. 8 | 9 | `es7-shim.js` exports an object that contains shims that can be used to monkeypatch a JavaScript context to contain all ECMAScript 7 methods that can be faithfully emulated with a legacy JavaScript engine. 10 | `es7-shim.browser.js` calls the “shim” method on the export of `es7-shim.js` which actually modifies the global object, including replacing native methods when engine-specific bugs exist. 11 | Published on npm are `dist/es7-shim.js` and `dist/es7-shim.min.js` which are pre-prepared browserified versions of `es7-shim.browser.js`. 12 | 13 | ## Source for shims 14 | Every shim in this module is a separate, independent `npm` module. 15 | To be included, all shims must have a ".shim()" method that installs the shim into the global object whenever it is necessary. It should also handle any engine-specific specific to the method it is shimming. 16 | 17 | ## Tests 18 | Simply clone the repo, `npm install`, and run `npm test` 19 | 20 | ## Shims 21 | 22 | `Array.prototype`: 23 | * `includes` [standalone][npm-includes-url] 24 | 25 | `Object`: 26 | * `getOwnPropertyDescriptors` [standalone][npm-get-descriptors-url] 27 | * `entries` [standalone][object-entries-url] 28 | * `values` [standalone][object-values-url] 29 | 30 | `String.prototype`: 31 | * `at` [standalone][string-at-url] 32 | * `trimLeft` [standalone][string-trimleft-url] 33 | * `trimRight` [standalone][string-trimright-url] 34 | * `padStart` [standalone][string-padstart-url] 35 | * `padEnd` [standalone][string-padend-url] 36 | 37 | ## Shams 38 | 39 | * :warning: None yet! 40 | 41 | [1]: https://npmjs.org/package/es7-shim 42 | [2]: http://versionbadg.es/es-shims/es7-shim.svg 43 | [3]: https://travis-ci.org/es-shims/es7-shim.svg 44 | [4]: https://travis-ci.org/es-shims/es7-shim 45 | [5]: https://david-dm.org/es-shims/es7-shim.png 46 | [6]: https://david-dm.org/es-shims/es7-shim 47 | [7]: https://david-dm.org/es-shims/es7-shim/dev-status.png 48 | [8]: https://david-dm.org/es-shims/es7-shim#info=devDependencies 49 | [9]: https://nodei.co/npm/es7-shim.png?downloads=true&stars=true 50 | [npm-includes-url]: https://www.npmjs.com/package/array-includes 51 | [npm-get-descriptors-url]: https://www.npmjs.com/package/object.getownpropertydescriptors 52 | [map-tojson-url]: https://www.npmjs.com/package/map-tojson 53 | [set-tojson-url]: https://www.npmjs.com/package/set-tojson 54 | [string-at-url]: https://www.npmjs.com/package/string-at 55 | [object-entries-url]: https://www.npmjs.com/package/object.entries 56 | [object-values-url]: https://www.npmjs.com/package/object.values 57 | [string-trimleft-url]: https://www.npmjs.com/package/string.prototype.trimleft 58 | [string-trimright-url]: https://www.npmjs.com/package/string.prototype.trimright 59 | [string-padstart-url]: https://www.npmjs.com/package/string.prototype.padstart 60 | [string-padend-url]: https://www.npmjs.com/package/string.prototype.padend 61 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # Since we rely on paths relative to the makefile location, abort if make isn't being run from there. 2 | $(if $(findstring /,$(MAKEFILE_LIST)),$(error Please only invoke this makefile from the directory it resides in)) 3 | 4 | # The files that need updating when incrementing the version number. 5 | VERSIONED_FILES := *.js *.json README* 6 | 7 | 8 | # Add the local npm packages' bin folder to the PATH, so that `make` can find them, when invoked directly. 9 | # Note that rather than using `$(npm bin)` the 'node_modules/.bin' path component is hard-coded, so that invocation works even from an environment 10 | # where npm is (temporarily) unavailable due to having deactivated an nvm instance loaded into the calling shell in order to avoid interference with tests. 11 | export PATH := $(shell printf '%s' "$$PWD/node_modules/.bin:$$PATH") 12 | UTILS := semver 13 | # Make sure that all required utilities can be located. 14 | UTIL_CHECK := $(or $(shell PATH="$(PATH)" which $(UTILS) >/dev/null && echo 'ok'),$(error Did you forget to run `npm install` after cloning the repo? At least one of the required supporting utilities not found: $(UTILS))) 15 | 16 | # Default target (by virtue of being the first non '.'-prefixed in the file). 17 | .PHONY: _no-target-specified 18 | _no-target-specified: 19 | $(error Please specify the target to make - `make list` shows targets. Alternatively, use `npm test` to run the default tests; `npm run` shows all tests) 20 | 21 | # Lists all targets defined in this makefile. 22 | .PHONY: list 23 | list: 24 | @$(MAKE) -pRrn : -f $(MAKEFILE_LIST) 2>/dev/null | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | command grep -v -e '^[^[:alnum:]]' -e '^$@$$command ' | sort 25 | 26 | # All-tests target: invokes the specified test suites for ALL shells defined in $(SHELLS). 27 | .PHONY: test 28 | test: 29 | @npm test 30 | 31 | .PHONY: _ensure-tag 32 | _ensure-tag: 33 | ifndef TAG 34 | $(error Please invoke with `make TAG= release`, where is either an increment specifier (patch, minor, major, prepatch, preminor, premajor, prerelease), or an explicit major.minor.patch version number) 35 | endif 36 | 37 | CHANGELOG_ERROR = $(error No CHANGELOG specified) 38 | .PHONY: _ensure-changelog 39 | _ensure-changelog: 40 | @ (git status -sb --porcelain | command grep -E '^( M|[MA] ) CHANGELOG.md' > /dev/null) || (echo no CHANGELOG.md specified && exit 2) 41 | 42 | # Ensures that the git workspace is clean. 43 | .PHONY: _ensure-clean 44 | _ensure-clean: 45 | @[ -z "$$((git status --porcelain --untracked-files=no || echo err) | command grep -v 'CHANGELOG.md')" ] || { echo "Workspace is not clean; please commit changes first." >&2; exit 2; } 46 | 47 | # Makes a release; invoke with `make TAG= release`. 48 | .PHONY: release 49 | release: _ensure-tag _ensure-changelog _ensure-clean 50 | @old_ver=`git describe --abbrev=0 --tags --match 'v[0-9]*.[0-9]*.[0-9]*'` || { echo "Failed to determine current version." >&2; exit 1; }; old_ver=$${old_ver#v}; \ 51 | new_ver=`echo "$(TAG)" | sed 's/^v//'`; new_ver=$${new_ver:-patch}; \ 52 | if printf "$$new_ver" | command grep -q '^[0-9]'; then \ 53 | semver "$$new_ver" >/dev/null || { echo 'Invalid version number specified: $(TAG) - must be major.minor.patch' >&2; exit 2; }; \ 54 | semver -r "> $$old_ver" "$$new_ver" >/dev/null || { echo 'Invalid version number specified: $(TAG) - must be HIGHER than current one.' >&2; exit 2; } \ 55 | else \ 56 | new_ver=`semver -i "$$new_ver" "$$old_ver"` || { echo 'Invalid version-increment specifier: $(TAG)' >&2; exit 2; } \ 57 | fi; \ 58 | printf "=== Bumping version **$$old_ver** to **$$new_ver** before committing and tagging:\n=== TYPE 'proceed' TO PROCEED, anything else to abort: " && read response && [ "$$response" = 'proceed' ] || { echo 'Aborted.' >&2; exit 2; }; \ 59 | replace "$$old_ver" "$$new_ver" -- $(VERSIONED_FILES) && \ 60 | git commit -m "v$$new_ver" $(VERSIONED_FILES) CHANGELOG.md && \ 61 | git tag -a -m "v$$new_ver" "v$$new_ver" 62 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | 6.0.0 / 2016-07-05 2 | ================= 3 | * [Breaking] remove `Map#toJSON`/`Set#toJSON`, since they were rejected by TC39 4 | * [Breaking] Remove `SIMD` shim (out of date + unpolyfillable) 5 | * [Breaking] Remove `RegExp.escape`, since it was rejected by TC39 6 | * [Deps] update `array-includes`, `object.getownpropertydescriptors`, `string.prototype.trimright`, `string.prototype.trimleft` 7 | * [Fix] fix “main” in bower.json/component.json (#15) 8 | * [Tests] up to `node` `v6.2`, `v5.12`, `v4.4` 9 | * [Tests] use pretest/posttest for linting/security 10 | * [Dev Deps] update `tape`, `browserify`, `uglify-js`, `jscs`, `nsp`, `eslint`, `@ljharb/eslint-config`, `es6-promise`, `semver` 11 | 12 | 5.0.0 / 2015-11-17 13 | ================= 14 | * [Breaking] Rename `String#{padLeft,padRight}` → `String#{padStart,padEnd}` 15 | * [Deps] update `object.entries`, `object.values` 16 | * [Dev Deps] update `jscs`, `tape`, `eslint`, `@ljharb/eslint-config`, `uglify-js`, `nsp`, `browserify` 17 | * [Tests] up to `node` `v5.0` 18 | * [Tests] fix npm upgrades on older node versions 19 | * [Docs] Add `npm` keywords and author 20 | * [Docs] Add `trimLeft`/`trimRight` to README 21 | 22 | 4.3.1 / 2015-09-26 23 | ================= 24 | * [Deps] update `object.entries`, `object.values`, `string.prototype.padleft`, `string.prototype.padright` 25 | * [Test] on `node` `v4.1` 26 | * [Dev Deps] update `browserify`, `eslint`, `@ljharb/eslint-config`, `semver` 27 | 28 | 4.3.0 / 2015-09-23 29 | ================= 30 | * Add `Object.entries` and `Object.values` 31 | * [Deps] update `array-includes` 32 | * [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `jscs`, `tape`, `es6-promise`, `nsp` 33 | * [Tests] up to `io.js` `v3.3`, `node` `v4.1` 34 | * [Docs] Switch from vb.teelaun.ch to versionbadg.es for the npm version badge SVG. 35 | * [Docs] Fix license field in package.json 36 | 37 | 4.2.0 / 2015-07-30 38 | ================= 39 | * Add `String#padLeft` and `String#padRight` 40 | 41 | 4.1.0 / 2015-07-29 42 | ================= 43 | * Add `String#trimLeft` and `String#trimRight` 44 | * [Deps] Update `object.getownpropertydescriptors`, `regexp.escape` 45 | * [Dev deps] Update `eslint`, `nsp`, `browserify`, `semver`, `tape`, `uglify-js` 46 | 47 | 4.0.0 / 2015-06-17 48 | ================= 49 | * Update `simd` to `v2.0.0` 50 | 51 | 3.1.0 / 2015-06-16 52 | ================= 53 | * Add `RegExp.escape` 54 | * Test up to `io.js` `v2.3` 55 | * Update dev deps: `browserify`, `es6-promise`, `eslint`, `semver` 56 | 57 | 3.0.0 / 2015-05-23 58 | ================= 59 | * Update `array-includes` to not skip holes 60 | 61 | 2.1.0 / 2015-05-23 62 | ================= 63 | * Add `SIMD` shim 64 | * Minor updates to `Map#toJSON`, `Set#toJSON`, `Object.getOwnPropertyDescriptors`, `String#at`, `Array#includes` 65 | * Update `eslint`, `browserify`, `uglify-js`, `covert`, `jscs`, `semver` 66 | 67 | 2.0.0 / 2015-04-26 68 | ================= 69 | * Update `Map#toJSON` and `Set#toJSON` 70 | 71 | 1.3.0 / 2015-04-22 72 | ================= 73 | * Add `Map#toJSON` and `Set#toJSON` 74 | * Test on latest `io.js` versions. 75 | * Update `jscs`, `semver`, `uglify-js`, `eslint`, `tape`, `browserify` 76 | 77 | 1.2.1 / 2015-03-21 78 | ================= 79 | * Update built distribution files 80 | 81 | 1.2.0 / 2015-03-20 82 | ================= 83 | * Add `String#at` 84 | * Update `object.getownpropertydescriptors` 85 | * Test on latest `io.js` versions. 86 | 87 | 1.1.1 / 2015-03-19 88 | ================= 89 | * Update `browserify`, `uglify-js`, `editorconfig-tools`, `nsp`, `eslint`, `semver` 90 | * Update `array-includes` 91 | 92 | 1.1.0 / 2015-02-17 93 | ================= 94 | * Add Object.getOwnPropertyDescriptors via https://www.npmjs.com/package/object.getownpropertydescriptors 95 | * Add standalone links to README 96 | * All grade A-supported `node`/`iojs` versions now ship with an `npm` that understands `^`. 97 | * Run `travis-ci` tests on `iojs` and `node` v0.12; speed up builds; allow 0.8/0.11/0.4 failures. 98 | * Update `tape`, `browserify`, `jscs`, `eslint` 99 | 100 | 1.0.5 / 2015-01-30 101 | ================= 102 | * Update `array-includes` 103 | 104 | 1.0.4 / 2015-01-29 105 | ================= 106 | * Fix `npm run build` to browserify the package, so that dist/es7-shim\* has the auto-shim version. 107 | 108 | 1.0.3 / 2015-01-25 109 | ================= 110 | * Fix accidental `covert` dev dependency version change 111 | 112 | 1.0.2 / 2015-01-25 113 | ================= 114 | * Update `array-includes`: now uses `es-abstract` for ECMAScript spec internal abstract operations 115 | * Update dev dependencies: `browserify`, `tape`, `eslint`, `jscs` 116 | 117 | 1.0.1 / 2015-01-07 118 | ================= 119 | * Fix browserification 120 | 121 | 1.0.0 / 2015-01-06 122 | ================= 123 | * Initial release 124 | -------------------------------------------------------------------------------- /.jscs.json: -------------------------------------------------------------------------------- 1 | { 2 | "es3": true, 3 | 4 | "additionalRules": [], 5 | 6 | "requireSemicolons": true, 7 | 8 | "disallowMultipleSpaces": true, 9 | 10 | "disallowIdentifierNames": [], 11 | 12 | "requireCurlyBraces": { 13 | "allExcept": [], 14 | "keywords": ["if", "else", "for", "while", "do", "try", "catch"] 15 | }, 16 | 17 | "requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return", "try", "catch", "function"], 18 | 19 | "disallowSpaceAfterKeywords": [], 20 | 21 | "disallowSpaceBeforeComma": true, 22 | "disallowSpaceAfterComma": false, 23 | "disallowSpaceBeforeSemicolon": true, 24 | 25 | "disallowNodeTypes": [ 26 | "DebuggerStatement", 27 | "ForInStatement", 28 | "LabeledStatement", 29 | "SwitchCase", 30 | "SwitchStatement", 31 | "WithStatement" 32 | ], 33 | 34 | "requireObjectKeysOnNewLine": { "allExcept": ["sameLine"] }, 35 | 36 | "requireSpacesInAnonymousFunctionExpression": { "beforeOpeningRoundBrace": true, "beforeOpeningCurlyBrace": true }, 37 | "requireSpacesInNamedFunctionExpression": { "beforeOpeningCurlyBrace": true }, 38 | "disallowSpacesInNamedFunctionExpression": { "beforeOpeningRoundBrace": true }, 39 | "requireSpacesInFunctionDeclaration": { "beforeOpeningCurlyBrace": true }, 40 | "disallowSpacesInFunctionDeclaration": { "beforeOpeningRoundBrace": true }, 41 | 42 | "requireSpaceBetweenArguments": true, 43 | 44 | "disallowSpacesInsideParentheses": true, 45 | 46 | "disallowSpacesInsideArrayBrackets": true, 47 | 48 | "disallowQuotedKeysInObjects": { "allExcept": ["reserved"] }, 49 | 50 | "disallowSpaceAfterObjectKeys": true, 51 | 52 | "requireCommaBeforeLineBreak": true, 53 | 54 | "disallowSpaceAfterPrefixUnaryOperators": ["++", "--", "+", "-", "~", "!"], 55 | "requireSpaceAfterPrefixUnaryOperators": [], 56 | 57 | "disallowSpaceBeforePostfixUnaryOperators": ["++", "--"], 58 | "requireSpaceBeforePostfixUnaryOperators": [], 59 | 60 | "disallowSpaceBeforeBinaryOperators": [], 61 | "requireSpaceBeforeBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!=="], 62 | 63 | "requireSpaceAfterBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!=="], 64 | "disallowSpaceAfterBinaryOperators": [], 65 | 66 | "disallowImplicitTypeConversion": ["binary", "string"], 67 | 68 | "disallowKeywords": ["with", "eval"], 69 | 70 | "requireKeywordsOnNewLine": [], 71 | "disallowKeywordsOnNewLine": ["else"], 72 | 73 | "requireLineFeedAtFileEnd": true, 74 | 75 | "disallowTrailingWhitespace": true, 76 | 77 | "disallowTrailingComma": true, 78 | 79 | "excludeFiles": ["node_modules/**", "vendor/**"], 80 | 81 | "disallowMultipleLineStrings": true, 82 | 83 | "requireDotNotation": { "allExcept": ["keywords"] }, 84 | 85 | "requireParenthesesAroundIIFE": true, 86 | 87 | "validateLineBreaks": "LF", 88 | 89 | "validateQuoteMarks": { 90 | "escape": true, 91 | "mark": "'" 92 | }, 93 | 94 | "disallowOperatorBeforeLineBreak": [], 95 | 96 | "requireSpaceBeforeKeywords": [ 97 | "do", 98 | "for", 99 | "if", 100 | "else", 101 | "switch", 102 | "case", 103 | "try", 104 | "catch", 105 | "finally", 106 | "while", 107 | "with", 108 | "return" 109 | ], 110 | 111 | "validateAlignedFunctionParameters": { 112 | "lineBreakAfterOpeningBraces": true, 113 | "lineBreakBeforeClosingBraces": true 114 | }, 115 | 116 | "requirePaddingNewLinesBeforeExport": true, 117 | 118 | "validateNewlineAfterArrayElements": { 119 | "maximum": 1 120 | }, 121 | 122 | "requirePaddingNewLinesAfterUseStrict": true, 123 | 124 | "disallowArrowFunctions": true, 125 | 126 | "disallowMultiLineTernary": true, 127 | 128 | "validateOrderInObjectKeys": false, 129 | 130 | "disallowIdenticalDestructuringNames": true, 131 | 132 | "disallowNestedTernaries": { "maxLevel": 1 }, 133 | 134 | "requireSpaceAfterComma": { "allExcept": ["trailing"] }, 135 | "requireAlignedMultilineParams": false, 136 | 137 | "requireSpacesInGenerator": { 138 | "afterStar": true 139 | }, 140 | 141 | "disallowSpacesInGenerator": { 142 | "beforeStar": true 143 | }, 144 | 145 | "disallowVar": false, 146 | 147 | "requireArrayDestructuring": false, 148 | 149 | "requireEnhancedObjectLiterals": false, 150 | 151 | "requireObjectDestructuring": false, 152 | 153 | "requireEarlyReturn": false, 154 | 155 | "requireCapitalizedConstructorsNew": { 156 | "allExcept": ["Function", "String", "Object", "Symbol", "Number", "Date", "RegExp", "Error", "Boolean", "Array"] 157 | }, 158 | 159 | "requireImportAlphabetized": false, 160 | 161 | "requireSpaceBeforeObjectValues": true, 162 | "requireSpaceBeforeDestructuredValues": true, 163 | 164 | "disallowSpacesInsideTemplateStringPlaceholders": true, 165 | 166 | "disallowArrayDestructuringReturn": false, 167 | 168 | "requireNewlineBeforeSingleStatementsInIf": false, 169 | 170 | "disallowUnusedVariables": true, 171 | 172 | "requireSpacesInsideImportedObjectBraces": true, 173 | 174 | "requireUseStrict": true 175 | } 176 | 177 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | os: 3 | - linux 4 | node_js: 5 | - "8.0" 6 | - "7.10" 7 | - "6.10" 8 | - "5.12" 9 | - "4.8" 10 | - "iojs-v3.3" 11 | - "iojs-v2.5" 12 | - "iojs-v1.8" 13 | - "0.12" 14 | - "0.10" 15 | - "0.8" 16 | before_install: 17 | - 'if [ "${TRAVIS_NODE_VERSION}" = "0.6" ]; then npm install -g npm@1.3 ; elif [ "${TRAVIS_NODE_VERSION}" != "0.9" ]; then case "$(npm --version)" in 1.*) npm install -g npm@1.4.28 ;; 2.*) npm install -g npm@2 ;; esac ; fi' 18 | - 'if [ "${TRAVIS_NODE_VERSION%${TRAVIS_NODE_VERSION#[0-9]}}" = "0" ] || [ "${TRAVIS_NODE_VERSION:0:4}" = "iojs" ]; then npm install -g npm@4.5 ; elif [ "${TRAVIS_NODE_VERSION}" != "0.6" ] && [ "${TRAVIS_NODE_VERSION}" != "0.9" ]; then npm install -g npm; fi' 19 | install: 20 | - 'if [ "${TRAVIS_NODE_VERSION}" = "0.6" ]; then nvm install 0.8 && npm install -g npm@1.3 && npm install -g npm@1.4.28 && npm install -g npm@2 && npm install && nvm use "${TRAVIS_NODE_VERSION}"; else npm install; fi;' 21 | script: 22 | - 'if [ -n "${PRETEST-}" ]; then npm run pretest ; fi' 23 | - 'if [ -n "${POSTTEST-}" ]; then npm run posttest ; fi' 24 | - 'if [ -n "${COVERAGE-}" ]; then npm run coverage ; fi' 25 | - 'if [ -n "${TEST-}" ]; then npm run tests-only ; fi' 26 | sudo: false 27 | env: 28 | - TEST=true 29 | matrix: 30 | fast_finish: true 31 | include: 32 | - node_js: "node" 33 | env: PRETEST=true 34 | - node_js: "node" 35 | env: POSTTEST=true 36 | - node_js: "7.9" 37 | env: TEST=true ALLOW_FAILURE=true 38 | - node_js: "7.8" 39 | env: TEST=true ALLOW_FAILURE=true 40 | - node_js: "7.7" 41 | env: TEST=true ALLOW_FAILURE=true 42 | - node_js: "7.6" 43 | env: TEST=true ALLOW_FAILURE=true 44 | - node_js: "7.5" 45 | env: TEST=true ALLOW_FAILURE=true 46 | - node_js: "7.4" 47 | env: TEST=true ALLOW_FAILURE=true 48 | - node_js: "7.3" 49 | env: TEST=true ALLOW_FAILURE=true 50 | - node_js: "7.2" 51 | env: TEST=true ALLOW_FAILURE=true 52 | - node_js: "7.1" 53 | env: TEST=true ALLOW_FAILURE=true 54 | - node_js: "7.0" 55 | env: TEST=true ALLOW_FAILURE=true 56 | - node_js: "6.9" 57 | env: TEST=true ALLOW_FAILURE=true 58 | - node_js: "6.8" 59 | env: TEST=true ALLOW_FAILURE=true 60 | - node_js: "6.7" 61 | env: TEST=true ALLOW_FAILURE=true 62 | - node_js: "6.6" 63 | env: TEST=true ALLOW_FAILURE=true 64 | - node_js: "6.5" 65 | env: TEST=true ALLOW_FAILURE=true 66 | - node_js: "6.4" 67 | env: TEST=true ALLOW_FAILURE=true 68 | - node_js: "6.3" 69 | env: TEST=true ALLOW_FAILURE=true 70 | - node_js: "6.2" 71 | env: TEST=true ALLOW_FAILURE=true 72 | - node_js: "6.1" 73 | env: TEST=true ALLOW_FAILURE=true 74 | - node_js: "6.0" 75 | env: TEST=true ALLOW_FAILURE=true 76 | - node_js: "5.11" 77 | env: TEST=true ALLOW_FAILURE=true 78 | - node_js: "5.10" 79 | env: TEST=true ALLOW_FAILURE=true 80 | - node_js: "5.9" 81 | env: TEST=true ALLOW_FAILURE=true 82 | - node_js: "5.8" 83 | env: TEST=true ALLOW_FAILURE=true 84 | - node_js: "5.7" 85 | env: TEST=true ALLOW_FAILURE=true 86 | - node_js: "5.6" 87 | env: TEST=true ALLOW_FAILURE=true 88 | - node_js: "5.5" 89 | env: TEST=true ALLOW_FAILURE=true 90 | - node_js: "5.4" 91 | env: TEST=true ALLOW_FAILURE=true 92 | - node_js: "5.3" 93 | env: TEST=true ALLOW_FAILURE=true 94 | - node_js: "5.2" 95 | env: TEST=true ALLOW_FAILURE=true 96 | - node_js: "5.1" 97 | env: TEST=true ALLOW_FAILURE=true 98 | - node_js: "5.0" 99 | env: TEST=true ALLOW_FAILURE=true 100 | - node_js: "4.7" 101 | env: TEST=true ALLOW_FAILURE=true 102 | - node_js: "4.6" 103 | env: TEST=true ALLOW_FAILURE=true 104 | - node_js: "4.5" 105 | env: TEST=true ALLOW_FAILURE=true 106 | - node_js: "4.4" 107 | env: TEST=true ALLOW_FAILURE=true 108 | - node_js: "4.3" 109 | env: TEST=true ALLOW_FAILURE=true 110 | - node_js: "4.2" 111 | env: TEST=true ALLOW_FAILURE=true 112 | - node_js: "4.1" 113 | env: TEST=true ALLOW_FAILURE=true 114 | - node_js: "4.0" 115 | env: TEST=true ALLOW_FAILURE=true 116 | - node_js: "iojs-v3.2" 117 | env: TEST=true ALLOW_FAILURE=true 118 | - node_js: "iojs-v3.1" 119 | env: TEST=true ALLOW_FAILURE=true 120 | - node_js: "iojs-v3.0" 121 | env: TEST=true ALLOW_FAILURE=true 122 | - node_js: "iojs-v2.4" 123 | env: TEST=true ALLOW_FAILURE=true 124 | - node_js: "iojs-v2.3" 125 | env: TEST=true ALLOW_FAILURE=true 126 | - node_js: "iojs-v2.2" 127 | env: TEST=true ALLOW_FAILURE=true 128 | - node_js: "iojs-v2.1" 129 | env: TEST=true ALLOW_FAILURE=true 130 | - node_js: "iojs-v2.0" 131 | env: TEST=true ALLOW_FAILURE=true 132 | - node_js: "iojs-v1.7" 133 | env: TEST=true ALLOW_FAILURE=true 134 | - node_js: "iojs-v1.6" 135 | env: TEST=true ALLOW_FAILURE=true 136 | - node_js: "iojs-v1.5" 137 | env: TEST=true ALLOW_FAILURE=true 138 | - node_js: "iojs-v1.4" 139 | env: TEST=true ALLOW_FAILURE=true 140 | - node_js: "iojs-v1.3" 141 | env: TEST=true ALLOW_FAILURE=true 142 | - node_js: "iojs-v1.2" 143 | env: TEST=true ALLOW_FAILURE=true 144 | - node_js: "iojs-v1.1" 145 | env: TEST=true ALLOW_FAILURE=true 146 | - node_js: "iojs-v1.0" 147 | env: TEST=true ALLOW_FAILURE=true 148 | - node_js: "0.11" 149 | env: TEST=true ALLOW_FAILURE=true 150 | - node_js: "0.9" 151 | env: TEST=true ALLOW_FAILURE=true 152 | - node_js: "0.6" 153 | env: TEST=true ALLOW_FAILURE=true 154 | - node_js: "0.4" 155 | env: TEST=true ALLOW_FAILURE=true 156 | ##- node_js: "7" 157 | #env: TEST=true 158 | #os: osx 159 | #- node_js: "6" 160 | #env: TEST=true 161 | #os: osx 162 | #- node_js: "5" 163 | #env: TEST=true 164 | #os: osx 165 | #- node_js: "4" 166 | #env: TEST=true 167 | #os: osx 168 | #- node_js: "iojs" 169 | #env: TEST=true 170 | #os: osx 171 | #- node_js: "0.12" 172 | #env: TEST=true 173 | #os: osx 174 | #- node_js: "0.10" 175 | #env: TEST=true 176 | #os: osx 177 | #- node_js: "0.8" 178 | #env: TEST=true 179 | #os: osx 180 | allow_failures: 181 | - os: osx 182 | - env: TEST=true ALLOW_FAILURE=true 183 | --------------------------------------------------------------------------------