
Research
/Security News
Contagious Interview Campaign Escalates With 67 Malicious npm Packages and New Malware Loader
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.
@artifact-project/i18n
Advanced tools
A simple module for internationalization with support some feature CLDR.
A simple module for internationalization with support some feature CLDR.
npm i --save @artifact-project/i18n
🤜 https://artifact-project.github.io/i18n/
import { enPlural } from '~/plural/en'; // use plural generator
export const approvalsLeftPlural = enPlural.create({
one: '# approval',
other: '# approvals',
'=': {
'1': 'one approval',
},
});
approvalsLeftPlural(0); // 0 approvals
approvalsLeftPlural(1); // one approval
approvalsLeftPlural(2); // 2 approvals
cfg-default-locale.ts
import { i18n, setDefaultLocale } from '@artifact-project/i18n';
// 1. Open https://artifact-project.github.io/i18n/
// 2. Choice a plural preset
// Dictionary
const dict = {
required: 'No empty',
minLength: ({detail: {min}}, {plural}) => `Minimum ${plural('symbols', min)}`,
symbols: {
cardinal: {
one: 'symbol',
other: 'symbols',
},
},
};
// Set default
setDefaultLocale(new i18n(dict, plural));
somewhere.ts
import {T} from '@artifact-project/i18n';
T('required'); // No empty
T({id: 'minLength', detail: {min: 6}}); // Minimum 6 symbols
T('inline', {inline: 'Wow'}); // Wow
Open http://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html and DevTools and execute ;]
function parseLangList() {
return [...document.querySelectorAll('.dtf-s a[name][href^="#"]')]
.filter(a => a.name === a.href.split('#')[1])
.map(a => a.name)
;
}
function parseLang(code, forTest) {
const cardinal = {};
const range = {};
const codeColumn = document.querySelector(`[name="${code}"]`).parentElement;
const allRows = codeColumn.parentNode.parentNode.rows;
const result = {
code,
name: codeColumn.previousElementSibling.textContent.trim(),
};
const getText = (el) => el.innerHTML.replace(/<\/?[a-z][^>]*>|&[a-z]+;?/g, ' ').replace(/\s+/g, ' ').trim();
let offset = [].indexOf.call(allRows, codeColumn.parentNode);
let typeColumn = codeColumn.nextElementSibling;
let maxColumns = codeColumn.rowSpan;
let type;
let category;
let examples;
let minimalPairs;
let rules;
for (let i = 0; i < maxColumns; i++) {
const cells = allRows[offset + i].cells;
const tmp = getText(cells[0]);
if (i === 0) {
type = getText(cells[2]);
category = getText(cells[3]);
examples = getText(cells[4]);
minimalPairs = getText(cells[5]);
rules = getText(cells[6]);
} else if (tmp === 'ordinal' || tmp === 'range') {
type = tmp;
category = getText(cells[1]);
examples = getText(cells[2]);
minimalPairs = getText(cells[3]);
rules = getText(cells[4]);
} else {
category = tmp;
examples = getText(cells[1]);
minimalPairs = cells[3] ? getText(cells[2]) : '';
rules = getText(cells[3] || cells[2]);
}
rules = rules.replace(/\s+/g, ' ').trim();
if (!result.hasOwnProperty(type)) {
result[type] = {};
}
if (type === 'range') {
rules = rules.replace(/[^a-z]/g, ' ').trim().split(/\s+/g).pop();
}
if (forTest) {
result[type][category] = {
rules,
test: examples,
example: minimalPairs.replace(/(\d+)\,(\d+)/g, '$1.$2'),
};
} else {
result[type][category] = rules;
}
}
return result;
}
// MAIN
(() => {
const dcl = parseLangList()
.map(code => {
try {
return parseLang(code);
} catch (_) {}
})
.filter(Boolean)
;
console.log(`Plural DCL Copied in Buffer:`, dcl);
copy(dcl);
})();
npm i
npm test
, code coverageFAQs
A simple module for internationalization with support some feature CLDR.
We found that @artifact-project/i18n 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
/Security News
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.
Security News
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.