瀏覽代碼

Fixed gulp lodash - it should remove src/lib/lodash before building new one.

Piotrek Koszuliński 9 年之前
父節點
當前提交
25eaae4132
共有 36 個文件被更改,包括 40 次插入1052 次删除
  1. 25 11
      packages/ckeditor5-utils/dev/tasks/lodash/tasks.js
  2. 1 0
      packages/ckeditor5-utils/package.json
  3. 4 3
      packages/ckeditor5-utils/src/config.js
  4. 0 28
      packages/ckeditor5-utils/src/lib/lodash/array/last.js
  5. 0 58
      packages/ckeditor5-utils/src/lib/lodash/function/restParam.js
  6. 0 20
      packages/ckeditor5-utils/src/lib/lodash/internal/arrayCopy.js
  7. 0 32
      packages/ckeditor5-utils/src/lib/lodash/internal/assignWith.js
  8. 0 23
      packages/ckeditor5-utils/src/lib/lodash/internal/baseCopy.js
  9. 0 17
      packages/ckeditor5-utils/src/lib/lodash/internal/baseForIn.js
  10. 0 39
      packages/ckeditor5-utils/src/lib/lodash/internal/bindCallback.js
  11. 0 22
      packages/ckeditor5-utils/src/lib/lodash/internal/bufferClone.js
  12. 0 15
      packages/ckeditor5-utils/src/lib/lodash/internal/isArrayLike.js
  13. 0 20
      packages/ckeditor5-utils/src/lib/lodash/internal/isLength.js
  14. 0 12
      packages/ckeditor5-utils/src/lib/lodash/internal/isObjectLike.js
  15. 0 41
      packages/ckeditor5-utils/src/lib/lodash/internal/shimKeys.js
  16. 0 14
      packages/ckeditor5-utils/src/lib/lodash/internal/toObject.js
  17. 0 78
      packages/ckeditor5-utils/src/lib/lodash/lang/clone.js
  18. 0 2
      packages/ckeditor5-utils/src/lib/lodash/lang/eq.js
  19. 0 34
      packages/ckeditor5-utils/src/lib/lodash/lang/isArguments.js
  20. 0 48
      packages/ckeditor5-utils/src/lib/lodash/lang/isArray.js
  21. 0 62
      packages/ckeditor5-utils/src/lib/lodash/lang/isEqual.js
  22. 0 38
      packages/ckeditor5-utils/src/lib/lodash/lang/isFunction.js
  23. 0 48
      packages/ckeditor5-utils/src/lib/lodash/lang/isNative.js
  24. 0 37
      packages/ckeditor5-utils/src/lib/lodash/lang/isObject.js
  25. 0 79
      packages/ckeditor5-utils/src/lib/lodash/lang/isPlainObject.js
  26. 0 74
      packages/ckeditor5-utils/src/lib/lodash/lang/isTypedArray.js
  27. 0 51
      packages/ckeditor5-utils/src/lib/lodash/object/assign.js
  28. 0 2
      packages/ckeditor5-utils/src/lib/lodash/object/extend.js
  29. 0 45
      packages/ckeditor5-utils/src/lib/lodash/object/keys.js
  30. 0 64
      packages/ckeditor5-utils/src/lib/lodash/object/keysIn.js
  31. 0 5
      packages/ckeditor5-utils/src/lib/lodash/utility.js
  32. 0 20
      packages/ckeditor5-utils/src/lib/lodash/utility/identity.js
  33. 4 4
      packages/ckeditor5-utils/src/observablemixin.js
  34. 2 2
      packages/ckeditor5-utils/src/utils.js
  35. 2 2
      packages/ckeditor5-utils/tests/emittermixin.js
  36. 2 2
      packages/ckeditor5-utils/tests/lodash.js

+ 25 - 11
packages/ckeditor5-utils/dev/tasks/lodash/tasks.js

@@ -4,23 +4,37 @@
 
 const gulp = require( 'gulp' );
 const build = require( 'lodash-cli' );
