Comparing version 0.1.0 to 0.2.0
@@ -0,2 +1,7 @@ | ||
# 0.2.0 - [22-01-2017] | ||
- Added polyfills for `Object.assign`, `Object.entries` & `Object.getOwnPropertyDescriptors`; | ||
- Added CI; | ||
- Fixed LICENSE; | ||
# 0.1.0 - [21-01-2017] | ||
- :boom: Created `uncouple` module; |
/*! | ||
* uncouple v0.1.0 | ||
* (c) 2018-present Vitor Cavalcanti | ||
* uncouple v0.2.0 | ||
* (c) 2018-present Vitor Cavalcanti <vitorluizc@outlook.com> (https://vitorluizc.github.io) | ||
* Released under the MIT License. | ||
@@ -8,2 +8,8 @@ */ | ||
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } | ||
var entries = _interopDefault(require('object.entries')); | ||
var assign = _interopDefault(require('object.assign')); | ||
var getOwnPropertyDescriptors = _interopDefault(require('object.getownpropertydescriptors')); | ||
var map = Function.call.bind(Array.prototype.map); | ||
@@ -15,6 +21,2 @@ | ||
var entries = Object.entries; | ||
var getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors; | ||
var obj; | ||
@@ -25,3 +27,4 @@ var toProperty = function (ref) { | ||
return Object.assign({ name: name }, descriptor); | ||
var property = assign({}, descriptor, { name: name }); | ||
return property; | ||
}; | ||
@@ -41,3 +44,4 @@ | ||
return Object.assign({}, object, ( obj = {}, obj[name] = Function.call.bind(value), obj)); | ||
var result = assign({}, object, ( obj = {}, obj[name] = Function.call.bind(value), obj)); | ||
return result; | ||
}; | ||
@@ -44,0 +48,0 @@ |
/*! | ||
* uncouple v0.1.0 | ||
* (c) 2018-present Vitor Cavalcanti | ||
* uncouple v0.2.0 | ||
* (c) 2018-present Vitor Cavalcanti <vitorluizc@outlook.com> (https://vitorluizc.github.io) | ||
* Released under the MIT License. | ||
*/ | ||
import entries from 'object.entries'; | ||
import assign from 'object.assign'; | ||
import getOwnPropertyDescriptors from 'object.getownpropertydescriptors'; | ||
var map = Function.call.bind(Array.prototype.map); | ||
@@ -12,6 +16,2 @@ | ||
var entries = Object.entries; | ||
var getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors; | ||
var obj; | ||
@@ -22,3 +22,4 @@ var toProperty = function (ref) { | ||
return Object.assign({ name: name }, descriptor); | ||
var property = assign({}, descriptor, { name: name }); | ||
return property; | ||
}; | ||
@@ -38,3 +39,4 @@ | ||
return Object.assign({}, object, ( obj = {}, obj[name] = Function.call.bind(value), obj)); | ||
var result = assign({}, object, ( obj = {}, obj[name] = Function.call.bind(value), obj)); | ||
return result; | ||
}; | ||
@@ -41,0 +43,0 @@ |
{ | ||
"name": "uncouple", | ||
"version": "0.1.0", | ||
"description": "Uncople object properties and methods.", | ||
"version": "0.2.0", | ||
"description": "Uncouple prototype methods.", | ||
"main": "dist/uncouple.cjs.js", | ||
@@ -17,5 +17,13 @@ "module": "dist/uncouple.m.js", | ||
"keywords": [ | ||
"uncouple" | ||
"uncouple", | ||
"prototype", | ||
"duck-typing", | ||
"functional", | ||
"functional-programming" | ||
], | ||
"author": "Vitor Cavalcanti", | ||
"author": { | ||
"url": "https://vitorluizc.github.io/", | ||
"name": "Vitor Cavalcanti", | ||
"email": "vitorluizc@outlook.com" | ||
}, | ||
"license": "MIT", | ||
@@ -29,3 +37,8 @@ "bugs": { | ||
"bili": "^1.6.5" | ||
}, | ||
"dependencies": { | ||
"object.assign": "^4.1.0", | ||
"object.entries": "^1.0.4", | ||
"object.getownpropertydescriptors": "^2.0.3" | ||
} | ||
} |
# Uncouple | ||
[![Build Status][ci-status-badge]][ci-status] | ||
Uncouple prototype methods. | ||
@@ -34,1 +36,3 @@ | ||
[license]: ./LICENSE | ||
[ci-status]: https://travis-ci.org/VitorLuizC/uncouple | ||
[ci-status-badge]: https://travis-ci.org/VitorLuizC/uncouple.svg?branch=master |
import { map, filter, reduce } from './collection'; | ||
import { entries, getOwnPropertyDescriptors } from './object'; | ||
import { assign, entries, getOwnPropertyDescriptors } from './object'; | ||
const toProperty = ([ name, descriptor ]) => ({ name, ...descriptor }); | ||
const toProperty = ([ name, descriptor ]) => { | ||
const property = assign({}, descriptor, { name }); | ||
return property; | ||
}; | ||
@@ -18,6 +21,6 @@ const getProperties = (object) => { | ||
const withMethod = (object, { name, value }) => ({ | ||
...object, | ||
[name]: Function.call.bind(value) | ||
}); | ||
const withMethod = (object, { name, value }) => { | ||
const result = assign({}, object, { [name]: Function.call.bind(value) }); | ||
return result; | ||
}; | ||
@@ -24,0 +27,0 @@ const uncouple = (object) => { |
@@ -1,3 +0,5 @@ | ||
export const entries = Object.entries; | ||
export { default as entries } from 'object.entries'; | ||
export const getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors; | ||
export { default as assign } from 'object.assign'; | ||
export { default as getOwnPropertyDescriptors } from 'object.getownpropertydescriptors'; |
Sorry, the diff of this file is not supported yet
8223
13
119
38
3
+ Addedobject.assign@^4.1.0
+ Addedobject.entries@^1.0.4
+ Addedarray-buffer-byte-length@1.0.2(transitive)
+ Addedarray.prototype.reduce@1.0.7(transitive)
+ Addedarraybuffer.prototype.slice@1.0.4(transitive)
+ Addedasync-function@1.0.0(transitive)
+ Addedavailable-typed-arrays@1.0.7(transitive)
+ Addedcall-bind@1.0.8(transitive)
+ Addedcall-bind-apply-helpers@1.0.1(transitive)
+ Addedcall-bound@1.0.3(transitive)
+ Addeddata-view-buffer@1.0.2(transitive)
+ Addeddata-view-byte-length@1.0.2(transitive)
+ Addeddata-view-byte-offset@1.0.1(transitive)
+ Addeddefine-data-property@1.1.4(transitive)
+ Addeddefine-properties@1.2.1(transitive)
+ Addeddunder-proto@1.0.1(transitive)
+ Addedes-abstract@1.23.9(transitive)
+ Addedes-array-method-boxes-properly@1.0.0(transitive)
+ Addedes-define-property@1.0.1(transitive)
+ Addedes-errors@1.3.0(transitive)
+ Addedes-object-atoms@1.1.1(transitive)
+ Addedes-set-tostringtag@2.1.0(transitive)
+ Addedes-to-primitive@1.3.0(transitive)
+ Addedfor-each@0.3.3(transitive)
+ Addedfunction-bind@1.1.2(transitive)
+ Addedfunction.prototype.name@1.1.8(transitive)
+ Addedfunctions-have-names@1.2.3(transitive)
+ Addedget-intrinsic@1.2.7(transitive)
+ Addedget-proto@1.0.1(transitive)
+ Addedget-symbol-description@1.1.0(transitive)
+ Addedglobalthis@1.0.4(transitive)
+ Addedgopd@1.2.0(transitive)
+ Addedhas-bigints@1.1.0(transitive)
+ Addedhas-property-descriptors@1.0.2(transitive)
+ Addedhas-proto@1.2.0(transitive)
+ Addedhas-symbols@1.1.0(transitive)
+ Addedhas-tostringtag@1.0.2(transitive)
+ Addedhasown@2.0.2(transitive)
+ Addedinternal-slot@1.1.0(transitive)
+ Addedis-array-buffer@3.0.5(transitive)
+ Addedis-async-function@2.1.1(transitive)
+ Addedis-bigint@1.1.0(transitive)
+ Addedis-boolean-object@1.2.1(transitive)
+ Addedis-callable@1.2.7(transitive)
+ Addedis-data-view@1.0.2(transitive)
+ Addedis-date-object@1.1.0(transitive)
+ Addedis-finalizationregistry@1.1.1(transitive)
+ Addedis-generator-function@1.1.0(transitive)
+ Addedis-map@2.0.3(transitive)
+ Addedis-number-object@1.1.1(transitive)
+ Addedis-regex@1.2.1(transitive)
+ Addedis-set@2.0.3(transitive)
+ Addedis-shared-array-buffer@1.0.4(transitive)
+ Addedis-string@1.1.1(transitive)
+ Addedis-symbol@1.1.1(transitive)
+ Addedis-typed-array@1.1.15(transitive)
+ Addedis-weakmap@2.0.2(transitive)
+ Addedis-weakref@1.1.0(transitive)
+ Addedis-weakset@2.0.4(transitive)
+ Addedisarray@2.0.5(transitive)
+ Addedmath-intrinsics@1.1.0(transitive)
+ Addedobject-inspect@1.13.3(transitive)
+ Addedobject-keys@1.1.1(transitive)
+ Addedobject.assign@4.1.7(transitive)
+ Addedobject.entries@1.1.8(transitive)
+ Addedobject.getownpropertydescriptors@2.1.8(transitive)
+ Addedown-keys@1.0.1(transitive)
+ Addedpossible-typed-array-names@1.0.0(transitive)
+ Addedreflect.getprototypeof@1.0.10(transitive)
+ Addedregexp.prototype.flags@1.5.4(transitive)
+ Addedsafe-array-concat@1.1.3(transitive)
+ Addedsafe-push-apply@1.0.0(transitive)
+ Addedsafe-regex-test@1.1.0(transitive)
+ Addedset-function-length@1.2.2(transitive)
+ Addedset-function-name@2.0.2(transitive)
+ Addedset-proto@1.0.0(transitive)
+ Addedside-channel@1.1.0(transitive)
+ Addedside-channel-list@1.0.0(transitive)
+ Addedside-channel-map@1.0.1(transitive)
+ Addedside-channel-weakmap@1.0.2(transitive)
+ Addedstring.prototype.trim@1.2.10(transitive)
+ Addedstring.prototype.trimend@1.0.9(transitive)
+ Addedstring.prototype.trimstart@1.0.8(transitive)
+ Addedtyped-array-buffer@1.0.3(transitive)
+ Addedtyped-array-byte-length@1.0.3(transitive)
+ Addedtyped-array-byte-offset@1.0.4(transitive)
+ Addedtyped-array-length@1.0.7(transitive)
+ Addedunbox-primitive@1.1.0(transitive)
+ Addedwhich-boxed-primitive@1.1.1(transitive)
+ Addedwhich-builtin-type@1.2.1(transitive)
+ Addedwhich-collection@1.0.2(transitive)
+ Addedwhich-typed-array@1.1.18(transitive)