Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

trafficbroker-numb

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

trafficbroker-numb

  • 0.2.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

= numb

Returns any numbers, currency or percentages it can find.

Currencies are returned using the standard currency codes (see wikipedia for example) {:value => 10.00, :percent => true, :currency => 'EUR'} Note: Currently, 'kr' will return 'DKK' even though this is the currency symbol for Sweden, Danmark and Norway. This issue exists for other currencies as well. New Options: :require => :currency :value :percent Throws an error if the required field isn't there. Can be combined: Numb.new(:require => [:currency, :value])

:split => ['
', '//'] Splits the fields based on the passed variables in the order they are passed

:debug => true Prints out debugging info.

== Examples

Numb.new.parse("US$1.00 ") # => {:currency => 'USD', :value => 1.00}

Numb.new.parse('12.34%') # => {:percent => true, :value => 12.34}

== Supported Currencies

ALL AFN ARS AWG AUD AZN BSD BBD BYR BZD BMD BOB BAM BWP BGN BRL BND KHR CAD KYD CLP CNY COP CRC HRK CUP CZK DOP XCD EGP SVC EEK FKP FJD GHC GIP GTQ GGP GYD HNL HKD HUF ISK IDR IRR IMP ILS JMD JPY JEP KZT KPW KRW KGS LAK LVL LBP LRD CHF LTL MKD MYR MUR MXN MNT MZN NAD NPR ANG NZD NIO NGN KPW NOK OMR PKR PAB PYG PEN PHP PLN QAR RON RUB SHP SAR RSD SCR SBD SOS ZAR KRW LKR CHF SRD SYP TWD THB TTD TRY TRL TVD UAH UYU UZS VEF VND YER ZWD

== Duplicate currencies which will not correctly identify PRIMARY = { '£' => 'GBP', 'kr' => 'DKK', '$' => 'USD', '¥' => 'JPY', 'ƒ' => 'AWG', }

DUPLICATES = { '£' => ['EGP', 'FKP', 'GIP', 'GGP', 'IMP', 'JEP', 'LBP', 'SHP', 'SYP', 'EEK'], 'kr' => ['ISK', 'NOK', 'SEK'], '$' => ['ARS', 'AUD', 'BSD', 'BBD', 'BMD', 'BND', 'CAD', 'KYD', 'CLP', 'COP', 'FJD', 'GYD', 'HKD', 'LRD', 'MXN', 'NAD', 'NZD', 'SGD', 'SBD', 'SVC', 'TVD', 'SRD', 'XCD'], '¥' => 'CNY', 'ƒ' => 'ANG', }

== Copyright

Copyright (c) 2009 TrafficBroker Ltd. See LICENSE for details.

FAQs

Package last updated on 10 Aug 2014

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc