printf-as3 icon indicating copy to clipboard operation
printf-as3 copied to clipboard

9 - Enhancement proposal: support for nested object properties and array indexing

Open arthur-debert opened this issue 14 years ago • 1 comments

Attached is a proposal of extension to printf function with the following features:
1. Nested property references are supported, i.e. %(user.account.login)s
2. Special support for array indexing of nested properties is implemented as well, for example:
%(user.roles.item4.name)s // roles.item4 is in fact roles[4], hence the name of fifth role (zero based) of array-like\* property "roles" is printed
%(user.roles.first.name)s // name of first role, syntactic sugar
%(call.arguments.last)s // last argument of array-like property "arguments" syntactic sugar

*"Array-like" means that object must support "length" property and allows indexed access to items; examples are Array, ArrayCollection and similar.

Regrds,
Valery Silaev
Farata Systems
http://flexblog.faratasystems.com/

Original link: http://code.google.com/p/printf-as3/issues/detail?id=9

arthur-debert avatar Oct 15 '10 17:10 arthur-debert

debert - 2010-09-11 00:00:00

Hi Valery.

In principle, I do like all the features suggested here. This will be a pretty busy month for me, so I'll likely take a while to check them in. I'll need to write the unit tests, so that we can make a stable release. (if you would like to write those, you'd be very welcome, of course).

Anyway, these look nice, I'll go through the code as soon as possible.

Thanks for contributing.

arthur-debert avatar Oct 15 '10 17:10 arthur-debert