Security News
The Risks of Misguided Research in Supply Chain Security
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
attr-accessor
Advanced tools
Convenience factories for creating getter/setters.
Licensed under the MIT license, see LICENSE for more information.
Attr Accessor is available via npm:
npm install attr-accessor
Or for usage in the browser:
dist/attr-accessor.js
dist/attr-accessor.min.js
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)
ES2015 (ES6) introduced classes and has support for getter/setters.
CoffeeScript, on the other hand, 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(this)
group = []
constructor: (@firstName, @lastName) ->
group.push this
get name: ->
"#{@firstName} #{@lastName}"
@get count: ->
group.length
new Person('John', 'Doe').name # John Doe
Person.count # 1
Attr Accessor is written in ES2015, compiled by Babel, developed with Gulp and tested through Mocha.
Getting this toolchain up and running, is easy and straight-forward:
Get the code:
git clone git://github.com/timkurvers/attr-accessor.git
Download and install Node.js (includes npm
) for your platform.
Install dependencies:
npm install
Run gulp
which will automatically build and test the project when source files change.
When not available, run ./node_modules/.bin/gulp
instead.
When contributing, please:
dist/attr-accessor.js
)v0.2.2 - June 28, 2015
FAQs
Convenience factories for creating getter/setters
The npm package attr-accessor receives a total of 5 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
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.