move some utils

master
Brad Cornes 2020-05-03 17:10:38 +01:00
parent 39733ae72a
commit 6af6797f2c
7 changed files with 13 additions and 6 deletions

View File

@ -15,7 +15,7 @@ import { isCssContext } from '../util/css'
import { findLast, findJsxStrings, arrFindLast } from '../util/find'
import { stringifyConfigValue, stringifyCss } from '../util/stringify'
import { stringifyScreen, Screen } from '../util/screens'
import isObject from '../util/isObject'
import isObject from '../../util/isObject'
import * as emmetHelper from 'vscode-emmet-helper-bundled'
import { isValidLocationForEmmetAbbreviation } from '../util/isValidLocationForEmmetAbbreviation'
import { getDocumentSettings } from '../util/getDocumentSettings'
@ -23,7 +23,7 @@ import { isJsContext } from '../util/js'
import { naturalExpand } from '../util/naturalExpand'
import semver from 'semver'
import { docsUrl } from '../util/docsUrl'
import { ensureArray } from '../util/array'
import { ensureArray } from '../../util/array'
function completionsFromClassList(
state: State,

View File

@ -2,7 +2,7 @@ const dlv = require('dlv')
import { State } from './state'
import removeMeta from './removeMeta'
import { TinyColor } from '@ctrl/tinycolor'
import { ensureArray, dedupe, flatten } from './array'
import { ensureArray, dedupe, flatten } from '../../util/array'
const COLOR_PROPS = [
'caret-color',

View File

@ -1,4 +1,4 @@
import isObject from './isObject'
import isObject from '../../util/isObject'
export default function removeMeta(obj: any): any {
let result = {}

View File

@ -1,4 +1,4 @@
import isObject from './isObject'
import isObject from '../../util/isObject'
export type MinMaxScreen = {
min?: string

View File

@ -1,7 +1,7 @@
import removeMeta from './removeMeta'
const dlv = require('dlv')
import escapeClassName from 'css.escape'
import { ensureArray } from './array'
import { ensureArray } from '../../util/array'
export function stringifyConfigValue(x: any): string {
if (typeof x === 'string') return x

View File

@ -9,3 +9,10 @@ export function ensureArray<T>(value: T | T[]): T[] {
export function flatten<T>(arrays: T[][]): T[] {
return [].concat.apply([], arrays)
}
export function equal(arr1: any[], arr2: any[]): boolean {
return (
JSON.stringify(arr1.concat([]).sort()) ===
JSON.stringify(arr2.concat([]).sort())
)
}