Release notes
1.2.3
Bug fixes
- Fixed a compiler warning.
1.2.2
Bug fixes
- Fixed a compiler warning.
1.2.1
Bug fixes
- Fixed links in the mocha html report not working if the component database was not named
js.component.4dbase
.
1.2.0
New features
_.valueForKeyPath()
has been enhanced in several ways. See the documentation for details.Added
DateTimeStatic.formatUTCOffset()
as a corollary toDateTime.formatUTCOffset()
. See the documentation for details.You can now pass
"*"
toDateTime.now()
to get the current date and time from Server.Added
DateTime.offset()
to create a newDateTime
whose UTC offset is the given number of seconds. See the documentation for details.You can now pass a number to
ChaiBdd.throw()
to test if the thrown error has the specified error code.A negative count is considered "replace all" in
_.regexReplace()
andRegex.replace()
.A negative limit is considered no limit in
_.regexSplit()
andRegex.split()
.If there is a an error in the code of a unit test assertion, the error type, message, and offending line of code is displayed in the html report.
If test suites and/or tests have been skipped explicitly via
.skip()
or implicitly via.only()
, the html report header shows the count of selected tests that were skipped.
API changes
All of the regex functions (both
Regex
and_.regex*
) now take an optional last parameter, throwOnBadPattern, which defaults to false. If true and the pattern is malformed, in addition to returning a failure value, aSyntaxError
is thrown. See the documentation for details._.parseJSON()
now returns aSyntaxError
instance if the input is malformed. See the documentation for details._.stringify()
now throws aTypeError
if given a type thatJSON Stringify
cannot stringify (such as a picture)._.exec()
always throws aSystemError
.
Bug fixes
Fixed the name of the
.setCustomLinkModifiers
method in the documentation.Fixed
_.resolveMethodRef()
to work correctly with methods.Fixed test links not working in mocha reports.
Hopefully fixed an issue with a "Too many files open" error in the timezone refresh process.
1.1.0
New features
Added support for constructing a
DateTime
from a number of milliseconds since the Unix epoch (positive or negative).Added
DateTime.epochTime
to get the number of milliseconds since the Unix epoch.Added implementations of JavaScript’s
_.setTimeout()
and_.clearTimeout()
functions. See the documentation for more details. 🎉Added implementations of JavaScript’s
_.setInterval()
and_.clearInterval()
functions. See the documentation for more details. 💪
Bug fixes
Fixed
DateTime.factorSeconds()
to work correctly with negative seconds.Fixed a bug in
Binder
that causedThis
to not be set correctly within the called function — thanks to 4D’s unfortunate decision to treat empty objects as falsey.
1.0.0
New features
Error handling has been totally overhauled and a new, modern error handling framework has been created. Please see the error handling docs for details.
Fixed the properties of
cs.js.Error
to be accurate depending on whether the error was created by an error handler, by_.throw
, or directly._.throw()
now takes an options object as the third parameter.Added
.name
and.options
properties to theError
class.Any 4D database/sql engine errors are thrown as
DBError
with no table or field._.at()
and_.$at()
now allow you to pass a negative index. See the documentation for details.Added
_.isNumericType()
See the documentation for details.If
_.stringify()
is called with an object that is cyclic, and the object responds to.toString()
, that is the result. See the.toString()
docs for an important warning!If
_.stringify()
is called with a collection that contains cyclic objects, the result will be a stringified version of the collection with the cyclic objects replaced as described above for cyclic objects.If
_.inspect()
is called with an object that is cyclic, and the object responds to.description()
, that is the result._.inspect()
now displays collections as a collection of the result of calling.description()
on each element of the collection.Added linked messages with modifiers to t() and tc(). Please see the documentation for details.
Added an
Initialization
section to theInstallation
section. There is now some code you need to run at startup to use js.component in your project.Added
_.findLastIndex()
and_.lastIndexOf()
. See the documentation for more details.It is no longer required to install NodeJS on Windows in order to get local timezone information, nor is it required to turn on various settings on Windows. An executable (which is a stripped down version of python along with the script and its dependencies) is now included in the
Resources/scripts
folder.The default interval for refreshing the system timezone has been reduced from 1 minute to 15 seconds. The interval can be changed by setting
DateTime.timezoneRefreshInterval
to a number of seconds._.sort()
now accepts a property path as the first parameter. See the documentation for more details.Added
_.printStackTrace()
. See the documentation for details.Added
_.splice()
(from JavaScript). See the documentation for more details.The documentation now includes more details about the errors that can be thrown by each function.
API changes
The template string syntax for
_.format()
has been changed to be consistent and more flexible. See the documentation for more details._.isError()
has been renamed to_.error()
.DBError
now takes options as the third parameter. table and field come after and are optional.To simplify the API and to prevent confusion with different styles of placeholders,
t()
andtc()
now only take an object as the extra params._.parseJSON()
now throws an error if parsing fails. See the documentation for more details.All of the
Regex
functions now throw an error if the regex pattern is invalid. See the documentation for more details.Regex.replace()
now throws aTypeError
if passed an invalid replacement type._.stdErrorHandler
has been replaced with the constantjk std error handler
.The syntax for the key path in
_.valueForKeyPath()
has been changed and enhanced to support either object keys or collection indexes at any point in the path. See the documentation for more details.
Bug fixes
If
_.stringify()
is called with a value that is undefined, the result is now properly quoted as"<undefined>"
.The js.component error handler was not being activated in a host db because the host maintains its own error handler method. Added
_.setHostOnErrCall()
to fix this. Please see the documentation for more details.The
cs.js.Error
constructor now removes any constructors of classes whose names end withError
(e.g.SyntaxError
) from the top of the stack trace. This is to deal better with error subclasses.Fixed
IError
so that it does not generate infinite stack recursion (😱) and fixed the comments.Fixed a bug in
DBError.description()
.Fixed a bug in
DateTime.add()
andDateTime.subtract()
where null would be returned instead of the original object if the first parameter was an invalid type.Fixed
_.indexOf()
so that the startFrom parameter behaves exactly as it does in 4D.
1.0.0-beta.5
Bug fixes
DateTime.add()/subtract()
was not updating the UTC offset and timezone.Hopefully fixed problems with html mocha reports not displaying by adding a .25 second delay before setting the html content.
1.0.0-beta.4
New features
- The
MochaRunner
.include
option can include a glob after the folder name. See the documentation for more details.
1.0.0-beta.3
New features
Locale support! See the Locale docs for details.
Much better timezone support in
DateTime
. See the DateTime docs for details.Added locale and timezone support to
DateTime.format
.Added
DateTime.daysInMonth
.Added
DateTime.formatUTCOffset
.Added
DateTime.timezone
.Added
DateTime.timezoneAbbrev
.Added
DateTime.timezoneName
.Added
DateTime.loc()
andDateTime.locale()
.Added
DateTime.localeData
.Added
DateTimeStatic.getSystemTimezone()
and the scripts necessary to implement that.When
DateTimeStatic
is instantiated, it calls.getSystemTimezone()
. If that succeeds, a process is started which calls that function every minute and updates the timezone abbreviation and name if it changes.Added
DateTimeStatic.loadTzdata()
.Added
DateTimeStatic.tzdata
.Created Node script to automatically download and parse the latest timezone list from wikipedia.
Added
_.exec()
.Added
_.getClassesInFolder()
.Added
_.nativePath()
._.loadConfig()
has been enhanced.- It can now can take a full path to a config file instead of just a name.
- If you pass true as the second parameter, it merges the config file with the current global config.
- It now returns true if the config was loaded successfully, false otherwise.
Improved formatting of the
MochaHtmlReporter
.
API changes
Modified the
DateTime constructor
to accept more forms of input.Renamed
DateTime.difference()
toDateTime.diff()
`.Renamed
DateTime.timezoneOffset
toDateTime.utcOffset
.Renamed
DateTime.setTimezone()
toDateTime.tz()
and changed its signature.Renamed
DateTimeStatic.getLocalTimezoneOffset()
toDateTimeStatic.getUTCOffset()
.Renamed
DateTimeStatic.getNamedTimezoneOffset()
toDateTimeStatic.getTimezoneOffset()
and changed its signature.Reworked/simplified the API of
DateTime.add()
andDateTime.subtract()
.Reworked/simplified the API of
DateTimeStatic.add()
andDateTimeStatic.subtract()
to be simpler.Renamed
DateTimeStatic.getNamedFormat()
/DateTimeStatic.setNamedFormat()
toDateTimeStatic.getCustomFormat()
/DateTimeStatic.setCustomFormat()
and added locale support.Removed
_.getOrdinalFunc()
,_.ordinal()
, and_.setOrdinalFunc()
. Ordinals are not part of locales._.description()
will no longer use a.description
property on an object if it is not a callable._.valueForKeyPath()
now supports both objects properties and collection indexes. See the documentation for more details.The template string syntax for
_.format()
has been changed. See the documentation for more details.
Bug fixes
Clicking on a test in the mocha html reporter will now open the source class to the relevant line.
Fixed
registerSingleton()
to callinitShared()
on the shared instance.Fixed some bugs related to
DateTime
utc mode.