Socket
Socket
Sign inDemoInstall

frictionless-ckan-mapper-js

Package Overview
Dependencies
0
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    frictionless-ckan-mapper-js

This is JS version of [Frictionless CKAN Mapper](https://github.com/frictionlessdata/frictionless-ckan-mapper).


Version published
Weekly downloads
2
decreased by-81.82%
Maintainers
1
Install size
155 kB
Created
Weekly downloads
 

Readme

Source

Frictionless CKAN Mapper for JS

Node.js CI

This is JS version of Frictionless CKAN Mapper.

A library for mapping CKAN metadata <=> Frictionless metadata.

Install

yarn add frictionless-ckan-mapper-js

or

npm i frictionless-ckan-mapper-js

If you use AMD, UMD, Commonjs or just need the script in browser then install via one of the above commands and then under node_modules/frictionless-ckan-mapper-js/dist/ folder you can find the appropriate frictionless-ckan-mapper.[TARGET NAME].js library. you can use frictionless-ckan-mapper.var.js to load it in the browser which brings frictionlessCkanMapper global variable

Use

In Node

const frictionlessCkanMapper = require('frictionless-ckan-mapper')

In Browser

<!DOCTYPE html>
<html>
  ...
  <script src="https://unpkg.com/frictionless-ckan-mapper-js/dist/frictionless-ckan-mapper.var.js"></script>
  <script>
    // ...
    // frictionlessCkanMapper library is available here
    // ...
  </script>
</html>

Examples

Converting frictionless resource spec to ckan package spec

const frictionlessResource = {
  name: 'data.csv',
  path: 'http://someplace.com/data.csv',
  bytes: 100,
  mediatype: 'text/csv',
}

const ckanResource = frictionlessCkanMapper.resourceFrictionlessToCkan(
  frictionlessResource
)

console.log(ckanResource)
// {
//   name: 'data.csv',
//   url: 'http://someplace.com/data.csv',
//   size: 100,
//   mimetype: 'text/csv'
// }

Converting frictionless package spec to ckan package spec

const frictionlessPackage = {
  name: 'gdp',
  description: 'Country, regional and world GDP in current USD.',
  homepage: 'https://datopian.com',
  title: 'Countries GDP',
  version: '1.0',
  newdict: { key1: 'dict_to_jsonify' },
  newint: 123,
  resources: [
    {
      name: 'data.csv',
      path: 'http://someplace.com/data.csv',
      bytes: 100,
    },
  ],
}

const ckanPackage = frictionlessCkanMapper.packageFrictionlessToCkan(
  frictionlessPackage
)

console.log(ckanPackage)
// {
//     name: 'gdp',
//     notes: 'Country, regional and world GDP in current USD.',
//     url: 'https://datopian.com',
//     title: 'Countries GDP',
//     version: '1.0',
//     extras: [
//       { key: 'newdict', value: [Object] },
//       { key: 'newint', value: 123 }
//     ],
//     resources: [
//       {
//         name: 'data.csv',
//         url: 'http://someplace.com/data.csv',
//         size: 100
//       }
//     ]
//   }

Sources

Frictionless - Mappings from Other Formats to Frictionless both Profiles and Schemas

Contributing

Please make sure to read the CONTRIBUTING.md Guide before making a pull request.

License

This project is licensed under the MIT License - see the LICENSE file for details

Keywords

FAQs

Last updated on 02 Sep 2020

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc