// let custom_attributes=[{"attribute_code":"image","value":"/9/0/90-micro-magnetic.jpg"},{"attribute_code":"url_key","value":"micro-magnetic-case"},{"attribute_code":"gift_message_available","value":"2"},{"attribute_code":"meta_title","value":"MICRO MAGNETIC CASE"},{"attribute_code":"small_image","value":"/9/0/90-micro-magnetic.jpg"},{"attribute_code":"options_container","value":"container2"},{"attribute_code":"meta_keyword","value":"MICRO MAGNETIC CASE"},{"attribute_code":"thumbnail","value":"/9/0/90-micro-magnetic.jpg"},{"attribute_code":"all_features","value":"<h2><strong>Description</strong></h2>\r\n<p>Do you need a spare or replacement case for your Micro Magnetic tracking device?</p>\r\n<p>This fully magnetic case is also compatible with your ProPod 4, to convert your tracking unit in to a magnetic GPS tracker for cars and assets. If you have an Ultra Mini tracker or an SOS Personal Tracker, this magnetic case can also be used to contain these.</p>\r\n<p>Your magnetic case will be delivered first class. Order before 3pm to receive your item the following day.</p>\r\n<h2><strong>Features</strong></h2>\r\n<ul>\r\n<li>A fully magnetic tracking case.</li>\r\n<li>Compatible with the ProPod 4, Ultra Mini Bullet/Keyring and SOS Personal Tracker.</li>\r\n</ul>"},{"attribute_code":"meta_description","value":"MICRO MAGNETIC CASE Do you need a spare or replacement case for your Micro Magnetic tracking device?\r\nThis fully magnetic case is also compatible with your ProPod 4, to convert your tracking unit in to a magnetic GPS tracker for cars and assets. If you ha"},{"attribute_code":"swatch_image","value":"/9/0/90-micro-magnetic.jpg"},{"attribute_code":"specification","value":"<ul>\r\n<li>Dimensions: 75mm x 50mm x 30mm</li>\r\n<li>Magnet strength: 34kg pull</li>\r\n</ul>"},{"attribute_code":"tax_class_id","value":"2"},{"attribute_code":"show_on_home_page_tabs","value":"0"},{"attribute_code":"show_in_tracker_app_explained","value":"0"},{"attribute_code":"insurance_trackers_explained","value":"0"},{"attribute_code":"category_ids","value":["10"]},{"attribute_code":"show_in_mapping_panel","value":"0"},{"attribute_code":"feature_listing","value":"<ul class=\"product-short-dec\">\r\n<li>Replacement case for your Micro Magnetic GPS tracker</li>\r\n<li>Upgrade your ProPod 4 unit to a magnetic car tracker</li>\r\n<li>Fully weatherproof magnetic case</li>\r\n</ul>"},{"attribute_code":"required_options","value":"0"},{"attribute_code":"has_options","value":"0"},{"attribute_code":"wk_preorder","value":"0"},{"attribute_code":"is_topupplans_show","value":"0"},{"attribute_code":"security_package","value":"0"},{"attribute_code":"is_mapping_panel_banner_show","value":"1"},{"attribute_code":"pdf_show","value":"0"},{"attribute_code":"rechargeable_battery_icon","value":"0"},{"attribute_code":"out_of_the_box","value":"0"},{"attribute_code":"is_show_installation_address","value":"0"},{"attribute_code":"can_show_category_promo_banner","value":"1"},{"attribute_code":"show_quote_form","value":"0"}]
// let lowerCaseData='micro magnetic'

// console.log(custom_attributes && custom_attributes.some(
//         (e) => e.value.toLowerCase().includes(lowerCaseData) || e.attribute_code.includes(lowerCaseData),
//       ))
let a='ACTNS1-XTR4'
let options_value = a.split('-');
  if(options_value.length>1){
    options_value.push(a)
    console.log("-->",options_value)
    options_value.push(a.split('-').join(""))
        console.log("-->",options_value)

  }else{
    let numeric_value=(a || '').match(/[0-9].*/)
    numeric_value?options_value.push(numeric_value[0]):''
  }
  
  console.log("ouptut",options_value) 
by

NodeJS Online Compiler

Write, Run & Share NodeJS code online using OneCompiler's NodeJS online compiler for free. It's one of the robust, feature-rich online compilers for NodeJS language,running on the latest LTS version NodeJS 16.14.2. Getting started with the OneCompiler's NodeJS editor is easy and fast. The editor shows sample boilerplate code when you choose language as NodeJS and start coding. You can provide the dependencies in package.json.

About NodeJS

Node.js is a free and open-source server environment. Node.js is very popular in recent times and a large number of companies like Microsoft, Paypal, Uber, Yahoo, General Electric and many others are using Node.js.

Key features

  • Built on Google chrome's javascript engine V8 and is pretty fast.
  • Node.js was developed by Ryan Dahl in 2009.
  • Server-side platform for building fast and scalable applications.
  • Node.js is Asynchronous, event-driven and works on single-thread model thus eliminating the dis-advantages of multi-thread model.
  • Supports various platforms like Windows, Linux, MacOS etc.
  • Provides rich library of java script modules which simplifies the development efforts.
  • Released under MIT license.

Express Framework

Express is one of the most popular web application framework in the NodeJS echosystem.

  • Pretty fast
  • Minimalist
  • Unopinionated
  • Very flexible

Syntax help

Examples

Using Moment

let moment = require('moment');

console.log(moment().format('MMMM Do YYYY, h:mm:ss a'));

Using Lodash

const _ = require("lodash");

let colors = ['blue', 'green', 'yellow', 'red'];

let firstElement = _.first(colors);
let lastElement = _.last(colors);

console.log(`First element: ${firstElement}`);
console.log(`Last element: ${lastElement}`);

Libraries supported

Following are the libraries supported by OneCompiler's NodeJS compiler.

  • lodash
  • moment
  • underscore
  • uuid
  • ejs
  • md5
  • url