Git Product home page Git Product logo

transform's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

transform's Issues

Load local file

In the left panel we can load a file like .json from computer.

available as a node/npm module

It would be awesome if I could have a CLI version of this, takes stdin, some arguments, prints result.

Editor integration could become a thing.

Looking for maintainers

I will be busy with some other projects in coming days. This project seems to be stable in its current state but I will like to see it evolve and I will need some helping hand. Let me know if you are interested.

cc @morajabi

JSON to scala case class will produce weird case classes

In the example at https://transform.now.sh/json-to-scala-case-class, it translates a JSON array to a Scala Array. Unfortunately, Scala Array is just a wrapper for Java arrays, which have reference equality. That means that equality between case class instances produced using this tool will not have sensible equality (because distinct arrays containing the same elements will be considered different).

A simple solution would be to switch Array to Seq or IndexedSeq, which will have sensible equality.

rust snakecase handle capital names

 #[serde(rename = "Longitude")]
  _longitude: f64,

should just be

 #[serde(rename = "Longitude")]
  longitude: f64,

thanks again. saved me a ton of time.

JSON to Serde doesn't handle keywords or spaces

I guess this is two issues in one, but these are things I've noticed while trying to use it.

  1. It doesn't handle renaming keywords. I've seen this issue with APIs that will return something like
{
    "type": 1
}

Output will give you the following struct:

#[derive(Serialize, Deserialize)]
struct RootInterface {
  type: i64,
}

But it should be giving something like this:

#[derive(Serialize, Deserialize)]
struct RootInterface {
  #[serde(rename = "type")]
  kind: i64,
}
  1. Key with spaces will produce invalid Rust. For instance, the following JSON will produce the following struct with an invalid identifier:
{
  "cat dog": 1
}
#[derive(Serialize, Deserialize)]
struct RootInterface {
  "cat dog": i64,
}

Action required: Greenkeeper could not be activated 🚨

🚨 You need to enable Continuous Integration on all branches of this repository. 🚨

To enable Greenkeeper, you need to make sure that a commit status is reported on all branches. This is required by Greenkeeper because it uses your CI build statuses to figure out when to notify you about breaking changes.

Since we didn’t receive a CI status on the greenkeeper/initial branch, it’s possible that you don’t have CI set up yet. We recommend using Travis CI, but Greenkeeper will work with every other CI service as well.

If you have already set up a CI for this repository, you might need to check how it’s configured. Make sure it is set to run on all new branches. If you don’t want it to run on absolutely every branch, you can whitelist branches starting with greenkeeper/.

Once you have installed and configured CI on this repository correctly, you’ll need to re-trigger Greenkeeper’s initial pull request. To do this, please delete the greenkeeper/initial branch in this repository, and then remove and re-add this repository to the Greenkeeper integration’s white list on Github. You'll find this list on your repo or organization’s settings page, under Installed GitHub Apps.

[BAD PRACTICE] CSS to Emotion nested css`` rules

In the following example, the transformer demonstrates the following rule:

.alert-dismissible .close {
    position: relative;
    top: -0.75rem;
    right: -1.25rem;
    padding: 0.75rem 1.25rem;
    color: inherit;
}

being converted into:

export const alertDismissible = css`
  & .${close} {
    position: relative;

    top: -0.75rem;

    right: -1.25rem;

    padding: 0.75rem 1.25rem;

    color: inherit;
  }
`

This should come with a warning as, per emotions documentation:

To nest a class selector using the class generated with css you can interpolate it but this is strongly recommended against and should only be used in rare circumstances because it will break when used with composition.

Meaning that it'll break when trying to force specificity using cx

can we rollback to old behavior for json to flow transform?

there is a bunch of I before all types

example:

// @flow
export type IRootObject = {
    TargetUrl: null;
    Success: boolean;
    Result: IResult;
    Error: null;
    UnAuthorizedRequest: boolean;
};

it was like this:

