
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
attr-accessor
Advanced tools
Convenience factories for creating getter/setters.
Licensed under the MIT license, see LICENSE for more information.
Pass in an object to attr.reader
or attr.writer
to obtain a getter or setter
factory respectively:
get = attr.reader(object)
set = attr.writer(object)
CoffeeScript has had no elegant way of defining getter/setters, until now. Use its
destructuring syntax in combination with attr.accessor
to obtain both factories:
[get, set] = attr.accessor(object)
Use attr.accessors
when dealing with classes to obtain two prototypal /
instance-bound factories as well as two static factories:
[get, set, @get, @set] = attr.accessors(object)
class Person
[get, set, @get, @set] = attr.accessors(@)
group = []
constructor: (@firstName, @lastName) ->
group.push @
get name: ->
"#{@firstName} #{@lastName}"
@get count: ->
group.length
new Person('John', 'Doe').name # John Doe
Person.count # 1
When contributing, please:
FAQs
Convenience factories for creating getter/setters
The npm package attr-accessor receives a total of 35 weekly downloads. As such, attr-accessor popularity was classified as not popular.
We found that attr-accessor demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.