惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

S
SegmentFault 最新的问题
Spread Privacy
Spread Privacy
Google DeepMind News
Google DeepMind News
WordPress大学
WordPress大学
Blog — PlanetScale
Blog — PlanetScale
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Apple Machine Learning Research
Apple Machine Learning Research
SecWiki News
SecWiki News
腾讯CDC
P
Privacy International News Feed
Webroot Blog
Webroot Blog
J
Java Code Geeks
爱范儿
爱范儿
A
About on SuperTechFans
S
Secure Thoughts
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
D
DataBreaches.Net
Cloudbric
Cloudbric
Security Archives - TechRepublic
Security Archives - TechRepublic
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
C
Cyber Attacks, Cyber Crime and Cyber Security
P
Proofpoint News Feed
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Security Latest
Security Latest
Forbes - Security
Forbes - Security
小众软件
小众软件
www.infosecurity-magazine.com
www.infosecurity-magazine.com
C
Cybersecurity and Infrastructure Security Agency CISA
T
Threatpost
量子位
MongoDB | Blog
MongoDB | Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
月光博客
月光博客
W
WeLiveSecurity
P
Privacy & Cybersecurity Law Blog
Vercel News
Vercel News
Google Online Security Blog
Google Online Security Blog
云风的 BLOG
云风的 BLOG
GbyAI
GbyAI
S
Security @ Cisco Blogs
T
The Exploit Database - CXSecurity.com
Help Net Security
Help Net Security
V
Visual Studio Blog
C
CXSECURITY Database RSS Feed - CXSecurity.com
Application and Cybersecurity Blog
Application and Cybersecurity Blog
博客园 - 聂微东
P
Proofpoint News Feed
C
CERT Recently Published Vulnerability Notes
Attack and Defense Labs
Attack and Defense Labs

博客园 - rainbow727

ps-图层调整大小 js 根据关键字,进行mark背景色标记 时间戳转换为时间格式 ps-图层尺寸缩放 ps-窗口缩放比例调整 bug Extjs小例子 ps-填充色 ipv4,ipv6起止地址判断,网段判断 HTML li标签排列有空白间隙 Ext.js知识点纪要 PHP 文件内容处理 知识点小纪要 function函数 常用正则表达式 正则表达式的字符含义 邮箱正则表达式 jQuery相关面试题 js继承
jq 数组对象,重复数据进行合并
rainbow727 · 2023-11-17 · via 博客园 - rainbow727

  var bindif = [{

        "ifname": "Ge0/2/1",

        "ip": "20.1.1.1",

        "mask": "255.255.255.0"

    }, {

        "ifname": "Ge0/2/5",

        "ip6addr": "2000::254"

    }, {

        "ifname": "Ge0/2/5",

        "ip": "40.1.1.1",

        "mask": "255.255.255.0"

    }];

    var result = bindif.reduce(function (precurr) {

        var exist = pre.find(function (dt) {

            return dt.ifname === curr.ifname;

        });

        if(exist) {

            if(curr.ip && exist.ip6addr){

                    exist.ip = curr.ip;

                    exist.mask = curr.mask;

            }

            if(curr.ip6addr && exist.ip){

                exist.ip6addr = curr.ip6addr;

            }

        } else {

            pre.push(curr);

        }

        return pre;

    }, []);

    console.log(result);