JavaScript is a fickle beast. As it is now, the typeof checks for an array value doesn't get fired. When you typeof [] it returns "object", rather than "array" as you would expect.
I fixed this check using the Array.isArray() call. Honestly I'm not sure in what situations this would be used when writing to PDF's, so if you could supply a use-case I can check this to ensure it works as expected.
When you enumerate over objects, you also need to check to ensure prototypes do not get included in the data. Most of the time this shouldn't be a huge issue, but when you start creating new types of objects, you can run into situations where custom-set prototypes can get included as well. As a user you can get around this using Object.defineProperty(), so if you don't want this check in, I can remove it.
You can ignore the UTF-8 commit, I was testing some stuff with merging UTF-8 stuff using PDFTK. Unfortunately UTF-8 isn't supported with PDFTK, so that never really went anywhere.
JavaScript is a fickle beast. As it is now, the typeof checks for an array value doesn't get fired. When you
typeof []
it returns"object"
, rather than"array"
as you would expect.I fixed this check using the
Array.isArray()
call. Honestly I'm not sure in what situations this would be used when writing to PDF's, so if you could supply a use-case I can check this to ensure it works as expected.When you enumerate over objects, you also need to check to ensure prototypes do not get included in the data. Most of the time this shouldn't be a huge issue, but when you start creating new types of objects, you can run into situations where custom-set prototypes can get included as well. As a user you can get around this using
Object.defineProperty()
, so if you don't want this check in, I can remove it.Check out the second answer on this SO question on that: http://stackoverflow.com/questions/208016/how-to-list-the-properties-of-a-javascript-object