mirror of
https://github.com/unraid/api.git
synced 2026-05-09 08:41:12 -05:00
fix: use parseInt instead of upcast
This commit is contained in:
@@ -5,15 +5,12 @@
|
||||
|
||||
import path from 'path';
|
||||
import mm from 'micromongo';
|
||||
import upcast from 'upcast';
|
||||
import { paths } from '../paths';
|
||||
import { parseConfig } from '../utils/misc';
|
||||
import { ArrayState } from './state';
|
||||
import { LooseObject } from '../types';
|
||||
import { Share } from '../types/states';
|
||||
|
||||
const to = (from: any, to: string) => upcast.to(from, to);
|
||||
|
||||
interface SharesIni {
|
||||
name: string;
|
||||
free: string;
|
||||
@@ -28,8 +25,8 @@ const parse = (state: SharesIni[]): Share[] => {
|
||||
.map(([_, item]) => {
|
||||
const { free, size, include, exclude, useCache, ...rest } = item;
|
||||
const share: Share = {
|
||||
free: to(free, 'number'),
|
||||
size: to(size, 'number'),
|
||||
free: parseInt(free, 10),
|
||||
size: parseInt(size, 10),
|
||||
include: include.split(',').filter(_ => _),
|
||||
exclude: exclude.split(',').filter(_ => _),
|
||||
cache: useCache === 'yes',
|
||||
|
||||
Reference in New Issue
Block a user