Diff
checker
टेक्स्ट
टेक्स्ट
छवियां
दस्तावेज़
Excel
फ़ोल्डर्स
Legal
Enterprise
डेस्कटॉप
मूल्य
साइन इन करें
Diffchecker डेस्कटॉप डाउनलोड करें
टेक्स्ट की तुलना करें
दो टेक्स्ट फ़ाइलों के बीच अंतर ढूंढें
उपकरण
इतिहास
रियल-टाइम एडिटर
अपरिवर्तित संक्षिप्त करें
लाइन रैप बंद
लेआउट
विभाजित
संयुक्त
परिवर्तन हाइलाइट करें
स्मार्ट
शब्द
अक्षर
सिंटैक्स हाइलाइटिंग
सिंटैक्स चुनें
अनदेखा करें
टेक्स्ट बदलें
पहले अंतर पर जाएँ
इनपुट संपादित करें
Diffchecker Desktop
Diffchecker चलाने का सबसे सुरक्षित तरीका। Diffchecker Desktop ऐप पाएं: आपके diffs कभी आपके कंप्यूटर से बाहर नहीं जाते!
Desktop पाएं
Untitled diff
बनाया गया
8 वर्ष पहले
Diff कभी समाप्त नहीं होता
साफ़
निर्यात करें
शेयर करें
समझाएं
60 हटाए गए
लाइनें
कुल
हटाया गया
अक्षर
कुल
हटाया गया
इस सुविधा का उपयोग जारी रखने के लिए, अपग्रेड करें
Diff
checker
Pro
मूल्य देखें
153 लाइनें
सभी को कॉपी करें
59 जोड़े गए
लाइनें
कुल
जोड़ा गया
अक्षर
कुल
जोड़ा गया
इस सुविधा का उपयोग जारी रखने के लिए, अपग्रेड करें
Diff
checker
Pro
मूल्य देखें
155 लाइनें
सभी को कॉपी करें
कॉपी
कॉपी हुआ
कॉपी
कॉपी हुआ
#
src
#
babel
'use strict';
'use strict';
/*
/*
* OBJECT ASSIGN DEEP
* OBJECT ASSIGN DEEP
* Allows deep cloning of plain objects that contain primitives, nested plain objects, or nested plain arrays.
* Allows deep cloning of plain objects that contain primitives, nested plain objects, or nested plain arrays.
*/
*/
/*
/*
* A unified way of returning a string that describes the type of the given variable.
* A unified way of returning a string that describes the type of the given variable.
*/
*/
कॉपी
कॉपी हुआ
कॉपी
कॉपी हुआ
function getTypeOf
(input) {
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; };
function getTypeOf
(input) {
if (input === null) {
if (input === null) {
return 'null';
return 'null';
कॉपी
कॉपी हुआ
कॉपी
कॉपी हुआ
}
}
else if (typeof input === 'undefined') {
else if (typeof input === 'undefined') {
return 'undefined';
return 'undefined';
कॉपी
कॉपी हुआ
कॉपी
कॉपी हुआ
}
}
else if
(
(typeof input === '
undefined' ? 'undefined' : _typeof(input)) === '
object') {
return
Array.isArray(input) ? 'array' : 'object'
;
else if
(typeof input === '
object') {
return
(
Array.isArray(input) ? 'array' : 'object'
)
;
}
}
कॉपी
कॉपी हुआ
कॉपी
कॉपी हुआ
return typeof input
;
return typeof input
=== 'undefined' ? 'undefined' : _typeof(input);
}
}
/*
/*
* Branching logic which calls the correct function to clone the given value base on its type.
* Branching logic which calls the correct function to clone the given value base on its type.
*/
*/
कॉपी
कॉपी हुआ
कॉपी
कॉपी हुआ
function cloneValue
(value) {
function cloneValue
(value) {
// The value is an object so lets clone it.
// The value is an object so lets clone it.
if (getTypeOf(value) === 'object') {
if (getTypeOf(value) === 'object') {
return quickCloneObject(value);
return quickCloneObject(value);
}
}
// The value is an array so lets clone it.
// The value is an array so lets clone it.
else if (getTypeOf(value) === 'array') {
else if (getTypeOf(value) === 'array') {
कॉपी
कॉपी हुआ
कॉपी
कॉपी हुआ
return quickCloneArray(value);
return quickCloneArray(value);
}
}
// Any other value can just be copied.
// Any other value can just be copied.
return value;
return value;
कॉपी
कॉपी हुआ
कॉपी
कॉपी हुआ
}
}
/*
/*
* Enumerates the given array and returns a new array, with each of its values cloned (i.e. references broken).
* Enumerates the given array and returns a new array, with each of its values cloned (i.e. references broken).
*/
*/
कॉपी
कॉपी हुआ
कॉपी
कॉपी हुआ
function quickCloneArray
(input) {
function quickCloneArray
(input) {
return input.map(cloneValue);
return input.map(cloneValue);
}
}
/*
/*
* Enumerates the properties of the given object (ignoring the prototype chain) and returns a new object, with each of
* Enumerates the properties of the given object (ignoring the prototype chain) and returns a new object, with each of
* its values cloned (i.e. references broken).
* its values cloned (i.e. references broken).
*/
*/
कॉपी
कॉपी हुआ
कॉपी
कॉपी हुआ
function quickCloneObject
(input) {
function quickCloneObject
(input) {
कॉपी
कॉपी हुआ
कॉपी
कॉपी हुआ
const
output = {};
var
output = {};
कॉपी
कॉपी हुआ
कॉपी
कॉपी हुआ
for (
const
key in input) {
for (
var
key in input) {
if (!input.hasOwnProperty(key)) {
continue;
}
if (!input.hasOwnProperty(key)) {
continue;
}
output[key] = cloneValue(input[key]);
output[key] = cloneValue(input[key]);
}
}
return output;
return output;
कॉपी
कॉपी हुआ
कॉपी
कॉपी हुआ
}
}
/*
/*
* Does the actual deep merging.
* Does the actual deep merging.
*/
*/
कॉपी
कॉपी हुआ
कॉपी
कॉपी हुआ
function executeDeepMerge
(target
,
_objects =
[], _options = {}) {
function executeDeepMerge
(target
) {
var
_objects =
arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
कॉपी
कॉपी हुआ
कॉपी
कॉपी हुआ
const
options = {
var _options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
arrayBehaviour: _options.arrayBehaviour || 'replace'
,
// Can be "merge" or "replace".
var
options = {
arrayBehaviour: _options.arrayBehaviour || 'replace'
// Can be "merge" or "replace".
};
};
// Ensure we have actual objects for each.
// Ensure we have actual objects for each.
कॉपी
कॉपी हुआ
कॉपी
कॉपी हुआ
const
objects = _objects.map
(object
=>
object || {}
);
var
objects = _objects.map
(function
(object
) {
const
output = target || {};
return
object || {}
;
}
);
var
output = target || {};
// Enumerate the objects and their keys.
// Enumerate the objects and their keys.
कॉपी
कॉपी हुआ
कॉपी
कॉपी हुआ
for (
let
oindex = 0; oindex < objects.length; oindex++) {
for (
var
oindex = 0; oindex < objects.length; oindex++) {
const
object = objects[oindex];
var
object = objects[oindex];
const
keys = Object.keys(object);
var
keys = Object.keys(object);
कॉपी
कॉपी हुआ
कॉपी
कॉपी हुआ
for (
let
kindex = 0; kindex < keys.length; kindex++) {
for (
var
kindex = 0; kindex < keys.length; kindex++) {
const
key = keys[kindex];
var
key = keys[kindex];
const
value = object[key];
var
value = object[key];
const
type = getTypeOf(value);
var
type = getTypeOf(value);
const
existingValueType = getTypeOf(output[key]);
var
existingValueType = getTypeOf(output[key]);
if (type === 'object') {
if (type === 'object') {
if (existingValueType !== 'undefined') {
if (existingValueType !== 'undefined') {
कॉपी
कॉपी हुआ
कॉपी
कॉपी हुआ
const
existingValue =
(
existingValueType === 'object' ? output[key] : {}
)
;
var
existingValue =
existingValueType === 'object' ? output[key] : {}
;
output[key] = executeDeepMerge({}, [existingValue, quickCloneObject(value)], options);
output[key] = executeDeepMerge({}, [existingValue, quickCloneObject(value)], options);
कॉपी
कॉपी हुआ
कॉपी
कॉपी हुआ
}
}
else {
else {
output[key] = quickCloneObject(value);
output[key] = quickCloneObject(value);
}
}
कॉपी
कॉपी हुआ
कॉपी
कॉपी हुआ
}
}
else if (type === 'array') {
else if (type === 'array') {
if (existingValueType === 'array') {
if (existingValueType === 'array') {
कॉपी
कॉपी हुआ
कॉपी
कॉपी हुआ
const
newValue = quickCloneArray(value);
var
newValue = quickCloneArray(value);
output[key] =
(
options.arrayBehaviour === 'merge' ? output[key].concat(newValue) : newValue
)
;
output[key] =
options.arrayBehaviour === 'merge' ? output[key].concat(newValue) : newValue
;
}
}
else {
else {
output[key] = quickCloneArray(value);
output[key] = quickCloneArray(value);
}
}
कॉपी
कॉपी हुआ
कॉपी
कॉपी हुआ
}
}
else {
else {
output[key] = value;
output[key] = value;
}
}
कॉपी
कॉपी हुआ
कॉपी
कॉपी हुआ
}
}
}
}
return output;
return output;
कॉपी
कॉपी हुआ
कॉपी
कॉपी हुआ
}
}
/*
/*
* Merge all the supplied objects into the target object, breaking all references, including those of nested objects
* Merge all the supplied objects into the target object, breaking all references, including those of nested objects
* and arrays, and even objects nested inside arrays. The first parameter is not mutated unlike Object.assign().
* and arrays, and even objects nested inside arrays. The first parameter is not mutated unlike Object.assign().
* Properties in later objects will always overwrite.
* Properties in later objects will always overwrite.
*/
*/
कॉपी
कॉपी हुआ
कॉपी
कॉपी हुआ
module.exports = function objectAssignDeep
(target
, ...
objects
) {
module.exports = function objectAssignDeep
(target
) {
for (var _len = arguments.length,
objects
= Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++
) {
objects[_key - 1] = arguments[_key];
}
return executeDeepMerge(target, objects);
return executeDeepMerge(target, objects);
};
};
/*
/*
* Same as objectAssignDeep() except it doesn't mutate the target object and returns an entirely new object.
* Same as objectAssignDeep() except it doesn't mutate the target object and returns an entirely new object.
*/
*/
कॉपी
कॉपी हुआ
कॉपी
कॉपी हुआ
module.exports.noMutate = function objectAssignDeepInto
(...
objects
) {
module.exports.noMutate = function objectAssignDeepInto
() {
for (var _len2 = arguments.length,
objects
= Array(_len2), _key2 = 0; _key2 < _len2; _key2++
) {
objects[_key2] = arguments[_key2];
}
return executeDeepMerge({}, objects);
return executeDeepMerge({}, objects);
};
};
/*
/*
* Allows an options object to be passed in to customise the behaviour of the function.
* Allows an options object to be passed in to customise the behaviour of the function.
*/
*/
कॉपी
कॉपी हुआ
कॉपी
कॉपी हुआ
module.exports.withOptions = function objectAssignDeepInto
(target, objects, options) {
module.exports.withOptions = function objectAssignDeepInto
(target, objects, options) {
return executeDeepMerge(target, objects, options);
return executeDeepMerge(target, objects, options);
};
};
कॉपी
कॉपी हुआ
कॉपी
कॉपी हुआ
सेव किए गए Diffs
ऑरिजनल टेक्स्ट
फ़ाइल खोलें
# src 'use strict'; /* * OBJECT ASSIGN DEEP * Allows deep cloning of plain objects that contain primitives, nested plain objects, or nested plain arrays. */ /* * A unified way of returning a string that describes the type of the given variable. */ function getTypeOf (input) { if (input === null) { return 'null'; } else if (typeof input === 'undefined') { return 'undefined'; } else if (typeof input === 'object') { return (Array.isArray(input) ? 'array' : 'object'); } return typeof input; } /* * Branching logic which calls the correct function to clone the given value base on its type. */ function cloneValue (value) { // The value is an object so lets clone it. if (getTypeOf(value) === 'object') { return quickCloneObject(value); } // The value is an array so lets clone it. else if (getTypeOf(value) === 'array') { return quickCloneArray(value); } // Any other value can just be copied. return value; } /* * Enumerates the given array and returns a new array, with each of its values cloned (i.e. references broken). */ function quickCloneArray (input) { return input.map(cloneValue); } /* * Enumerates the properties of the given object (ignoring the prototype chain) and returns a new object, with each of * its values cloned (i.e. references broken). */ function quickCloneObject (input) { const output = {}; for (const key in input) { if (!input.hasOwnProperty(key)) { continue; } output[key] = cloneValue(input[key]); } return output; } /* * Does the actual deep merging. */ function executeDeepMerge (target, _objects = [], _options = {}) { const options = { arrayBehaviour: _options.arrayBehaviour || 'replace', // Can be "merge" or "replace". }; // Ensure we have actual objects for each. const objects = _objects.map(object => object || {}); const output = target || {}; // Enumerate the objects and their keys. for (let oindex = 0; oindex < objects.length; oindex++) { const object = objects[oindex]; const keys = Object.keys(object); for (let kindex = 0; kindex < keys.length; kindex++) { const key = keys[kindex]; const value = object[key]; const type = getTypeOf(value); const existingValueType = getTypeOf(output[key]); if (type === 'object') { if (existingValueType !== 'undefined') { const existingValue = (existingValueType === 'object' ? output[key] : {}); output[key] = executeDeepMerge({}, [existingValue, quickCloneObject(value)], options); } else { output[key] = quickCloneObject(value); } } else if (type === 'array') { if (existingValueType === 'array') { const newValue = quickCloneArray(value); output[key] = (options.arrayBehaviour === 'merge' ? output[key].concat(newValue) : newValue); } else { output[key] = quickCloneArray(value); } } else { output[key] = value; } } } return output; } /* * Merge all the supplied objects into the target object, breaking all references, including those of nested objects * and arrays, and even objects nested inside arrays. The first parameter is not mutated unlike Object.assign(). * Properties in later objects will always overwrite. */ module.exports = function objectAssignDeep (target, ...objects) { return executeDeepMerge(target, objects); }; /* * Same as objectAssignDeep() except it doesn't mutate the target object and returns an entirely new object. */ module.exports.noMutate = function objectAssignDeepInto (...objects) { return executeDeepMerge({}, objects); }; /* * Allows an options object to be passed in to customise the behaviour of the function. */ module.exports.withOptions = function objectAssignDeepInto (target, objects, options) { return executeDeepMerge(target, objects, options); };
परिवर्तित टेक्स्ट
फ़ाइल खोलें
# babel 'use strict'; /* * OBJECT ASSIGN DEEP * Allows deep cloning of plain objects that contain primitives, nested plain objects, or nested plain arrays. */ /* * A unified way of returning a string that describes the type of the given variable. */ 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; }; function getTypeOf(input) { if (input === null) { return 'null'; } else if (typeof input === 'undefined') { return 'undefined'; } else if ((typeof input === 'undefined' ? 'undefined' : _typeof(input)) === 'object') { return Array.isArray(input) ? 'array' : 'object'; } return typeof input === 'undefined' ? 'undefined' : _typeof(input); } /* * Branching logic which calls the correct function to clone the given value base on its type. */ function cloneValue(value) { // The value is an object so lets clone it. if (getTypeOf(value) === 'object') { return quickCloneObject(value); } // The value is an array so lets clone it. else if (getTypeOf(value) === 'array') { return quickCloneArray(value); } // Any other value can just be copied. return value; } /* * Enumerates the given array and returns a new array, with each of its values cloned (i.e. references broken). */ function quickCloneArray(input) { return input.map(cloneValue); } /* * Enumerates the properties of the given object (ignoring the prototype chain) and returns a new object, with each of * its values cloned (i.e. references broken). */ function quickCloneObject(input) { var output = {}; for (var key in input) { if (!input.hasOwnProperty(key)) { continue; } output[key] = cloneValue(input[key]); } return output; } /* * Does the actual deep merging. */ function executeDeepMerge(target) { var _objects = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; var _options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; var options = { arrayBehaviour: _options.arrayBehaviour || 'replace' // Can be "merge" or "replace". }; // Ensure we have actual objects for each. var objects = _objects.map(function (object) { return object || {}; }); var output = target || {}; // Enumerate the objects and their keys. for (var oindex = 0; oindex < objects.length; oindex++) { var object = objects[oindex]; var keys = Object.keys(object); for (var kindex = 0; kindex < keys.length; kindex++) { var key = keys[kindex]; var value = object[key]; var type = getTypeOf(value); var existingValueType = getTypeOf(output[key]); if (type === 'object') { if (existingValueType !== 'undefined') { var existingValue = existingValueType === 'object' ? output[key] : {}; output[key] = executeDeepMerge({}, [existingValue, quickCloneObject(value)], options); } else { output[key] = quickCloneObject(value); } } else if (type === 'array') { if (existingValueType === 'array') { var newValue = quickCloneArray(value); output[key] = options.arrayBehaviour === 'merge' ? output[key].concat(newValue) : newValue; } else { output[key] = quickCloneArray(value); } } else { output[key] = value; } } } return output; } /* * Merge all the supplied objects into the target object, breaking all references, including those of nested objects * and arrays, and even objects nested inside arrays. The first parameter is not mutated unlike Object.assign(). * Properties in later objects will always overwrite. */ module.exports = function objectAssignDeep(target) { for (var _len = arguments.length, objects = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { objects[_key - 1] = arguments[_key]; } return executeDeepMerge(target, objects); }; /* * Same as objectAssignDeep() except it doesn't mutate the target object and returns an entirely new object. */ module.exports.noMutate = function objectAssignDeepInto() { for (var _len2 = arguments.length, objects = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { objects[_key2] = arguments[_key2]; } return executeDeepMerge({}, objects); }; /* * Allows an options object to be passed in to customise the behaviour of the function. */ module.exports.withOptions = function objectAssignDeepInto(target, objects, options) { return executeDeepMerge(target, objects, options); };
अंतर खोजें