
Research
Two Malicious Rust Crates Impersonate Popular Logger to Steal Wallet Keys
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
sweet-helpers
Advanced tools
Collection of SweetJS macros.
npm install sweet-helpers --save-dev
var gulp = require('gulp'),
sweetjs = requier('gulp-sweetjs');
gulp.task('sweetjs', function () {
gulp.src('./myFile.js')
.pipe(sweetjs({modules: ['./node_modules/sweet-helpers/index.sjs']}))
.pipe(gulp.dest('./public/js'));
});
gulp.task('default', ['sweetjs']);
Template
undef$
Result
void 0
Returns true if the specified value is undefined.
Template
isUndef$(foo)
Or
foo::isUndef$()
Result
typeof foo === 'undefined'
Returns true if the specified value isn't undefined.
Template
isNotUndef$(foo)
Or
foo::isNotUndef$()
Result
typeof foo !== 'undefined'
Returns true if the specified value isn't null or undefined.
Template
isSet$(foo)
Or
foo::isSet$()
Result
typeof foo !== 'undefined' && foo !== null
Returns true if the specified value is null or undefined.
Template
isNotSet$(foo)
Or
foo::isNotSet$()
Result
typeof foo === 'undefined' || foo === null
Returns true if the specified value is null.
Template
isNull$(foo)
Or
foo::isNull$()
Result
typeof foo !== 'undefined' && foo === null
Returns true if the specified value isn't null.
Template
isNotNull$(foo)
Or
foo::isNotNull$()
Result
typeof foo === 'undefined' || foo !== null
Returns true if the specified value is boolean.
Template
isBoolean$(foo)
Or
foo::isBoolean$()
Result
typeof foo === 'boolean'
Returns true if the specified value isn't boolean.
Template
isNotBoolean$(foo)
Or
foo::isNotBoolean$()
Result
typeof foo !== 'boolean'
Returns true if the specified value is a string.
Template
isString$(foo)
Or
foo::isString$()
Result
typeof foo === 'string'
Returns true if the specified value isn't a string.
Template
isNotString$(foo)
Or
foo::isNotString$()
Result
typeof foo !== 'string'
Returns true if the specified value is a number.
Template
isNumber$(foo)
Or
foo::isNumber$()
Result
typeof foo === 'number'
Returns true if the specified value is a number.
Template
isNotNumber$(foo)
Or
foo::isNotNumber$()
Result
typeof foo !== 'number'
Returns true if the specified value is numeric.
Template
isNumber$(foo)
Or
foo::isNumber$()
Result
typeof foo === 'number' && isFinite(foo)
Returns true if the specified value isn't numeric.
Template
isNotNumeric$(foo)
Or
foo::isNotNumeric$()
Result
typeof foo !== 'number' || !isFinite(foo)
Returns true if the specified value is NaN.
Template
isRealNaN$(foo)
Or
foo::isRealNaN$()
Result
typeof foo === 'number' && isNaN(foo)
Returns true if the specified value isn't NaN.
Template
isNotRealNaN$(foo)
Or
foo::isNotRealNaN$()
Result
typeof foo !== 'number' || !isNaN(foo)
Returns true if the specified value is a function.
Template
isFunction$(foo)
Or
foo::isFunction$()
Result
typeof foo === 'function'
Returns true if the specified value isn't a function.
Template
isNotFunction$(foo)
Or
foo::isNotFunction$()
Result
typeof foo !== 'function'
Returns true if the specified value instance of a base object.
Template
instanceof$(foo, String)
Or
foo::instanceof$(String)
Result
foo instanceof String || foo && foo.constructor && foo.constructor.name === String.name
Returns [[class]] of the specified value.
Template
type$(foo)
Or
foo::type$()
Result
({}).toString.call(foo)
Returns a link for an iterator of the specified value.
Template
iterator$(foo)
Or
foo::iterator$()
Result
typeof foo !== 'undefined' && foo !== null ?
(typeof foo['@@iterator'] === 'function' ?
foo['@@iterator'] : typeof Symbol === 'function' ?
foo[Symbol['iterator']] : void 0) : void 0
Converts the specified value to a number.
Template
number$(foo)
Or
foo::number$()
Result
(+foo)
Converts the specified value to a string.
Template
string$(foo)
Or
foo::string$()
Result
(foo + '')
Converts the specified value to boolean.
Template
boolean$(foo)
Or
foo::boolean$()
Result
!!foo
Returns an object for working with macro functions.
Gets the first non false property from an object.
Template
use$(foo).get('foo', 'bar')
Or
foo::get$('foo', 'bar')
Result
foo['foo'] || foo['bar']
Returns true if all specified properties are exists in an object.
Template
use$(foo).in('foo', 'bar')
Or
foo::in$('foo', 'bar')
Result
'foo' in foo && 'bar' in foo
Returns true if all specified properties aren't exists in an object.
Template
use$(foo).not('foo', 'bar')
Or
foo::not$('foo', 'bar')
Result
'foo' in foo === false && 'bar' in foo === false
Returns true if any of specified properties are exists in an object.
Template
use$(foo).some('foo', 'bar')
Or
foo::some$('foo', 'bar')
Result
'foo' in foo || 'bar' in foo
Decorates a function.
Template
var foo = decorate$(bar, car) :: function () {
return 1;
};
Or
var foo = decorate$(bar, car) || function () {
return 1;
};
Result
var foo = car(bar(function () {
return 1;
}));
The MIT License.
FAQs
Collection of SweetJS macros.
We found that sweet-helpers 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.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.