• UMD编码规范


    (function(global, factory){

    typeof module === 'object' && typeof module.exports === 'object' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) :global.PicName = factory(global);

    })(this, function(){

    var PicName = {

    log: '',

    data: {

    "pic": "000001"

    },

    find: function(id){ 

    var self = this;

    var _id = parseInt(id, 10);

    for(var k in self.data){

    var vs = self.data[k].split(',');

    self.log += ['k[vs]-', k, '{', vs, '}<br/>'].join('');

    for(var m in vs){

    self.log += ['&nbsp;&nbsp;m[vs[m]]-', m, '{', vs[m], '}<br/>'].join('');

    var vss = vs[m].split('-');

    self.log += ['&nbsp;&nbsp;&nbsp;&nbsp;m[vss]-', vss, '<br/>'].join('');

    var s = parseInt(vss[0], 10), e = parseInt(vss[1], 10);

    self.log += ['&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;m[vss[i]]-', s, '--', e, '<br/>'].join('');

    if(s === e && s === _id){

    // 单值符合-返回

    return k;

    }else{

    // 单值不符合,查找区间值

    if(s < e && s <= _id && _id <= e){

    // 区间值符合-返回

    return k;

    }else{

    // 区间值不符合-继续查找

    continue;

    }

    }

    }

    }

    },

    getName: function(id){

    return id ? (this.find(id) || 'default') : 'default';

    },

    getLog: function(){

    return this.log;

    }

    };

    return PicName;

    });

  • 相关阅读:
    合并字符串中的多个空格
    IfcSpecularRoughness
    IfcSpecularExponent
    IfcPresentableText
    IfcFontWeight
    IfcFontVariant
    uwb ifc模型定位測試
    IfcFontStyle
    IfcGeometricModelResource
    qt6安装
  • 原文地址:https://www.cnblogs.com/Super-scarlett/p/8658101.html
Copyright © 2020-2023  润新知