Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
@kernel-js/support
Advanced tools
Readme
Util functions and classes
The main inspiration on my work is PHP Laravel Framework which I love because of its simplicity and beauty of code.
First of all I created this to support development of Kernel Framework.
Just like the rest of the packages that make up the framework, I make the most of other existing libraries that are well
tested on a day-to-day basis. The idea is not to reinvent the wheel, just join the ideas in a lightweight framework
(the focus is on the client side), simple to use and make the code on the front more beautiful and organized.
npm install @kernel-js/support
Gets the value of an environment variable.
env(key, [defaultValue])
Arguments
key
- the path to the property you want. You can use dot notation on nested objectsdefaultValue
- the optional default value when the key was not found// Examples
env('NODE_ENV');
env('app.name');
env('app.name', 'My Default App Name');
Return a boolean if the informed value is of Array type.
isArray(value)
Arguments
value
- any value// Example
isArray([]); // True
isArray({}); // False
isArray(''); // False
Return a boolean if the informed value is of Object type.
isObject(value)
Arguments
value
- any value// Example
isObject({}); // True
isObject([]); // False
isObject(''); // False
Check if the informed value is empty. This is a little different of lodash behaviour,
booleans are not considered empty and ' ' for example is considered empty.
isEmpty(value)
Arguments
value
- any value// Examples
isEmpty(true); // false
isEmpty(null); // true
isEmpty(undefined); // true
isEmpty(' '); // true
isEmpty({}); // true
isEmpty([]); // true
Just the oposite of isEmpty.
isNotEmpty(value)
Arguments
value
- any value// Examples
isNotEmpty(true); // true
isNotEmpty(null); // false
isNotEmpty(undefined); // false
isNotEmpty(' '); // false
isNotEmpty({}); // false
isNotEmpty([]); // false
Converts a give string or number into boolean or return null when cannot convert it.
toBoolean(value)
Arguments
value
- any value// Examples
toBoolean(1); // true
toBoolean('true'); // true
toBoolean('yes'); // true
toBoolean('on'); // true
toBoolean(0); // false
toBoolean('false'); // false
toBoolean('no'); // false
toBoolean('off'); // false
toBoolean('lorem ipsum'); // null
Removes any empty property from object using isEmpty helper.
removeEmpty(value)
Arguments
value
- any object// Example
removeEmpty({"a": " ", "b": "b value", "c": null}); // {"b": "b value"}
Converts any empty property of object to null using isEmpty helper.
mapEmptyToNull(value)
Arguments
value
- any object// Example
mapEmptyToNull({"a": " ", "b": "b value", "c": null, "d": {}}); // {"a": null, "b": "b value", "c": null, "d": null}
This library was developed by Gustavo Siqueira, Bruno Santos e Carlos Escouto
Please do! Check out our Contributing guidelines.
MIT © 2018-2018 Brid-IT
FAQs
Support package for Kernel Framework
The npm package @kernel-js/support receives a total of 38 weekly downloads. As such, @kernel-js/support popularity was classified as not popular.
We found that @kernel-js/support demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers 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
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.