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, @deprecated, etc
The idea is these decorators would be used to ensure code sanity, but would be removed in production builds via a Babel plugin.
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 { deprecated } from 'core-decorators';
class Person {
@deprecated
kickDog() {}
@deprecated('We stopped animal abuse')
kickDogHard() {}
@deprecated('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
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!
The npm package core-decorators receives a total of 40,157 weekly downloads. As such, core-decorators popularity was classified as popular.
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.