
Company News
Jerod Santo Joins Socket as Head of Media
Allow myself to introduce... myself.
根据区划代码找关联区划。
npm i sp-area //or yarn add sp-area
npm run build
<script src="https://unpkg.com/sp-area/dist/index.min.js"></script>
<script>
let {area} = __AREA;
let origion = [
{ '510000': '四川省'},
{ '510100': '成都市' },
{ '510200': '绵阳市' },
{ '510201': '涪城区' },
{ '510202': '三台县' },
{ '510101': '武侯区' },
{ '510112': '青羊区' },
{ '520000': '贵州省' },
{ '520100': '贵阳市' },
{ '520101': '花溪区' },
{ '520102': '小河区' },
{ '520200': '安顺市' },
{ '520201': '安顺区'}]
area({
origion: origion,
target: '510112',
type: 'siblings',
hasOwn: true,
formatter(result) {
result.forEach(item => {
item.name = item.name.replace(/区|县/,'')
})
return result
}
})
// [ { code: '510101', name: '武侯' },{ code: '510112', name: '青羊' } ]
</script>
const {
area
} = require("sp-area")
area(obj = {})
let origion = [
{ '510000': '四川省'},
{ '510100': '成都市' },
{ '510200': '绵阳市' },
{ '510201': '涪城区' },
{ '510202': '三台县' },
{ '510101': '武侯区' },
{ '510112': '青羊区' },
{ '520000': '贵州省' },
{ '520100': '贵阳市' },
{ '520101': '花溪区' },
{ '520102': '小河区' },
{ '520200': '安顺市' },
{ '520201': '安顺区'}];
area(
{
origion: origion,
target: '510100',
type: 'children',
hasOwn: false,
formatter(result) {
result.forEach(item => {
item.name = item.name.replace(/区|县/,'')
})
return result
}
}
);
// '[ { code: '510101', name: '武侯' },{ code: '510112', name: '青羊' } ]'
area(
{
origion: origion,
target: '510100',
type: 'children',
hasOwn: true,
formatter(result) {
result.forEach(item => {
item.name = item.name.replace(/区|县/,'')
})
return result
}
}
);
// '[ { code: '510100', name: '成都市' },{ code: '510101', name: '武侯' },{ code: '510112', name: '青羊' } ]'
area(
{
origion: origion,
target: '510100',
type: 'siblings',
hasOwn: false,
formatter(result) {
result.forEach(item => {
item.name = item.name.replace(/区|县/,'')
})
return result
}
}
);
// '[ { code: '510200', name: '绵阳市' } ]'
area(
{
origion: origion,
target: '510100',
type: 'siblings',
hasOwn: true,
formatter(result) {
result.forEach(item => {
item.name = item.name.replace(/区|县/,'')
})
return result
}
}
);
// [ { code: '510100', name: '成都市' },{ code: '510200', name: '绵阳市' } ]
area(
{
origion: origion,
target: '510100',
type: 'parent',
formatter(result) {
result.forEach(item => {
item.name = item.name.replace(/区|县/,'')
})
return result
}
}
);
// [ { code: '510000', name: '四川省' } ]
FAQs
The npm package sp-area receives a total of 8 weekly downloads. As such, sp-area popularity was classified as not popular.
We found that sp-area 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.

Company News
Allow myself to introduce... myself.

Research
/Security News
A Twitch browser extension on Chrome and Firefox forwards users’ live OAuth session tokens through proxies controlled by a Russian bot service.

Security News
Anthropic found biased reasoning and recklessness drove Claude Mythos 5 to publish malware on PyPI and compromise a security vendor.