Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
render: {
id: struct.union(['string?', 'null']),
code: struct.union(['string?', 'null']),
map: 'object?',
descriptor: struct.union(['object', 'null'])
},
styles: struct.list([
{
id: struct.union(['string?', 'null']),
code: struct.union(['string?', 'null']),
map: 'object?',
modules: 'object?',
descriptor: struct.union(['object', 'null'])
}
]),
customBlocks: struct.list([
{
id: 'string?',
code: 'string?',
map: 'object?',
descriptor: struct.union(['object', 'null'])
}
])
})
const Config = any =>
defaultsdeep(
struct({
esModule: 'boolean?',
require: 'object?',
scopeId: 'string?',
moduleIdentifier: 'string?',
lineHeight: 'number',
})
]),
fonts: 'array',
fontSizes: 'array',
fontWeights: 'array',
lineHeights: 'array',
metadata: 'object?'
})
const Data = struct.partial({
name: 'string',
lastModified: 'string',
thumbnailUrl: 'string',
document: struct.partial({
children: struct.list([ 'object' ]),
}),
styles: struct.dict([
'string',
struct.partial({
name: 'string',
styleType: 'string',
})
])
})
const unique = arr => [...new Set(arr)]
module.exports = (data, opts = {}) => {
Data(data)
const {
styles = {},
}
const Source = struct({
script: {
id: struct.union(['string?', 'null']),
code: struct.union(['string?', 'null']),
map: 'object?',
descriptor: struct.union(['object', 'null'])
},
render: {
id: struct.union(['string?', 'null']),
code: struct.union(['string?', 'null']),
map: 'object?',
descriptor: struct.union(['object', 'null'])
},
styles: struct.list([
{
id: struct.union(['string?', 'null']),
code: struct.union(['string?', 'null']),
map: 'object?',
modules: 'object?',
descriptor: struct.union(['object', 'null'])
}
]),
customBlocks: struct.list([
{
id: 'string?',
code: 'string?',
map: 'object?',
descriptor: struct.union(['object', 'null'])
}
])