Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
core-decorators
Advanced tools
Library of ES7 decorators inspired by languages that come with built-ins like @override, @deprecated, etc
Library of ES7 decorators inspired by languages that come with built-ins like @override, @deprecate, etc, similar to pre-defined Annotations in Java.
The idea is these decorators would be used to ensure code sanity, but would be removed in production builds via a Babel plugin.
Marks a property or method as not being writable.
import { readonly } from 'core-decorators';
class Woman {
@readonly
gender = 'female';
}
var lady = new Woman();
lady.gender = 'male';
// Cannot assign to read only property 'gender' of [object Object]
Checks that the marked method indeed overrides a function with the same signature somewhere on the prototype chain.
Works with methods and getters/setters. Will ensure name, parameter count, as well as descriptor type (accessor/data). Provides a suggestion if it finds a method with a similar signature, including slight misspellings.
import { override } from 'core-decorators';
class Parent {
kickDog(first, second) {}
}
class Child extends Parent {
@override
kickDog() {}
// SyntaxError: Child#kickDog() does not properly override Parent#kickDog(first, second)
}
// or
class Child extends Parent {
@override
kickDogs() {}
// SyntaxError: No descriptor matching Child#kickDogs() was found on the prototype chain.
//
// Did you mean "kickDog"?
}
Calls console.warn()
with a deprecation message. Provide a custom message to override the default one. You can also provide an options hash with a url
, for further reading.
import { deprecate } from 'core-decorators';
class Person {
@deprecate
kickDog() {}
@deprecate('We stopped animal abuse')
kickDogHard() {}
@deprecate('We stopped animal abuse', { url: 'http://humanesociety.org/issues/abuse_neglect/' })
kickDogHarder() {}
}
let person = new Person();
person.kickDog();
// DEPRECATION Person#kickDog: This function will be removed in future versions.
person.kickDogHard();
// DEPRECATION Person#kickDogHard: We stopped animal abuse
person.kickDogHarder();
// DEPRECATION Person#kickDogHarder: We stopped animal abuse
//
// See http://humanesociety.org/issues/abuse_neglect/ for more details.
//
Suppresses any JavaScript console.warn()
call while the decorated function is called. (i.e. on the stack)
Will not suppress warnings triggered in any async code within.
import { suppressWarnings } from 'core-decorators';
class Person {
@deprecated
kickDog() {}
@suppressWarnings
kickDogWithoutWarning() {
this.kickDog();
}
}
let person = new Person();
person.kickDogWithoutWarning();
// no warning is logged
Initial implementation included, likely slow. WIP.
Please don't kick dogs. It's not nice.
FAQs
Library of JavaScript stage-0 decorators (aka ES2016/ES7 decorators but that's not accurate!) inspired by languages that come with built-ins like @override, @deprecate, @autobind, @mixin and more! Works great with React/Angular/more!
We found that core-decorators 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
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.