csv-stringify
Advanced tools
Comparing version 5.3.2 to 5.3.3
# Changelog | ||
## Version 5.3.3 | ||
* columns: can still access fields with dots, fix #98 | ||
## Version 5.3.2 | ||
@@ -5,0 +9,0 @@ |
@@ -43,3 +43,3 @@ "use strict"; | ||
// information. | ||
var Stringifier, castPath, charCodeOfDot, get, isObject, isSymbol, reEscapeChar, rePropName, stream, toKey, underscore, util; | ||
var Stringifier, castPath, charCodeOfDot, get, getTag, isKey, isObject, isSymbol, reEscapeChar, reIsDeepProp, reIsPlainProp, rePropName, stream, stringToPath, toKey, underscore, util; | ||
stream = require('stream'); | ||
@@ -755,10 +755,40 @@ util = require('util'); // ## Usage | ||
rePropName = RegExp('[^.[\\]]+' + '|' + '\\[(?:' + '([^"\'][^[]*)' + '|' + '(["\'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2' + ')\\]' + '|' + '(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))', 'g'); | ||
reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/; | ||
reIsPlainProp = /^\w*$/; | ||
getTag = function getTag(value) { | ||
if (value != null) { | ||
if (value === void 0) { | ||
'[object Undefined]'; | ||
} else { | ||
'[object Null]'; | ||
} | ||
} | ||
return Object.prototype.toString.call(value); | ||
}; | ||
isKey = function isKey(value, object) { | ||
var type; | ||
if (Array.isArray(value)) { | ||
return false; | ||
} | ||
type = _typeof(value); | ||
if (type === 'number' || type === 'symbol' || type === 'boolean' || value == null || isSymbol(value)) { | ||
return true; | ||
} | ||
return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object != null && value in Object(object); | ||
}; | ||
isSymbol = function isSymbol(value) { | ||
var type; | ||
type = _typeof(value); | ||
return type === 'symbol' || type === 'object' && value !== null && getTag(value) === '[object Symbol]'; | ||
return type === 'symbol' || type === 'object' && value != null && getTag(value) === '[object Symbol]'; | ||
}; | ||
castPath = function castPath(string) { | ||
stringToPath = function stringToPath(string) { | ||
var result; | ||
@@ -786,2 +816,14 @@ result = []; | ||
castPath = function castPath(value, object) { | ||
if (Array.isArray(value)) { | ||
return value; | ||
} else { | ||
if (isKey(value, object)) { | ||
return [value]; | ||
} else { | ||
return stringToPath(value); | ||
} | ||
} | ||
}; | ||
toKey = function toKey(value) { | ||
@@ -788,0 +830,0 @@ var ref, result; |
@@ -6,3 +6,3 @@ // Generated by CoffeeScript 2.4.1 | ||
// information. | ||
var Stringifier, castPath, charCodeOfDot, get, isObject, isSymbol, reEscapeChar, rePropName, stream, toKey, underscore, util; | ||
var Stringifier, castPath, charCodeOfDot, get, getTag, isKey, isObject, isSymbol, reEscapeChar, reIsDeepProp, reIsPlainProp, rePropName, stream, stringToPath, toKey, underscore, util; | ||
@@ -586,9 +586,36 @@ stream = require('stream'); | ||
reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/; | ||
reIsPlainProp = /^\w*$/; | ||
getTag = function(value) { | ||
if (value != null) { | ||
if (value === void 0) { | ||
'[object Undefined]'; | ||
} else { | ||
'[object Null]'; | ||
} | ||
} | ||
return Object.prototype.toString.call(value); | ||
}; | ||
isKey = function(value, object) { | ||
var type; | ||
if (Array.isArray(value)) { | ||
return false; | ||
} | ||
type = typeof value; | ||
if (type === 'number' || type === 'symbol' || type === 'boolean' || (value == null) || isSymbol(value)) { | ||
return true; | ||
} | ||
return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || ((object != null) && value in Object(object)); | ||
}; | ||
isSymbol = function(value) { | ||
var type; | ||
type = typeof value; | ||
return type === 'symbol' || (type === 'object' && value !== null && getTag(value) === '[object Symbol]'); | ||
return type === 'symbol' || (type === 'object' && (value != null) && getTag(value) === '[object Symbol]'); | ||
}; | ||
castPath = function(string) { | ||
stringToPath = function(string) { | ||
var result; | ||
@@ -612,2 +639,14 @@ result = []; | ||
castPath = function(value, object) { | ||
if (Array.isArray(value)) { | ||
return value; | ||
} else { | ||
if (isKey(value, object)) { | ||
return [value]; | ||
} else { | ||
return stringToPath(value); | ||
} | ||
} | ||
}; | ||
toKey = function(value) { | ||
@@ -614,0 +653,0 @@ var ref, result; |
{ | ||
"version": "5.3.2", | ||
"version": "5.3.3", | ||
"name": "csv-stringify", | ||
@@ -4,0 +4,0 @@ "description": "CSV stringifier implementing the Node.js `stream.Transform` API", |
68254
1571