export type RootObject = {
    TargetUrl: null;
    Success: boolean;
    Result: Result;
    Error: null;
    UnAuthorizedRequest: boolean;
};

Logo

After finalizing the move to our new org, we'll design logo here.

JSON keys starting with numbers produce invalid TypeScript interfaces

Transforming this JSON into TypeScript interface produces the following output:

JSON:

{
  "key_1": "foo",
  "24_hour_volume": 123.123,
  "key_2": "bar"
}

TypeScript:

interface RootInterface {
  key_1: string;
  24_hour_volume: number;
  key_2: string;
}

This produces an error in TypeScript since key names can't start with numbers in JavaScript unless they are surrounded with quotes. The fix would be to quote key names that start with numbers or other invalid characters (I'm pretty sure you can have JSON keys like "--foo", so maybe all keys that don't start with [A-z_] should be quoted.

Version on the website

Set up versioning. Show version number on the website and clicking on that should open a changelog or redirect to a changelog in new tab.

Reverse transforms

This is a really cool project. I'm wondering what the prospects are for doing reverse transforms, or converting between e.g. PropTypes to typescript interfaces (which would enable automatic typing generation for React components that have PropTypes)
Is this something that this codebase could support or is it mainly geared towards 1-way transformations?

Consider using https://www.npmjs.com/package/json-ts

If the the goal of converting JSON to typescript is to produce useful type/interfaces, then one should really choose my implementation

It supports more features that other libraries, has a simpler API, can merge multiple JSON blobs, and is more correct than any competition.

Please see the comparison table & tests for examples - if you have an interest in this, I'd be happy to send a PR

Thanks :)

Support Realm Model

Any chance to support Realm Scheme https://realm.io/docs/javascript/latest/#models

const Realm = require('realm');

const CarSchema = {
  name: 'Car',
  properties: {
    make:  'string',
    model: 'string',
    miles: {type: 'int', default: 0},
  }
};
const PersonSchema = {
  name: 'Person',
  properties: {
    name:     'string',
    birthday: 'date',
    cars:     {type: 'list', objectType: 'Car'},
    picture:  {type: 'data', optional: true}, // optional property
  }
};

// Initialize a Realm with Car and Person models
Realm.open({schema: [CarSchema, PersonSchema]})
  .then(realm => {
    // ... use the realm instance to read and modify data
  })

Thanks .

Cursor jumps to end of the text when editing invalid json

First, thanks for this awesome tool! it's been saving me a lot of time lately :D

so, i have some json that's not 100% valid
for example, i copied a js object, and i need to add quote marks around properties names
whenever i type something the cursor jumps to the end of the input
like this:
Example

it's not that bad, i can always edit the source before pasting it. but it would be easier if i could just edit on the site, given that it already has a working JSON validator.

Thanks!

[feature] jsx props to js object

for example:

<Test
  className="some-class"
  style={{ color: 'red' }}
  onClick={() => this.doSomething()}
  other
/>

becomes:

{
  className: 'some-class',
  style: { color: 'red' },
  onClick: () => this.doSomething(),
  other: true,
}

Add the option of snake case for Rust serde

Since the recommended style for Rust is snake case, there should be an option to convert field names to snake case by using serde rename attribute.

Example:

#[derive(Serialize, Deserialize)]
struct RateLimits {
  rateLimitType: String,
  interval: String,
  limit: i64,
}

#[derive(Serialize, Deserialize)]
struct RateLimits {
    #[serde(rename = "rateLimitType")]
    rate_limit_type: String,
    interval: String,
    limit: i64,
}

Suggestion: I want to add JSON to GraphQL schema

Hey @ritz078, awesome work here. I've been struggling with writing schemas for a couple of days recently and I know how it hurts 💯

I just wanted to add two other functionality to this excellent project here. I want to contribute to this as long as I can. This is the first one, if you wish I can do that.

Feature: js to JSON

Sometimes we copy js object instead of JSON:

{context:{type: "", content: "", page_index: -1})

I think we could JSON.stringify this?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.