![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
@eccenca/utils
Advanced tools
A set of small utility function that may not fit in any other package
A set of small utility function that may not fit in any other package.
Creates a v4
uuid.
Is basically a wrapper around the npm package uuid
.
For options see here
import {uuid} from '@eccenca/utils';
const id = uuid();
Wrapper around URI.js.
import {URI} from '@eccenca/utils'
const newURI = new URI('http://example.org');
//Our wrapper adds this check:
//Returns true if URI is urn-like or an absolute URL
newURI.is('resourceURI');
Change a favicon of a website dynamically.
import {changeFavicon} from '@eccenca/utils';
changeFavicon(
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgAQMAAABJtOi3AAAABlBMVEUAAAD+jwHRIVMHAAAAAXRSTlMAQObYZgAAAHlJREFU" +
"CNctzbEJAzEQRNF/KBAGw6aOtG04EHJbFwisElzSlqISFCo4Tl7sg+EFE8yADC6C/biDzgTvs8A6K9s6JmHcBtFCR1o0BPmgD32SctkppVayzkyW4cTuBH" +
"O25uBJsP9RmEhjILb5aI+dMNX8aDVYC3gdjvdfRm8rdNXB000AAAAASUVORK5CYII="
);
Retrieve preferred locales by the user. Values are read from the window.navigator
object
import {getBrowserLocales} from '@eccenca/utils';
//Returns for example ['de-AT', 'de', 'en']
getBrowserLocales();
Returns best match between a list of preferred locales and supported locales.
Preferred locales default to getBrowserLocales
and order is important (First in array is most important locale).
If no match can be found a default locale will be returned.
import {getBestLocale} from '@eccenca/utils';
//returns 'en' (default value)
getBestLocale();
//returns 'de' (default value)
getBestLocale({defaultLocale: 'de'});
//suppose a user has a preference of ['de-AT', 'en'] in their browser
//returns 'de'
getBestLocale({supportedLocales: ['de', 'en']});
//returns 'en-AU'
getBestLocale({
preferredLocales: ['de-AT', 'en'],
supportedLocales: ['en-AU', 'ru-RU'],
});
//Sometimes order matters in supportedLocales
//suppose a user has a preference of ['en-US', 'de'] in their browser
//returns 'en'
getBestLocale({supportedLocales: ['en', 'en-AU', 'de']});
//returns 'en-AU'
getBestLocale({supportedLocales: ['en-AU', 'en', 'de']});
Transform all not common letters like 'ö,ä,ü,é' to standard latin and replace all special characters like '$,],¶' to a single '_' from a given string.
Has optional parameter ensureType
in options
import {sanitizeFileName} from '@eccenca/utils';
string = '<oxo|{[¢$frmble?.csv';
//Returns 'oxo_frmble.csv'
sanitizeFileName(string, {ensureType: 'csv'});
Helps to convert Spring Property Objects to proper Javascript Objects
const input = {
'foo.bar.string': '123',
'foo.bar.array': ["a", "b", "c"],
'[http://example.org]foo.bar': {
'a.b': 12
}
};
const output =
{
"foo": {
"bar": {
"array": [
"a",
"b",
"c",
],
"string": "123"
}
},
"http://example.org": {
"foo": {
"bar": {
"a": {
"b": 12
}
}
}
}
}
;
should(convertSpringPropertyObject(input)).deepEqual(output);
[1.6.0] 2018-02-28
FAQs
A set of small utility function that may not fit in any other package
The npm package @eccenca/utils receives a total of 10 weekly downloads. As such, @eccenca/utils popularity was classified as not popular.
We found that @eccenca/utils 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
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.