+const del = require( 'del' );
+
+const DEST_PATH = 'src/lib/lodash';
 
 module.exports = function() {
 	const tasks = {
-		lodash( done ) {
-			build( [
-				'modularize',
-				// 'modern',
-				'exports=es',
-				'include=clone,extend,isPlainObject,isObject,isArray,last,isEqual',
-				'--development',
-				'--output', 'src/lib/lodash'
-			], ( e ) => {
-				done( e instanceof Error ? e : null );
-			} );
+		lodash() {
+			return del( DEST_PATH )
+				.then( buildLodash );
 		}
 	};
+
 	gulp.task( 'lodash', tasks.lodash );
 
 	return tasks;
 };
+
+function buildLodash() {
+	return new Promise( ( resolve, reject ) => {
+		build( [
+			'modularize',
+			'exports=es',
+			'include=clone,extend,isPlainObject,isObject,isArray,last,isEqual',
+			'--development',
+			'--output', DEST_PATH
+		], ( err ) => {
+			if ( err instanceof Error ) {
+				reject( err );
+			} else {
+				resolve( null );
+			}
+		} );
+	} );
+}

+ 1 - 0
packages/ckeditor5-utils/package.json

@@ -7,6 +7,7 @@
   ],
   "dependencies": {},
   "devDependencies": {
+    "del": "^2.2.0",
     "git-guppy": "^1.1.0",
     "gulp": "^3.9.0",
     "gulp-filter": "^3.0.1",

+ 4 - 3
packages/ckeditor5-utils/src/config.js

@@ -6,7 +6,8 @@
 'use strict';
 
 import ObservableMixin from './observablemixin.js';
-import utilsLang from './lib/lodash/lang.js';
+import isObject from './lib/lodash/isObject.js';
+import isPlainObject from './lib/lodash/isPlainObject.js';
 import utils from './utils.js';
 
 /**
@@ -69,7 +70,7 @@ export default class Config {
 	set( name, value ) {
 		// Just pass the call to the original set() in case of an object. It'll deal with recursing through the
 		// object and calling set( name, value ) again for each property.
-		if ( utilsLang.isObject( name ) ) {
+		if ( isObject( name ) ) {
 			ObservableMixin.set.apply( this, arguments );
 
 			return;
@@ -95,7 +96,7 @@ export default class Config {
 		}
 
 		// Values set as pure objects will be treated as Config subsets.
-		if ( utilsLang.isPlainObject( value ) ) {
+		if ( isPlainObject( value ) ) {
 			// If the target is an instance of Config (a deep config subset).
 			if ( target[ name ] instanceof Config ) {
 				// Amend the target with the value, instead of replacing it.

+ 0 - 28
packages/ckeditor5-utils/src/lib/lodash/array/last.js

@@ -1,28 +0,0 @@
-/**
- * lodash 3.10.1 (Custom Build) <https://lodash.com/>
- * Build: `lodash modularize modern exports="es" include="clone,extend,isPlainObject,isObject,isArray,last,isEqual" --development --output src/lib/lodash`
- * Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
- * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
- * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
- * Available under MIT license <https://lodash.com/license>
- */
-
-/**
- * Gets the last element of `array`.
- *
- * @static
- * @memberOf _
- * @category Array
- * @param {Array} array The array to query.
- * @returns {*} Returns the last element of `array`.
- * @example
- *
- * _.last([1, 2, 3]);
- * // => 3
- */
-function last(array) {
-  var length = array ? array.length : 0;
-  return length ? array[length - 1] : undefined;
-}
-
-export default last;

+ 0 - 58
packages/ckeditor5-utils/src/lib/lodash/function/restParam.js

@@ -1,58 +0,0 @@
-/** Used as the `TypeError` message for "Functions" methods. */
-var FUNC_ERROR_TEXT = 'Expected a function';
-
-/* Native method references for those with the same name as other `lodash` methods. */
-var nativeMax = Math.max;
-
-/**
- * Creates a function that invokes `func` with the `this` binding of the
- * created function and arguments from `start` and beyond provided as an array.
- *
- * **Note:** This method is based on the [rest parameter](https://developer.mozilla.org/Web/JavaScript/Reference/Functions/rest_parameters).
- *
- * @static
- * @memberOf _
- * @category Function
- * @param {Function} func The function to apply a rest parameter to.
- * @param {number} [start=func.length-1] The start position of the rest parameter.
- * @returns {Function} Returns the new function.
- * @example
- *
- * var say = _.restParam(function(what, names) {
- *   return what + ' ' + _.initial(names).join(', ') +
- *     (_.size(names) > 1 ? ', & ' : '') + _.last(names);
- * });
- *
- * say('hello', 'fred', 'barney', 'pebbles');
- * // => 'hello fred, barney, & pebbles'
- */
-function restParam(func, start) {
-  if (typeof func != 'function') {
-    throw new TypeError(FUNC_ERROR_TEXT);
-  }
-  start = nativeMax(start === undefined ? (func.length - 1) : (+start || 0), 0);
-  return function() {
-    var args = arguments,
-        index = -1,
-        length = nativeMax(args.length - start, 0),
-        rest = Array(length);
-
-    while (++index < length) {
-      rest[index] = args[start + index];
-    }
-    switch (start) {
-      case 0: return func.call(this, rest);
-      case 1: return func.call(this, args[0], rest);
-      case 2: return func.call(this, args[0], args[1], rest);
-    }
-    var otherArgs = Array(start + 1);
-    index = -1;
-    while (++index < start) {
-      otherArgs[index] = args[index];
-    }
-    otherArgs[start] = rest;
-    return func.apply(this, otherArgs);
-  };
-}
-
-export default restParam;

+ 0 - 20
packages/ckeditor5-utils/src/lib/lodash/internal/arrayCopy.js

@@ -1,20 +0,0 @@
-/**
- * Copies the values of `source` to `array`.
- *
- * @private
- * @param {Array} source The array to copy values from.
- * @param {Array} [array=[]] The array to copy values to.
- * @returns {Array} Returns `array`.
- */
-function arrayCopy(source, array) {
-  var index = -1,
-      length = source.length;
-
-  array || (array = Array(length));
-  while (++index < length) {
-    array[index] = source[index];
-  }
-  return array;
-}
-
-export default arrayCopy;

+ 0 - 32
packages/ckeditor5-utils/src/lib/lodash/internal/assignWith.js

@@ -1,32 +0,0 @@
-import keys from '../object/keys';
-
-/**
- * A specialized version of `_.assign` for customizing assigned values without
- * support for argument juggling, multiple sources, and `this` binding `customizer`
- * functions.
- *
- * @private
- * @param {Object} object The destination object.
- * @param {Object} source The source object.
- * @param {Function} customizer The function to customize assigned values.
- * @returns {Object} Returns `object`.
- */
-function assignWith(object, source, customizer) {
-  var index = -1,
-      props = keys(source),
-      length = props.length;
-
-  while (++index < length) {
-    var key = props[index],
-        value = object[key],
-        result = customizer(value, source[key], key, object, source);
-
-    if ((result === result ? (result !== value) : (value === value)) ||
-        (value === undefined && !(key in object))) {
-      object[key] = result;
-    }
-  }
-  return object;
-}
-
-export default assignWith;

+ 0 - 23
packages/ckeditor5-utils/src/lib/lodash/internal/baseCopy.js

@@ -1,23 +0,0 @@
-/**
- * Copies properties of `source` to `object`.
- *
- * @private
- * @param {Object} source The object to copy properties from.
- * @param {Array} props The property names to copy.
- * @param {Object} [object={}] The object to copy properties to.
- * @returns {Object} Returns `object`.
- */
-function baseCopy(source, props, object) {
-  object || (object = {});
-
-  var index = -1,
-      length = props.length;
-
-  while (++index < length) {
-    var key = props[index];
-    object[key] = source[key];
-  }
-  return object;
-}
-
-export default baseCopy;

+ 0 - 17
packages/ckeditor5-utils/src/lib/lodash/internal/baseForIn.js

@@ -1,17 +0,0 @@
-import baseFor from './baseFor';
-import keysIn from '../object/keysIn';
-
-/**
- * The base implementation of `_.forIn` without support for callback
- * shorthands and `this` binding.
- *
- * @private
- * @param {Object} object The object to iterate over.
- * @param {Function} iteratee The function invoked per iteration.
- * @returns {Object} Returns `object`.
- */
-function baseForIn(object, iteratee) {
-  return baseFor(object, iteratee, keysIn);
-}
-
-export default baseForIn;

+ 0 - 39
packages/ckeditor5-utils/src/lib/lodash/internal/bindCallback.js

@@ -1,39 +0,0 @@
-import identity from '../utility/identity';
-
-/**
- * A specialized version of `baseCallback` which only supports `this` binding
- * and specifying the number of arguments to provide to `func`.
- *
- * @private
- * @param {Function} func The function to bind.
- * @param {*} thisArg The `this` binding of `func`.
- * @param {number} [argCount] The number of arguments to provide to `func`.
- * @returns {Function} Returns the callback.
- */
-function bindCallback(func, thisArg, argCount) {
-  if (typeof func != 'function') {
-    return identity;
-  }
-  if (thisArg === undefined) {
-    return func;
-  }
-  switch (argCount) {
-    case 1: return function(value) {
-      return func.call(thisArg, value);
-    };
-    case 3: return function(value, index, collection) {
-      return func.call(thisArg, value, index, collection);
-    };
-    case 4: return function(accumulator, value, index, collection) {
-      return func.call(thisArg, accumulator, value, index, collection);
-    };
-    case 5: return function(value, other, key, object, source) {
-      return func.call(thisArg, value, other, key, object, source);
-    };
-  }
-  return function() {
-    return func.apply(thisArg, arguments);
-  };
-}
-
-export default bindCallback;

+ 0 - 22
packages/ckeditor5-utils/src/lib/lodash/internal/bufferClone.js

@@ -1,22 +0,0 @@
-import root from './root';
-
-/** Native method references. */
-var ArrayBuffer = root.ArrayBuffer,
-    Uint8Array = root.Uint8Array;
-
-/**
- * Creates a clone of the given array buffer.
- *
- * @private
- * @param {ArrayBuffer} buffer The array buffer to clone.
- * @returns {ArrayBuffer} Returns the cloned array buffer.
- */
-function bufferClone(buffer) {
-  var result = new ArrayBuffer(buffer.byteLength),
-      view = new Uint8Array(result);
-
-  view.set(new Uint8Array(buffer));
-  return result;
-}
-
-export default bufferClone;

+ 0 - 15
packages/ckeditor5-utils/src/lib/lodash/internal/isArrayLike.js

@@ -1,15 +0,0 @@
-import getLength from './getLength';
-import isLength from './isLength';
-
-/**
- * Checks if `value` is array-like.
- *
- * @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
- */
-function isArrayLike(value) {
-  return value != null && isLength(getLength(value));
-}
-
-export default isArrayLike;

+ 0 - 20
packages/ckeditor5-utils/src/lib/lodash/internal/isLength.js

@@ -1,20 +0,0 @@
-/**
- * Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer)
- * of an array-like value.
- */
-var MAX_SAFE_INTEGER = 9007199254740991;
-
-/**
- * Checks if `value` is a valid array-like length.
- *
- * **Note:** This function is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).
- *
- * @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
- */
-function isLength(value) {
-  return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
-}
-
-export default isLength;

+ 0 - 12
packages/ckeditor5-utils/src/lib/lodash/internal/isObjectLike.js

@@ -1,12 +0,0 @@
-/**
- * Checks if `value` is object-like.
- *
- * @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
- */
-function isObjectLike(value) {
-  return !!value && typeof value == 'object';
-}
-
-export default isObjectLike;

+ 0 - 41
packages/ckeditor5-utils/src/lib/lodash/internal/shimKeys.js

@@ -1,41 +0,0 @@
-import isArguments from '../lang/isArguments';
-import isArray from '../lang/isArray';
-import isIndex from './isIndex';
-import isLength from './isLength';
-import keysIn from '../object/keysIn';
-
-/** Used for native method references. */
-var objectProto = Object.prototype;
-
-/** Used to check objects for own properties. */
-var hasOwnProperty = objectProto.hasOwnProperty;
-
-/**
- * A fallback implementation of `Object.keys` which creates an array of the
- * own enumerable property names of `object`.
- *
- * @private
- * @param {Object} object The object to query.
- * @returns {Array} Returns the array of property names.
- */
-function shimKeys(object) {
-  var props = keysIn(object),
-      propsLength = props.length,
-      length = propsLength && object.length;
-
-  var allowIndexes = !!length && isLength(length) &&
-    (isArray(object) || isArguments(object));
-
-  var index = -1,
-      result = [];
-
-  while (++index < propsLength) {
-    var key = props[index];
-    if ((allowIndexes && isIndex(key, length)) || hasOwnProperty.call(object, key)) {
-      result.push(key);
-    }
-  }
-  return result;
-}
-
-export default shimKeys;

+ 0 - 14
packages/ckeditor5-utils/src/lib/lodash/internal/toObject.js

@@ -1,14 +0,0 @@
-import isObject from '../lang/isObject';
-
-/**
- * Converts `value` to an object if it's not one.
- *
- * @private
- * @param {*} value The value to process.
- * @returns {Object} Returns the object.
- */
-function toObject(value) {
-  return isObject(value) ? value : Object(value);
-}
-
-export default toObject;

+ 0 - 78
packages/ckeditor5-utils/src/lib/lodash/lang/clone.js

@@ -1,78 +0,0 @@
-/**
- * lodash 3.10.1 (Custom Build) <https://lodash.com/>
- * Build: `lodash modularize modern exports="es" include="clone,extend,isPlainObject,isObject,isArray,last,isEqual" --development --output src/lib/lodash`
- * Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
- * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
- * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
- * Available under MIT license <https://lodash.com/license>
- */
-import baseClone from '../internal/baseClone';
-import bindCallback from '../internal/bindCallback';
-import isIterateeCall from '../internal/isIterateeCall';
-
-/**
- * Creates a clone of `value`. If `isDeep` is `true` nested objects are cloned,
- * otherwise they are assigned by reference. If `customizer` is provided it's
- * invoked to produce the cloned values. If `customizer` returns `undefined`
- * cloning is handled by the method instead. The `customizer` is bound to
- * `thisArg` and invoked with up to three argument; (value [, index|key, object]).
- *
- * **Note:** This method is loosely based on the
- * [structured clone algorithm](http://www.w3.org/TR/html5/infrastructure.html#internal-structured-cloning-algorithm).
- * The enumerable properties of `arguments` objects and objects created by
- * constructors other than `Object` are cloned to plain `Object` objects. An
- * empty object is returned for uncloneable values such as functions, DOM nodes,
- * Maps, Sets, and WeakMaps.
- *
- * @static
- * @memberOf _
- * @category Lang
- * @param {*} value The value to clone.
- * @param {boolean} [isDeep] Specify a deep clone.
- * @param {Function} [customizer] The function to customize cloning values.
- * @param {*} [thisArg] The `this` binding of `customizer`.
- * @returns {*} Returns the cloned value.
- * @example
- *
- * var users = [
- *   { 'user': 'barney' },
- *   { 'user': 'fred' }
- * ];
- *
- * var shallow = _.clone(users);
- * shallow[0] === users[0];
- * // => true
- *
- * var deep = _.clone(users, true);
- * deep[0] === users[0];
- * // => false
- *
- * // using a customizer callback
- * var el = _.clone(document.body, function(value) {
- *   if (_.isElement(value)) {
- *     return value.cloneNode(false);
- *   }
- * });
- *
- * el === document.body
- * // => false
- * el.nodeName
- * // => BODY
- * el.childNodes.length;
- * // => 0
- */
-function clone(value, isDeep, customizer, thisArg) {
-  if (isDeep && typeof isDeep != 'boolean' && isIterateeCall(value, isDeep, customizer)) {
-    isDeep = false;
-  }
-  else if (typeof isDeep == 'function') {
-    thisArg = customizer;
-    customizer = isDeep;
-    isDeep = false;
-  }
-  return typeof customizer == 'function'
-    ? baseClone(value, isDeep, bindCallback(customizer, thisArg, 3))
-    : baseClone(value, isDeep);
-}
-
-export default clone;

+ 0 - 2
packages/ckeditor5-utils/src/lib/lodash/lang/eq.js

@@ -1,2 +0,0 @@
-import isEqual from './isEqual'
-export default isEqual;

+ 0 - 34
packages/ckeditor5-utils/src/lib/lodash/lang/isArguments.js

@@ -1,34 +0,0 @@
-import isArrayLike from '../internal/isArrayLike';
-import isObjectLike from '../internal/isObjectLike';
-
-/** Used for native method references. */
-var objectProto = Object.prototype;
-
-/** Used to check objects for own properties. */
-var hasOwnProperty = objectProto.hasOwnProperty;
-
-/** Native method references. */
-var propertyIsEnumerable = objectProto.propertyIsEnumerable;
-
-/**
- * Checks if `value` is classified as an `arguments` object.
- *
- * @static
- * @memberOf _
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
- * @example
- *
- * _.isArguments(function() { return arguments; }());
- * // => true
- *
- * _.isArguments([1, 2, 3]);
- * // => false
- */
-function isArguments(value) {
-  return isObjectLike(value) && isArrayLike(value) &&
-    hasOwnProperty.call(value, 'callee') && !propertyIsEnumerable.call(value, 'callee');
-}
-
-export default isArguments;

+ 0 - 48
packages/ckeditor5-utils/src/lib/lodash/lang/isArray.js

@@ -1,48 +0,0 @@
-/**
- * lodash 3.10.1 (Custom Build) <https://lodash.com/>
- * Build: `lodash modularize modern exports="es" include="clone,extend,isPlainObject,isObject,isArray,last,isEqual" --development --output src/lib/lodash`
- * Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
- * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
- * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
- * Available under MIT license <https://lodash.com/license>
- */
-import getNative from '../internal/getNative';
-import isLength from '../internal/isLength';
-import isObjectLike from '../internal/isObjectLike';
-
-/** `Object#toString` result references. */
-var arrayTag = '[object Array]';
-
-/** Used for native method references. */
-var objectProto = Object.prototype;
-
-/**
- * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
- * of values.
- */
-var objToString = objectProto.toString;
-
-/* Native method references for those with the same name as other `lodash` methods. */
-var nativeIsArray = getNative(Array, 'isArray');
-
-/**
- * Checks if `value` is classified as an `Array` object.
- *
- * @static
- * @memberOf _
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
- * @example
- *
- * _.isArray([1, 2, 3]);
- * // => true
- *
- * _.isArray(function() { return arguments; }());
- * // => false
- */
-var isArray = nativeIsArray || function(value) {
-  return isObjectLike(value) && isLength(value.length) && objToString.call(value) == arrayTag;
-};
-
-export default isArray;

+ 0 - 62
packages/ckeditor5-utils/src/lib/lodash/lang/isEqual.js

@@ -1,62 +0,0 @@
-/**
- * lodash 3.10.1 (Custom Build) <https://lodash.com/>
- * Build: `lodash modularize modern exports="es" include="clone,extend,isPlainObject,isObject,isArray,last,isEqual" --development --output src/lib/lodash`
- * Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
- * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
- * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
- * Available under MIT license <https://lodash.com/license>
- */
-import baseIsEqual from '../internal/baseIsEqual';
-import bindCallback from '../internal/bindCallback';
-
-/**
- * Performs a deep comparison between two values to determine if they are
- * equivalent. If `customizer` is provided it's invoked to compare values.
- * If `customizer` returns `undefined` comparisons are handled by the method
- * instead. The `customizer` is bound to `thisArg` and invoked with up to
- * three arguments: (value, other [, index|key]).
- *
- * **Note:** This method supports comparing arrays, booleans, `Date` objects,
- * numbers, `Object` objects, regexes, and strings. Objects are compared by
- * their own, not inherited, enumerable properties. Functions and DOM nodes
- * are **not** supported. Provide a customizer function to extend support
- * for comparing other values.
- *
- * @static
- * @memberOf _
- * @alias eq
- * @category Lang
- * @param {*} value The value to compare.
- * @param {*} other The other value to compare.
- * @param {Function} [customizer] The function to customize value comparisons.
- * @param {*} [thisArg] The `this` binding of `customizer`.
- * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
- * @example
- *
- * var object = { 'user': 'fred' };
- * var other = { 'user': 'fred' };
- *
- * object == other;
- * // => false
- *
- * _.isEqual(object, other);
- * // => true
- *
- * // using a customizer callback
- * var array = ['hello', 'goodbye'];
- * var other = ['hi', 'goodbye'];
- *
- * _.isEqual(array, other, function(value, other) {
- *   if (_.every([value, other], RegExp.prototype.test, /^h(?:i|ello)$/)) {
- *     return true;
- *   }
- * });
- * // => true
- */
-function isEqual(value, other, customizer, thisArg) {
-  customizer = typeof customizer == 'function' ? bindCallback(customizer, thisArg, 3) : undefined;
-  var result = customizer ? customizer(value, other) : undefined;
-  return  result === undefined ? baseIsEqual(value, other, customizer) : !!result;
-}
-
-export default isEqual;

+ 0 - 38
packages/ckeditor5-utils/src/lib/lodash/lang/isFunction.js

@@ -1,38 +0,0 @@
-import isObject from './isObject';
-
-/** `Object#toString` result references. */
-var funcTag = '[object Function]';
-
-/** Used for native method references. */
-var objectProto = Object.prototype;
-
-/**
- * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
- * of values.
- */
-var objToString = objectProto.toString;
-
-/**
- * Checks if `value` is classified as a `Function` object.
- *
- * @static
- * @memberOf _
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
- * @example
- *
- * _.isFunction(_);
- * // => true
- *
- * _.isFunction(/abc/);
- * // => false
- */
-function isFunction(value) {
-  // The use of `Object#toString` avoids issues with the `typeof` operator
-  // in older versions of Chrome and Safari which return 'function' for regexes
-  // and Safari 8 which returns 'object' for typed array constructors.
-  return isObject(value) && objToString.call(value) == funcTag;
-}
-
-export default isFunction;

+ 0 - 48
packages/ckeditor5-utils/src/lib/lodash/lang/isNative.js

@@ -1,48 +0,0 @@
-import isFunction from './isFunction';
-import isObjectLike from '../internal/isObjectLike';
-
-/** Used to detect host constructors (Safari > 5). */
-var reIsHostCtor = /^\[object .+?Constructor\]$/;
-
-/** Used for native method references. */
-var objectProto = Object.prototype;
-
-/** Used to resolve the decompiled source of functions. */
-var fnToString = Function.prototype.toString;
-
-/** Used to check objects for own properties. */
-var hasOwnProperty = objectProto.hasOwnProperty;
-
-/** Used to detect if a method is native. */
-var reIsNative = RegExp('^' +
-  fnToString.call(hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g, '\\$&')
-  .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
-);
-
-/**
- * Checks if `value` is a native function.
- *
- * @static
- * @memberOf _
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a native function, else `false`.
- * @example
- *
- * _.isNative(Array.prototype.push);
- * // => true
- *
- * _.isNative(_);
- * // => false
- */
-function isNative(value) {
-  if (value == null) {
-    return false;
-  }
-  if (isFunction(value)) {
-    return reIsNative.test(fnToString.call(value));
-  }
-  return isObjectLike(value) && reIsHostCtor.test(value);
-}
-
-export default isNative;

+ 0 - 37
packages/ckeditor5-utils/src/lib/lodash/lang/isObject.js

@@ -1,37 +0,0 @@
-/**
- * lodash 3.10.1 (Custom Build) <https://lodash.com/>
- * Build: `lodash modularize modern exports="es" include="clone,extend,isPlainObject,isObject,isArray,last,isEqual" --development --output src/lib/lodash`
- * Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
- * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
- * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
- * Available under MIT license <https://lodash.com/license>
- */
-
-/**
- * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.
- * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
- *
- * @static
- * @memberOf _
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is an object, else `false`.
- * @example
- *
- * _.isObject({});
- * // => true
- *
- * _.isObject([1, 2, 3]);
- * // => true
- *
- * _.isObject(1);
- * // => false
- */
-function isObject(value) {
-  // Avoid a V8 JIT bug in Chrome 19-20.
-  // See https://code.google.com/p/v8/issues/detail?id=2291 for more details.
-  var type = typeof value;
-  return !!value && (type == 'object' || type == 'function');
-}
-
-export default isObject;

+ 0 - 79
packages/ckeditor5-utils/src/lib/lodash/lang/isPlainObject.js

@@ -1,79 +0,0 @@
-/**
- * lodash 3.10.1 (Custom Build) <https://lodash.com/>
- * Build: `lodash modularize modern exports="es" include="clone,extend,isPlainObject,isObject,isArray,last,isEqual" --development --output src/lib/lodash`
- * Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
- * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
- * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
- * Available under MIT license <https://lodash.com/license>
- */
-import baseForIn from '../internal/baseForIn';
-import isArguments from './isArguments';
-import isObjectLike from '../internal/isObjectLike';
-
-/** `Object#toString` result references. */
-var objectTag = '[object Object]';
-
-/** Used for native method references. */
-var objectProto = Object.prototype;
-
-/** Used to check objects for own properties. */
-var hasOwnProperty = objectProto.hasOwnProperty;
-
-/**
- * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
- * of values.
- */
-var objToString = objectProto.toString;
-
-/**
- * Checks if `value` is a plain object, that is, an object created by the
- * `Object` constructor or one with a `[[Prototype]]` of `null`.
- *
- * **Note:** This method assumes objects created by the `Object` constructor
- * have no inherited enumerable properties.
- *
- * @static
- * @memberOf _
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
- * @example
- *
- * function Foo() {
- *   this.a = 1;
- * }
- *
- * _.isPlainObject(new Foo);
- * // => false
- *
- * _.isPlainObject([1, 2, 3]);
- * // => false
- *
- * _.isPlainObject({ 'x': 0, 'y': 0 });
- * // => true
- *
- * _.isPlainObject(Object.create(null));
- * // => true
- */
-function isPlainObject(value) {
-  var Ctor;
-
-  // Exit early for non `Object` objects.
-  if (!(isObjectLike(value) && objToString.call(value) == objectTag && !isArguments(value)) ||
-      (!hasOwnProperty.call(value, 'constructor') && (Ctor = value.constructor, typeof Ctor == 'function' && !(Ctor instanceof Ctor)))) {
-    return false;
-  }
-  // IE < 9 iterates inherited properties before own properties. If the first
-  // iterated property is an object's own property then there are no inherited
-  // enumerable properties.
-  var result;
-  // In most environments an object's own properties are iterated before
-  // its inherited properties. If the last iterated property is an object's
-  // own property then there are no inherited enumerable properties.
-  baseForIn(value, function(subValue, key) {
-    result = key;
-  });
-  return result === undefined || hasOwnProperty.call(value, result);
-}
-
-export default isPlainObject;

+ 0 - 74
packages/ckeditor5-utils/src/lib/lodash/lang/isTypedArray.js

@@ -1,74 +0,0 @@
-import isLength from '../internal/isLength';
-import isObjectLike from '../internal/isObjectLike';
-
-/** `Object#toString` result references. */
-var argsTag = '[object Arguments]',
-    arrayTag = '[object Array]',
-    boolTag = '[object Boolean]',
-    dateTag = '[object Date]',
-    errorTag = '[object Error]',
-    funcTag = '[object Function]',
-    mapTag = '[object Map]',
-    numberTag = '[object Number]',
-    objectTag = '[object Object]',
-    regexpTag = '[object RegExp]',
-    setTag = '[object Set]',
-    stringTag = '[object String]',
-    weakMapTag = '[object WeakMap]';
-
-var arrayBufferTag = '[object ArrayBuffer]',
-    float32Tag = '[object Float32Array]',
-    float64Tag = '[object Float64Array]',
-    int8Tag = '[object Int8Array]',
-    int16Tag = '[object Int16Array]',
-    int32Tag = '[object Int32Array]',
-    uint8Tag = '[object Uint8Array]',
-    uint8ClampedTag = '[object Uint8ClampedArray]',
-    uint16Tag = '[object Uint16Array]',
-    uint32Tag = '[object Uint32Array]';
-
-/** Used to identify `toStringTag` values of typed arrays. */
-var typedArrayTags = {};
-typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
-typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
-typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
-typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
-typedArrayTags[uint32Tag] = true;
-typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
-typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
-typedArrayTags[dateTag] = typedArrayTags[errorTag] =
-typedArrayTags[funcTag] = typedArrayTags[mapTag] =
-typedArrayTags[numberTag] = typedArrayTags[objectTag] =
-typedArrayTags[regexpTag] = typedArrayTags[setTag] =
-typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false;
-
-/** Used for native method references. */
-var objectProto = Object.prototype;
-
-/**
- * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
- * of values.
- */
-var objToString = objectProto.toString;
-
-/**
- * Checks if `value` is classified as a typed array.
- *
- * @static
- * @memberOf _
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
- * @example
- *
- * _.isTypedArray(new Uint8Array);
- * // => true
- *
- * _.isTypedArray([]);
- * // => false
- */
-function isTypedArray(value) {
-  return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[objToString.call(value)];
-}
-
-export default isTypedArray;

+ 0 - 51
packages/ckeditor5-utils/src/lib/lodash/object/assign.js

@@ -1,51 +0,0 @@
-/**
- * lodash 3.10.1 (Custom Build) <https://lodash.com/>
- * Build: `lodash modularize modern exports="es" include="clone,extend,isPlainObject,isObject,isArray,last,isEqual" --development --output src/lib/lodash`
- * Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
- * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
- * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
- * Available under MIT license <https://lodash.com/license>
- */
-import assignWith from '../internal/assignWith';
-import baseAssign from '../internal/baseAssign';
-import createAssigner from '../internal/createAssigner';
-
-/**
- * Assigns own enumerable properties of source object(s) to the destination
- * object. Subsequent sources overwrite property assignments of previous sources.
- * If `customizer` is provided it's invoked to produce the assigned values.
- * The `customizer` is bound to `thisArg` and invoked with five arguments:
- * (objectValue, sourceValue, key, object, source).
- *
- * **Note:** This method mutates `object` and is based on
- * [`Object.assign`](http://ecma-international.org/ecma-262/6.0/#sec-object.assign).
- *
- * @static
- * @memberOf _
- * @alias extend
- * @category Object
- * @param {Object} object The destination object.
- * @param {...Object} [sources] The source objects.
- * @param {Function} [customizer] The function to customize assigned values.
- * @param {*} [thisArg] The `this` binding of `customizer`.
- * @returns {Object} Returns `object`.
- * @example
- *
- * _.assign({ 'user': 'barney' }, { 'age': 40 }, { 'user': 'fred' });
- * // => { 'user': 'fred', 'age': 40 }
- *
- * // using a customizer callback
- * var defaults = _.partialRight(_.assign, function(value, other) {
- *   return _.isUndefined(value) ? other : value;
- * });
- *
- * defaults({ 'user': 'barney' }, { 'age': 36 }, { 'user': 'fred' });
- * // => { 'user': 'barney', 'age': 36 }
- */
-var assign = createAssigner(function(object, source, customizer) {
-  return customizer
-    ? assignWith(object, source, customizer)
-    : baseAssign(object, source);
-});
-
-export default assign;

+ 0 - 2
packages/ckeditor5-utils/src/lib/lodash/object/extend.js

@@ -1,2 +0,0 @@
-import assign from './assign'
-export default assign;

+ 0 - 45
packages/ckeditor5-utils/src/lib/lodash/object/keys.js

@@ -1,45 +0,0 @@
-import getNative from '../internal/getNative';
-import isArrayLike from '../internal/isArrayLike';
-import isObject from '../lang/isObject';
-import shimKeys from '../internal/shimKeys';
-
-/* Native method references for those with the same name as other `lodash` methods. */
-var nativeKeys = getNative(Object, 'keys');
-
-/**
- * Creates an array of the own enumerable property names of `object`.
- *
- * **Note:** Non-object values are coerced to objects. See the
- * [ES spec](http://ecma-international.org/ecma-262/6.0/#sec-object.keys)
- * for more details.
- *
- * @static
- * @memberOf _
- * @category Object
- * @param {Object} object The object to query.
- * @returns {Array} Returns the array of property names.
- * @example
- *
- * function Foo() {
- *   this.a = 1;
- *   this.b = 2;
- * }
- *
- * Foo.prototype.c = 3;
- *
- * _.keys(new Foo);
- * // => ['a', 'b'] (iteration order is not guaranteed)
- *
- * _.keys('hi');
- * // => ['0', '1']
- */
-var keys = !nativeKeys ? shimKeys : function(object) {
-  var Ctor = object == null ? undefined : object.constructor;
-  if ((typeof Ctor == 'function' && Ctor.prototype === object) ||
-      (typeof object != 'function' && isArrayLike(object))) {
-    return shimKeys(object);
-  }
-  return isObject(object) ? nativeKeys(object) : [];
-};
-
-export default keys;

+ 0 - 64
packages/ckeditor5-utils/src/lib/lodash/object/keysIn.js

@@ -1,64 +0,0 @@
-import isArguments from '../lang/isArguments';
-import isArray from '../lang/isArray';
-import isIndex from '../internal/isIndex';
-import isLength from '../internal/isLength';
-import isObject from '../lang/isObject';
-
-/** Used for native method references. */
-var objectProto = Object.prototype;
-
-/** Used to check objects for own properties. */
-var hasOwnProperty = objectProto.hasOwnProperty;
-
-/**
- * Creates an array of the own and inherited enumerable property names of `object`.
- *
- * **Note:** Non-object values are coerced to objects.
- *
- * @static
- * @memberOf _
- * @category Object
- * @param {Object} object The object to query.
- * @returns {Array} Returns the array of property names.
- * @example
- *
- * function Foo() {
- *   this.a = 1;
- *   this.b = 2;
- * }
- *
- * Foo.prototype.c = 3;
- *
- * _.keysIn(new Foo);
- * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
- */
-function keysIn(object) {
-  if (object == null) {
-    return [];
-  }
-  if (!isObject(object)) {
-    object = Object(object);
-  }
-  var length = object.length;
-  length = (length && isLength(length) &&
-    (isArray(object) || isArguments(object)) && length) || 0;
-
-  var Ctor = object.constructor,
-      index = -1,
-      isProto = typeof Ctor == 'function' && Ctor.prototype === object,
-      result = Array(length),
-      skipIndexes = length > 0;
-
-  while (++index < length) {
-    result[index] = (index + '');
-  }
-  for (var key in object) {
-    if (!(skipIndexes && isIndex(key, length)) &&
-        !(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
-      result.push(key);
-    }
-  }
-  return result;
-}
-
-export default keysIn;

+ 0 - 5
packages/ckeditor5-utils/src/lib/lodash/utility.js

@@ -1,5 +0,0 @@
-import identity from './utility/identity';
-
-export default {
-  'identity': identity
-};

+ 0 - 20
packages/ckeditor5-utils/src/lib/lodash/utility/identity.js

@@ -1,20 +0,0 @@
-/**
- * This method returns the first argument provided to it.
- *
- * @static
- * @memberOf _
- * @category Utility
- * @param {*} value Any value.
- * @returns {*} Returns `value`.
- * @example
- *
- * var object = { 'user': 'fred' };
- *
- * _.identity(object) === object;
- * // => true
- */
-function identity(value) {
-  return value;
-}
-
-export default identity;

+ 4 - 4
packages/ckeditor5-utils/src/observablemixin.js

@@ -7,8 +7,8 @@
 
 import EmitterMixin from './emittermixin.js';
 import CKEditorError from './ckeditorerror.js';
-import utilsObject from './lib/lodash/object.js';
-import utilsLang from './lib/lodash/lang.js';
+import extend from './lib/lodash/extend.js';
+import isObject from './lib/lodash/isObject.js';
 
 const attributesSymbol = Symbol( 'attributes' );
 const boundObservablesSymbol = Symbol( 'boundObservables' );
@@ -40,7 +40,7 @@ const ObservableMixin = {
 	 */
 	set( name, value ) {
 		// If the first parameter is an Object, iterate over its properties.
-		if ( utilsLang.isObject( name ) ) {
+		if ( isObject( name ) ) {
 			Object.keys( name ).forEach( ( attr ) => {
 				this.set( attr, name[ attr ] );
 			}, this );
@@ -629,7 +629,7 @@ function attachBindToListeners( observable, toBindings ) {
 	} );
 }
 
-utilsObject.extend( ObservableMixin, EmitterMixin );
+extend( ObservableMixin, EmitterMixin );
 
 /**
  * Fired when an attribute changed value.

+ 2 - 2
packages/ckeditor5-utils/src/utils.js

@@ -5,7 +5,7 @@
 
 'use strict';
 
-import langUtils from './lib/lodash/lang.js';
+import isPlainObject from './lib/lodash/isPlainObject.js';
 
 /**
  * An index at which arrays differ. If arrays are same at all indexes, it represents how arrays are related.
@@ -123,7 +123,7 @@ const utils = {
 	 * @returns {Map} Map created from data.
 	 */
 	toMap( data ) {
-		if ( langUtils.isPlainObject( data ) ) {
+		if ( isPlainObject( data ) ) {
 			return utils.objectToMap( data );
 		} else {
 			return new Map( data );

+ 2 - 2
packages/ckeditor5-utils/tests/emittermixin.js

@@ -7,7 +7,7 @@
 
 import EmitterMixin from '/ckeditor5/core/emittermixin.js';
 import EventInfo from '/ckeditor5/core/eventinfo.js';
-import utilsObject from '/ckeditor5/core/lib/lodash/object.js';
+import extend from '/ckeditor5/core/lib/lodash/extend.js';
 
 let emitter, listener;
 
@@ -429,5 +429,5 @@ function refreshListener() {
 }
 
 function getEmitterInstance() {
-	return utilsObject.extend( {}, EmitterMixin );
+	return extend( {}, EmitterMixin );
 }

+ 2 - 2
packages/ckeditor5-utils/tests/lodash.js

@@ -5,7 +5,7 @@
 
 'use strict';
 
-import objectUtils from '/ckeditor5/core/lib/lodash/object.js';
+import extend from '/ckeditor5/core/lib/lodash/extend.js';
 
 describe( 'utils', () => {
 	describe( 'extend()', () => {
@@ -27,7 +27,7 @@ describe( 'utils', () => {
 				d: 2
 			};
 
-			objectUtils.extend( target, ext1, ext2 );
+			extend( target, ext1, ext2 );
 
 			expect( target ).to.have.property( 'a' ).to.equal( 0 );
 			expect( target ).to.have.property( 'b' ).to.equal( 1 );