From 58aaa50297e560bef485bd9e3258dde6b05a48d1 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Apr 26 2017 10:17:01 +0000 Subject: import rh-nodejs6-nodejs-object-assign-4.1.0-1.el7 --- diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6a25d24 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/object-assign-4.1.0.tgz diff --git a/.rh-nodejs6-nodejs-object-assign.metadata b/.rh-nodejs6-nodejs-object-assign.metadata new file mode 100644 index 0000000..33f9ff8 --- /dev/null +++ b/.rh-nodejs6-nodejs-object-assign.metadata @@ -0,0 +1 @@ +7a3b3d0e98063d43f4c03f2e8ae6cd51a86883a0 SOURCES/object-assign-4.1.0.tgz diff --git a/README.md b/README.md deleted file mode 100644 index 98f42b4..0000000 --- a/README.md +++ /dev/null @@ -1,4 +0,0 @@ -The master branch has no content - -Look at the c7 branch if you are working with CentOS-7, or the c4/c5/c6 branch for CentOS-4, 5 or 6 -If you find this file in a distro specific branch, it means that no content has been checked in yet diff --git a/SOURCES/test.js b/SOURCES/test.js new file mode 100644 index 0000000..33dd6b3 --- /dev/null +++ b/SOURCES/test.js @@ -0,0 +1,131 @@ +'use strict'; +/* eslint-env mocha */ +var assert = require('assert'); + +Object.assign = undefined; +var objectAssign = require('./'); + +it('should have the correct length', function () { + assert.equal(objectAssign.length, 2); +}); + +it('should throw when target is not an object', function () { + assert.throws(function () { + objectAssign(null); + }, TypeError); + assert.throws(function () { + objectAssign(undefined); + }, TypeError); +}); + +it('should objectAssign own enumerable properties from source to target object', function () { + assert.deepEqual(objectAssign({foo: 0}, {bar: 1}), { + foo: 0, + bar: 1 + }); + assert.deepEqual(objectAssign({foo: 0}, null, undefined), {foo: 0}); + assert.deepEqual(objectAssign({foo: 0}, null, undefined, {bar: 1}, null), { + foo: 0, + bar: 1 + }); +}); + +it('should throw on null/undefined target', function () { + assert.throws(function () { + objectAssign(null, {}); + }); + + assert.throws(function () { + objectAssign(undefined, {}); + }); + + assert.throws(function () { + objectAssign(undefined, undefined); + }); +}); + +it('should not throw on null/undefined sources', function () { + assert.doesNotThrow(function () { + objectAssign({}, null); + }); + + assert.doesNotThrow(function () { + objectAssign({}, undefined); + }); + + assert.doesNotThrow(function () { + objectAssign({}, undefined, null); + }); +}); + +it('should support multiple sources', function () { + assert.deepEqual(objectAssign({foo: 0}, {bar: 1}, {bar: 2}), { + foo: 0, + bar: 2 + }); + assert.deepEqual(objectAssign({}, {}, {foo: 1}), {foo: 1}); +}); + +it('should only iterate own keys', function () { + var Unicorn = function () {}; + Unicorn.prototype.rainbows = 'many'; + var unicorn = new Unicorn(); + unicorn.bar = 1; + + assert.deepEqual(objectAssign({foo: 1}, unicorn), { + foo: 1, + bar: 1 + }); +}); + +it('should return the modified target object', function () { + var target = {}; + var returned = objectAssign(target, {a: 1}); + assert.equal(returned, target); +}); + +it('should support `Object.create(null)` objects', function () { + var obj = Object.create(null); + obj.foo = true; + assert.deepEqual(objectAssign({}, obj), {foo: true}); +}); + +it('should preserve property order', function () { + var letters = 'abcdefghijklmnopqrst'; + var source = {}; + letters.split('').forEach(function (letter) { + source[letter] = letter; + }); + var target = objectAssign({}, source); + assert.equal(Object.keys(target).join(''), letters); +}); + +it('should accept primitives as target', function () { + var target = objectAssign('abcdefg', {foo: 'bar'}); + var strObj = Object('abcdefg'); + strObj.foo = 'bar'; + assert.deepEqual(target, strObj); +}); + +if (typeof Symbol !== 'undefined') { + it('should support symbol properties', function () { + var target = {}; + var source = {}; + var sym = Symbol('foo'); + source[sym] = 'bar'; + objectAssign(target, source); + assert.equal(target[sym], 'bar'); + }); + + it('should only copy enumerable symbols', function () { + var target = {}; + var source = {}; + var sym = Symbol('foo'); + Object.defineProperty(source, sym, { + enumerable: false, + value: 'bar' + }); + objectAssign(target, source); + assert.equal(target[sym], undefined); + }); +} diff --git a/SPECS/nodejs-object-assign.spec b/SPECS/nodejs-object-assign.spec new file mode 100644 index 0000000..38daa42 --- /dev/null +++ b/SPECS/nodejs-object-assign.spec @@ -0,0 +1,81 @@ +%{?scl:%scl_package nodejs-%{module_name}} +%{!?scl:%global pkg_name %{name}} +%{?nodejs_find_provides_and_requires} + +%global enable_tests 0 +%global module_name object-assign + +Name: %{?scl_prefix}nodejs-%{module_name} +Version: 4.1.0 +Release: 1%{?dist} +Summary: ES6 Object.assign() ponyfill +License: MIT +URL: https://github.com/sindresorhus/object-assign +Source0: http://registry.npmjs.org/%{module_name}/-/%{module_name}-%{version}.tgz +Source1: https://raw.githubusercontent.com/sindresorhus/object-assign/master/test.js +BuildArch: noarch +ExclusiveArch: %{nodejs_arches} noarch + +BuildRequires: %{?scl_prefix}runtime + +%if 0%{?enable_tests} +BuildRequires: %{?scl_prefix}npm(mocha) +%endif + +%description +%{summary}. + +%prep +%setup -q -n package +rm -rf node_modules + +cp -p %{SOURCE1} . + +%build +# nothing to build + +%install +mkdir -p %{buildroot}%{nodejs_sitelib}/%{module_name} +cp -pr package.json *.js %{buildroot}%{nodejs_sitelib}/%{module_name} +%nodejs_symlink_deps + +%if 0%{?enable_tests} + +%check +%nodejs_symlink_deps --check +mocha +%endif + +%files +%{!?_licensedir:%global license %doc} +%doc readme.md +%license license +%{nodejs_sitelib}/%{module_name} + +%changelog +* Tue Sep 13 2016 Zuzana Svetlikova - 4.1.0-1 +- Updated with script + +* Tue Feb 16 2016 Zuzana Svetlikova - 4.0.1-7 +- Use macro in -runtime dependency + +* Sun Feb 14 2016 Zuzana Svetlikova - 4.0.1-6 +- Rebuilt with updated metapackage + +* Thu Jan 14 2016 Tomas Hrcka - 4.0.1-5 +- Enable find provides and requires macro + +* Mon Jan 11 2016 Tomas Hrcka - 4.0.1-4 +- Enable scl macros + +* Fri Dec 18 2015 Troy Dawson - 4.0.1-2 +- Update to 4.0.1 + +* Wed Sep 09 2015 Troy Dawson - 2.0.0-3 +- Disable tests until we have all the dependencies + +* Sun Dec 07 2014 Parag Nemade - 2.0.0-2 +- Add test.js from upstream and enable tests + +* Thu Dec 04 2014 Parag Nemade - 2.0.0-1 +- Initial packaging