1- import utils from './utils'
1+ import { __isString , __isArray , __map , __defaults , __isObject } from './utils' ;
22
33const lib = {
44 settings : {
@@ -43,7 +43,7 @@ export function checkCurrencyFormat (format) {
4343 if ( typeof format === 'function' ) format = format ( )
4444
4545 // Format can be a string, in which case `value` ("%v") must be present:
46- if ( utils . __isString ( format ) && format . match ( '%v' ) ) {
46+ if ( __isString ( format ) && format . match ( '%v' ) ) {
4747 // Create and return positive, negative and zero formats:
4848 return {
4949 pos : format ,
@@ -54,7 +54,7 @@ export function checkCurrencyFormat (format) {
5454 // If no format, or object is missing valid positive value, use defaults:
5555 } else if ( ! format || ! format . pos || ! format . pos . match ( '%v' ) ) {
5656 // If defaults is a string, casts it to an object for faster checking next time:
57- return ! utils . __isString ( defaults )
57+ return ! __isString ( defaults )
5858 ? defaults
5959 // @ts -ignore
6060 : ( lib . settings . currency . format = {
@@ -69,8 +69,8 @@ export function checkCurrencyFormat (format) {
6969
7070export const unformat = function ( value , decimal ?) {
7171 // Recursively unformat arrays:
72- if ( utils . __isArray ( value ) ) {
73- return utils . __map ( value , function ( val ) {
72+ if ( __isArray ( value ) ) {
73+ return __map ( value , function ( val ) {
7474 return unformat ( val , decimal )
7575 } )
7676 }
@@ -127,8 +127,8 @@ export const formatNumber = function (
127127 decimal
128128) {
129129 // Resursively format arrays:
130- if ( utils . __isArray ( number ) ) {
131- return utils . __map ( number , function ( val ) {
130+ if ( __isArray ( number ) ) {
131+ return __map ( number , function ( val ) {
132132 return formatNumber ( val , precision , thousand , decimal )
133133 } )
134134 }
@@ -137,8 +137,8 @@ export const formatNumber = function (
137137 number = unformat ( number )
138138
139139 // Build options object from second param (if object) or all params, extending defaults:
140- var opts = utils . __defaults (
141- utils . __isObject ( precision )
140+ var opts = __defaults (
141+ __isObject ( precision )
142142 ? precision
143143 : {
144144 precision : precision ,
@@ -185,8 +185,8 @@ export const formatMoney = function (
185185 format
186186) {
187187 // Resursively format arrays:
188- if ( utils . __isArray ( number ) ) {
189- return utils . __map ( number , function ( val ) {
188+ if ( __isArray ( number ) ) {
189+ return __map ( number , function ( val ) {
190190 return formatMoney ( val , symbol , precision , thousand , decimal , format )
191191 } )
192192 }
@@ -195,8 +195,8 @@ export const formatMoney = function (
195195 number = unformat ( number )
196196
197197 // Build options object from second param (if object) or all params, extending defaults:
198- var opts = utils . __defaults (
199- utils . __isObject ( symbol )
198+ var opts = __defaults (
199+ __isObject ( symbol )
200200 ? symbol
201201 : {
202202 symbol : symbol ,
@@ -226,11 +226,3 @@ export const formatMoney = function (
226226 )
227227 )
228228}
229-
230- export default {
231- ...lib ,
232- unformat,
233- toFixed,
234- formatNumber,
235- formatMoney
236- }
0 commit comments