@enact/core
Advanced tools
Comparing version 2.0.0-alpha.4 to 2.0.0-alpha.5
@@ -5,2 +5,12 @@ # Change Log | ||
## [2.0.0-alpha.5] - 2018-03-07 | ||
### Removed | ||
- `core/util.childrenEquals` which was no longer supported by React 16 | ||
### Added | ||
- `core/util.memoize` method to optimize the execution of expensive functions | ||
## [2.0.0-alpha.4] - 2018-02-13 | ||
@@ -24,4 +34,16 @@ | ||
## [1.13.3] - 2017-01-16 | ||
## [1.15.0] - 2018-02-28 | ||
### Deprecated | ||
- `core/util/childrenEquals`, to be removed in 2.0.0 | ||
## [1.14.0] - 2018-02-23 | ||
### Deprecated | ||
- `core/factory`, to be removed in 2.0.0 | ||
## [1.13.3] - 2018-01-16 | ||
### Fixed | ||
@@ -28,0 +50,0 @@ |
@@ -6,4 +6,8 @@ 'use strict'; | ||
}); | ||
exports.factory = undefined; | ||
exports.privateFactory = exports.factory = undefined; | ||
var _deprecate = require('../internal/deprecate'); | ||
var _deprecate2 = _interopRequireDefault(_deprecate); | ||
var _css = require('./css'); | ||
@@ -26,2 +30,8 @@ | ||
*/ | ||
/** | ||
* Exports the {@link core/factory.factory} function for creating customizeable components. | ||
* | ||
* @module core/factory | ||
*/ | ||
var feature = function feature(prop, fn, defaultConfig, config) { | ||
@@ -87,9 +97,4 @@ var defaultValue = defaultConfig ? defaultConfig[prop] : null; | ||
* @public | ||
* @deprecated | ||
*/ | ||
/** | ||
* Exports the {@link core/factory.factory} function for creating customizeable components. | ||
* | ||
* @module core/factory | ||
*/ | ||
var factory = function factory(defaultConfig, fn) { | ||
@@ -113,3 +118,6 @@ return function (config) { | ||
exports.default = factory; | ||
exports.factory = factory; | ||
var deprecatedFactory = (0, _deprecate2.default)(factory, { name: 'core/factory', since: '1.14.0', until: '2.0.0' }); | ||
exports.default = deprecatedFactory; | ||
exports.factory = deprecatedFactory; | ||
exports.privateFactory = factory; |
@@ -9,4 +9,2 @@ 'use strict'; | ||
var _factory2 = _interopRequireDefault(_factory); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -18,3 +16,3 @@ | ||
var fn = _sinon2.default.spy(); | ||
var fnFactory = (0, _factory2.default)(fn); | ||
var fnFactory = (0, _factory.privateFactory)(fn); | ||
fnFactory(); | ||
@@ -36,3 +34,3 @@ | ||
}; | ||
var fnFactory = (0, _factory2.default)(fn); | ||
var fnFactory = (0, _factory.privateFactory)(fn); | ||
fnFactory(config); | ||
@@ -51,3 +49,3 @@ | ||
}; | ||
var fnFactory = (0, _factory2.default)(fn); | ||
var fnFactory = (0, _factory.privateFactory)(fn); | ||
fnFactory(config); | ||
@@ -54,0 +52,0 @@ |
@@ -465,9 +465,8 @@ 'use strict'; | ||
* | ||
* @method forProp | ||
* @method log | ||
* @memberof core/handle | ||
* @param {String} prop Name of property on props object | ||
* @param {*} value Value of property | ||
* @param {Object} ev Event | ||
* @param {Object} props Props object | ||
* @returns {Boolean} Event handler | ||
* @param {String} message Custom message | ||
* @param {Object} ev Event | ||
* @param {...*} [args] Any args passed are logged | ||
* @returns {Boolean} Always returns `true` | ||
*/ | ||
@@ -474,0 +473,0 @@ var log = handle.log = (0, _curry2.default)(function (message, ev) { |
{ | ||
"name": "@enact/core", | ||
"version": "2.0.0-alpha.4", | ||
"version": "2.0.0-alpha.5", | ||
"description": "Enact is an open source JavaScript framework containing everything you need to create a fast, scalable mobile or web application.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -1,4 +0,4 @@ | ||
# @enact/core | ||
# @enact/core [![npm (scoped)](https://img.shields.io/npm/v/@enact/core.svg?style=flat-square)](https://www.npmjs.com/package/@enact/core) | ||
> `@enact/core` contains the set of basic building blocks for an Enact-based application. | ||
> The set of essential building blocks for an Enact-based application. | ||
@@ -5,0 +5,0 @@ Enact core provides several abstractions to be used with React-based applications. These include `core/kind`, a |
100
util/util.js
@@ -6,3 +6,3 @@ 'use strict'; | ||
}); | ||
exports.withContextFromProps = exports.perfNow = exports.mergeClassNameMaps = exports.Job = exports.isRenderable = exports.extractAriaProps = exports.coerceArray = exports.coerceFunction = exports.childrenEquals = exports.cap = undefined; | ||
exports.withContextFromProps = exports.perfNow = exports.mergeClassNameMaps = exports.memoize = exports.Job = exports.isRenderable = exports.extractAriaProps = exports.coerceFunction = exports.coerceArray = exports.cap = undefined; | ||
@@ -20,10 +20,2 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; /** | ||
var _compose = require('ramda/src/compose'); | ||
var _compose2 = _interopRequireDefault(_compose); | ||
var _equals = require('ramda/src/equals'); | ||
var _equals2 = _interopRequireDefault(_equals); | ||
var _is = require('ramda/src/is'); | ||
@@ -33,18 +25,2 @@ | ||
var _map = require('ramda/src/map'); | ||
var _map2 = _interopRequireDefault(_map); | ||
var _prop = require('ramda/src/prop'); | ||
var _prop2 = _interopRequireDefault(_prop); | ||
var _react = require('react'); | ||
var _react2 = _interopRequireDefault(_react); | ||
var _sort = require('ramda/src/sort'); | ||
var _sort2 = _interopRequireDefault(_sort); | ||
var _unless = require('ramda/src/unless'); | ||
@@ -54,10 +30,2 @@ | ||
var _useWith = require('ramda/src/useWith'); | ||
var _useWith2 = _interopRequireDefault(_useWith); | ||
var _when = require('ramda/src/when'); | ||
var _when2 = _interopRequireDefault(_when); | ||
var _withContext = require('recompose/withContext'); | ||
@@ -73,41 +41,3 @@ | ||
var orderedKeys = (0, _map2.default)((0, _when2.default)(_react2.default.isValidElement, (0, _prop2.default)('key'))); | ||
var unorderedKeys = (0, _compose2.default)((0, _sort2.default)(function (a, b) { | ||
return a - b; | ||
}), orderedKeys); | ||
var unorderedEquals = (0, _useWith2.default)(_equals2.default, [unorderedKeys, unorderedKeys]); | ||
var orderedEquals = (0, _useWith2.default)(_equals2.default, [orderedKeys, orderedKeys]); | ||
/** | ||
* Compares the keys of two sets of children and returns `true` if they are equal. | ||
* | ||
* @method | ||
* @memberof core/util | ||
* @param {Node[]} prev Array of children | ||
* @param {Node[]} next Array of children | ||
* @param {Boolean} [ordered] `true` to require the same order | ||
* | ||
* @returns {Boolean} `true` if the children are the same | ||
*/ | ||
var childrenEquals = function childrenEquals(prev, next) { | ||
var ordered = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; | ||
var prevChildren = _react2.default.Children.toArray(prev); | ||
var nextChildren = _react2.default.Children.toArray(next); | ||
if (prevChildren.length !== nextChildren.length) { | ||
return false; | ||
} else if (prevChildren.length === 1 && nextChildren.length === 1) { | ||
var c1 = prevChildren[0]; | ||
var c2 = nextChildren[0]; | ||
return (0, _equals2.default)(c1, c2); | ||
} else if (ordered) { | ||
return orderedEquals(prevChildren, nextChildren); | ||
} else { | ||
return unorderedEquals(prevChildren, nextChildren); | ||
} | ||
}; | ||
/** | ||
* Capitalizes a given string (not locale aware). | ||
@@ -193,3 +123,3 @@ * | ||
/* | ||
/** | ||
* Accepts a `contextTypes` object and a component, then matches those contextTypes with incoming | ||
@@ -281,11 +211,33 @@ * props on the component, and sends them to context on that component for children to to access. | ||
/** | ||
* Creates a function that memoizes the result of `fn`. | ||
* | ||
* @method | ||
* @memberof core/util | ||
* @param {Function} fn The function to have its output memoized. | ||
* @returns {Function} Returns the new memoized function. | ||
*/ | ||
var memoize = function memoize(fn) { | ||
var cache = {}; | ||
return function () { | ||
var n = arguments.length <= 0 ? undefined : arguments[0]; | ||
if (n in cache) { | ||
return cache[n]; | ||
} else { | ||
var result = fn(n); | ||
cache[n] = result; | ||
return result; | ||
} | ||
}; | ||
}; | ||
exports.cap = cap; | ||
exports.childrenEquals = childrenEquals; | ||
exports.coerceArray = coerceArray; | ||
exports.coerceFunction = coerceFunction; | ||
exports.coerceArray = coerceArray; | ||
exports.extractAriaProps = extractAriaProps; | ||
exports.isRenderable = isRenderable; | ||
exports.Job = _Job2.default; | ||
exports.memoize = memoize; | ||
exports.mergeClassNameMaps = mergeClassNameMaps; | ||
exports.perfNow = perfNow; | ||
exports.withContextFromProps = withContextFromProps; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
52
162760
3846