Skip to content

Commit 9e88ad2

Browse files
fix: Utility.cloneObject did not copy dates correctly
1 parent 9b35bcb commit 9e88ad2

File tree

7 files changed

+7
-95
lines changed

7 files changed

+7
-95
lines changed

dist/dynamics-web-api-callbacks.js

Lines changed: 1 addition & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ function copyObject(src) {
427427
for (var prop in src) {
428428
if (src.hasOwnProperty(prop)) {
429429
// if the value is a nested object, recursively copy all its properties
430-
if (_isObject(src[prop])) {
430+
if (_isObject(src[prop]) && Object.prototype.toString.call(src[prop]) !== '[object Date]') {
431431
if (!Array.isArray(src[prop])) {
432432
target[prop] = copyObject(src[prop]);
433433
}
@@ -2977,8 +2977,6 @@ function parseBatchHeaders(text) {
29772977
}
29782978
} while (line && parts);
29792979

2980-
normalizeHeaders(headers);
2981-
29822980
return headers;
29832981
}
29842982

@@ -3004,46 +3002,6 @@ function readTo(text, ctx, str) {
30043002
return text.substring(start, end);
30053003
}
30063004

3007-
function normalizeHeaders(headers) {
3008-
var keys = [];
3009-
for (var i = 0; i < headers.length; ++i) {
3010-
var key = normalizeHeader(headers[i]);
3011-
if (key.length > 0) {
3012-
keys.push(key);
3013-
}
3014-
}
3015-
return keys;
3016-
}
3017-
3018-
function normalizeHeader(header) {
3019-
var key = "";
3020-
var upperCase = false;
3021-
for (var i = 0; i < header.length; ++i) {
3022-
var letter = header[i];
3023-
if (letter === " " && key.length > 0) {
3024-
upperCase = true;
3025-
continue;
3026-
}
3027-
if (!isAlnum(letter)) {
3028-
continue;
3029-
}
3030-
if (key.length === 0 && isDigit(letter)) {
3031-
continue;
3032-
}
3033-
if (upperCase) {
3034-
upperCase = false;
3035-
key += letter.toUpperCase();
3036-
} else {
3037-
key += letter.toLowerCase();
3038-
}
3039-
}
3040-
return key;
3041-
}
3042-
3043-
function isDigit(char) {
3044-
return char >= "0" && char <= "9";
3045-
}
3046-
30473005
//partially taken from https://github.com/emiltholin/google-api-batch-utils
30483006
/**
30493007
*

dist/dynamics-web-api-callbacks.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/dynamics-web-api.js

Lines changed: 1 addition & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ function copyObject(src) {
427427
for (var prop in src) {
428428
if (src.hasOwnProperty(prop)) {
429429
// if the value is a nested object, recursively copy all its properties
430-
if (_isObject(src[prop])) {
430+
if (_isObject(src[prop]) && Object.prototype.toString.call(src[prop]) !== '[object Date]') {
431431
if (!Array.isArray(src[prop])) {
432432
target[prop] = copyObject(src[prop]);
433433
}
@@ -2500,8 +2500,6 @@ function parseBatchHeaders(text) {
25002500
}
25012501
} while (line && parts);
25022502

2503-
normalizeHeaders(headers);
2504-
25052503
return headers;
25062504
}
25072505

@@ -2527,46 +2525,6 @@ function readTo(text, ctx, str) {
25272525
return text.substring(start, end);
25282526
}
25292527

2530-
function normalizeHeaders(headers) {
2531-
var keys = [];
2532-
for (var i = 0; i < headers.length; ++i) {
2533-
var key = normalizeHeader(headers[i]);
2534-
if (key.length > 0) {
2535-
keys.push(key);
2536-
}
2537-
}
2538-
return keys;
2539-
}
2540-
2541-
function normalizeHeader(header) {
2542-
var key = "";
2543-
var upperCase = false;
2544-
for (var i = 0; i < header.length; ++i) {
2545-
var letter = header[i];
2546-
if (letter === " " && key.length > 0) {
2547-
upperCase = true;
2548-
continue;
2549-
}
2550-
if (!isAlnum(letter)) {
2551-
continue;
2552-
}
2553-
if (key.length === 0 && isDigit(letter)) {
2554-
continue;
2555-
}
2556-
if (upperCase) {
2557-
upperCase = false;
2558-
key += letter.toUpperCase();
2559-
} else {
2560-
key += letter.toLowerCase();
2561-
}
2562-
}
2563-
return key;
2564-
}
2565-
2566-
function isDigit(char) {
2567-
return char >= "0" && char <= "9";
2568-
}
2569-
25702528
//partially taken from https://github.com/emiltholin/google-api-batch-utils
25712529
/**
25722530
*

dist/dynamics-web-api.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/utilities/Utility.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ function copyObject(src) {
6868
for (var prop in src) {
6969
if (src.hasOwnProperty(prop)) {
7070
// if the value is a nested object, recursively copy all its properties
71-
if (_isObject(src[prop])) {
71+
if (_isObject(src[prop]) && Object.prototype.toString.call(src[prop]) !== '[object Date]') {
7272
if (!Array.isArray(src[prop])) {
7373
target[prop] = copyObject(src[prop]);
7474
}

types/dynamics-web-api-callbacks.d.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Type definitions for dynamics-web-api-callbacks v1.6.10
1+
// Type definitions for dynamics-web-api-callbacks v1.6.11
22
// Project: https://github.com/AleksandrRogov/DynamicsWebApi
33
// Definitions by: Aleksandr Rogov https://github.com/AleksandrRogov/
44

@@ -642,8 +642,6 @@ declare namespace DynamicsWebApi {
642642
interface RetrieveRequest extends CRUDRequest {
643643
/**An array of Expand Objects(described below the table) representing the $expand OData System Query Option value to control which related records are also returned. */
644644
expand?: Expand[];
645-
/**Use the $filter system query option to set criteria for which entities will be returned. */
646-
filter?: string;
647645
/**Sets If-Match header value that enables to use conditional retrieval or optimistic concurrency in applicable requests.*/
648646
ifmatch?: string;
649647
/**Sets If-None-Match header value that enables to use conditional retrieval in applicable requests. */

types/dynamics-web-api.d.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Type definitions for dynamics-web-api v1.6.10
1+
// Type definitions for dynamics-web-api v1.6.11
22
// Project: https://github.com/AleksandrRogov/DynamicsWebApi/
33
// Definitions by: Aleksandr Rogov https://github.com/AleksandrRogov/
44

@@ -546,8 +546,6 @@ declare namespace DynamicsWebApi {
546546
interface RetrieveRequest extends CRUDRequest {
547547
/**An array of Expand Objects(described below the table) representing the $expand OData System Query Option value to control which related records are also returned. */
548548
expand?: Expand[];
549-
/**Use the $filter system query option to set criteria for which entities will be returned. */
550-
filter?: string;
551549
/**Sets If-Match header value that enables to use conditional retrieval or optimistic concurrency in applicable requests.*/
552550
ifmatch?: string;
553551
/**Sets If-None-Match header value that enables to use conditional retrieval in applicable requests. */

0 commit comments

Comments
 (0)