Run of fresh-releases for node-to-fast-properties

Try this locally (using silver-platter):

debian-svp new-upstream node-to-fast-properties 

Merge these changes:

git pull https://janitor.debian.net/git/node-to-fast-properties new-upstream

Summary

Merged new upstream version: 2.0.0 (was: 1.0.2).

Diff

=== modified file '.editorconfig'
--- a/.editorconfig	2016-11-21 04:47:04 +0000
+++ b/.editorconfig	2019-06-27 07:08:17 +0000
@@ -7,6 +7,6 @@
 trim_trailing_whitespace = true
 insert_final_newline = true
 
-[{package.json,*.yml}]
+[*.yml]
 indent_style = space
 indent_size = 2

=== modified file '.gitattributes'
--- a/.gitattributes	2016-11-21 04:47:04 +0000
+++ b/.gitattributes	2019-06-27 07:08:17 +0000
@@ -1,1 +1,2 @@
 * text=auto
+*.js text eol=lf

=== modified file '.travis.yml'
--- a/.travis.yml	2016-11-21 04:47:04 +0000
+++ b/.travis.yml	2019-06-27 07:08:17 +0000
@@ -1,7 +1,5 @@
-sudo: false
 language: node_js
 node_js:
-  - '5'
+  - '8'
+  - '6'
   - '4'
-  - '0.12'
-  - '0.10'

=== modified file 'debian/changelog'
--- a/debian/changelog	2016-11-21 04:47:45 +0000
+++ b/debian/changelog	2019-06-27 07:08:17 +0000
@@ -1,3 +1,9 @@
+node-to-fast-properties (2.0.0-1) UNRELEASED; urgency=medium
+
+  * New upstream release.
+
+ -- Debian Janitor <janitor@jelmer.uk>  Thu, 27 Jun 2019 07:08:14 +0000
+
 node-to-fast-properties (1.0.2-1) unstable; urgency=low
 
   * Initial release (Closes: #845174)

=== modified file 'index.js'
--- a/index.js	2016-11-21 04:47:04 +0000
+++ b/index.js	2019-06-27 07:08:17 +0000
@@ -1,8 +1,27 @@
 'use strict';
-module.exports = function toFastProperties(obj) {
-	function f() {}
-	f.prototype = obj;
-	new f();
-	return;
-	eval(obj);
+
+let fastProto = null;
+
+// Creates an object with permanently fast properties in V8. See Toon Verwaest's
+// post https://medium.com/@tverwaes/setting-up-prototypes-in-v8-ec9c9491dfe2#5f62
+// for more details. Use %HasFastProperties(object) and the Node.js flag
+// --allow-natives-syntax to check whether an object has fast properties.
+function FastObject(o) {
+	// A prototype object will have "fast properties" enabled once it is checked
+	// against the inline property cache of a function, e.g. fastProto.property:
+	// https://github.com/v8/v8/blob/6.0.122/test/mjsunit/fast-prototype.js#L48-L63
+	if (fastProto !== null && typeof fastProto.property) {
+		const result = fastProto;
+		fastProto = FastObject.prototype = null;
+		return result;
+	}
+	fastProto = FastObject.prototype = o == null ? Object.create(null) : o;
+	return new FastObject;
+}
+
+// Initialize the inline property cache of FastObject
+FastObject();
+
+module.exports = function toFastproperties(o) {
+	return FastObject(o);
 };

=== modified file 'license'
--- a/license	2016-11-21 04:47:04 +0000
+++ b/license	2019-06-27 07:08:17 +0000
@@ -1,22 +1,10 @@
-The MIT License (MIT)
+MIT License
 
 Copyright (c) 2014 Petka Antonov
               2015 Sindre Sorhus
 
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

=== modified file 'package.json'
--- a/package.json	2016-11-21 04:47:04 +0000
+++ b/package.json	2019-06-27 07:08:17 +0000
@@ -1,6 +1,6 @@
 {
   "name": "to-fast-properties",
-  "version": "1.0.2",
+  "version": "2.0.0",
   "description": "Force V8 to use fast properties for an object",
   "license": "MIT",
   "repository": "sindresorhus/to-fast-properties",
@@ -10,7 +10,7 @@
     "url": "sindresorhus.com"
   },
   "engines": {
-    "node": ">=0.10.0"
+    "node": ">=4"
   },
   "scripts": {
     "test": "node --allow-natives-syntax test.js"

=== modified file 'readme.md'
--- a/readme.md	2016-11-21 04:47:04 +0000
+++ b/readme.md	2019-06-27 07:08:17 +0000
@@ -34,4 +34,4 @@
 
 ## License
 
-MIT © Petka Antonov, Sindre Sorhus
+MIT © Petka Antonov, John-David Dalton, Sindre Sorhus

=== modified file 'test.js'
--- a/test.js	2016-11-21 04:47:04 +0000
+++ b/test.js	2019-06-27 07:08:17 +0000
@@ -1,16 +1,17 @@
 'use strict';
-var test = require('ava');
-var toFastProperties = require('./');
+const test = require('ava');
+const toFastProperties = require('.');
 
-var toSlowProperties = function (obj) {
-	for (var i = 0; i < 1000; ++i) {
-		obj['foo' + i] = 'foo';
+const toSlowProperties = obj => {
+	for (let i = 0; i < 1000; i++) {
+		obj[`foo${i}`] = 'foo';
 	}
+
 	return obj;
 };
 
-test(function (t) {
-	var obj = toSlowProperties({});
+test(t => {
+	const obj = toSlowProperties({});
 	obj.foo = 'foo';
 	t.assert(!%HasFastProperties(obj), 'obj has slow properties');
 

Full build log Full worker log