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.
@craftercms/utils
Advanced tools
Changelog
2.0.7
getDescriptor
crashing when config
isn't supplied.Readme
Contains various utilities useful when developing with Crafter CMS
All of Crafter CMS packages can be used either via npm or in plain html/javascript via regular script imports.
yarn add @craftercms/utils
or npm install @craftercms/utils
import
or require
the functions you wish.craftercms
. You can access all craftercms' packages and functions under this root.utils
package depends on rxjs, make sure to import rxjs too before the utils
script.Tip: Once you've imported the scripts, type craftercms
on your browser's dev tools console to inspect the package(s)
<div id="myFeature"></div>
<script src="https://unpkg.com/rxjs"></script>
<script src="https://unpkg.com/@craftercms/utils"></script>
<script>
(function ({ utils }) {
const people = [
{ id: 1, name: 'Mary' }
]
const myLookup = utils.createLookupTable(people);
console.log(myLookup); // => { 1: { id: 1, name: 'Mary' } }
})(craftercms);
</script>
The examples below assume usage in the style of using via npm. If you're using the bundles,
directly importing as a script in the browser, these functions will be under the global variable
named craftercms.utils
(i.e. window.craftercms.utils
).
Creates a lookup table based on an array of items (of a type) and the items id identifier.
import { Item, LookupTable } from "@craftercms/models";
import { createLookupTable } from "@craftercms/utils";
const items: Item[] = [/* ... */];
const itemsLookupTable: LookupTable<Item> = createLookupTable<Item>(items, 'url');
The lookupTable will look like this:
{
"/site/website/index.xml": {
"name": "index.xml",
"url": "/site/website/index.xml",
"descriptorUrl": "/site/website/index.xml",
"descriptorDom": { /* ... */ },
"folder": false
}
}
FAQs
Crafter CMS utility and helper functions
The npm package @craftercms/utils receives a total of 117 weekly downloads. As such, @craftercms/utils popularity was classified as not popular.
We found that @craftercms/utils demonstrated a healthy version release cadence and project activity because the last version was released less than 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.