Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
Andrey Mikhaylov (lolmaus)
@lolmaus
@koistya Can you link to validate docs please?
Konstantin Tarkus
@koistya
though.. validate won't be replaced
@lolmaus check it out - https://www.npmjs.com/package/validator
Andrey Mikhaylov (lolmaus)
@lolmaus
@koistya Looks like dev-expression does not replace, but rather wrap. Increased performance at the cost of larger file size.
Konstantin Tarkus
@koistya
@lolmaus it adds process.env.NODE_ENV check, which is replaced by a string literal on build by webpack/browserify, which is then stripped off by js minimizer (uglifyjs)
invariant(...) -> if (process.env.NODE_ENV !== 'production') { invariant(..) } else { .. } -> if ('production' !== 'production') { invariant(..) } else { .. } -> ..
..assuming that you bundle your application code before deploying to a production server. This is considered to be a good practice if you're using ES2105+ / Babel
Andrey Mikhaylov (lolmaus)
@lolmaus
This message was deleted

@koistya validator seems to be only for strings? My goal is a universal assertion library with extremely agile syntax (e. g. you can use and, or, satisfy, etc.) and automatically generated error messages (with optional manually provided messages).

I'm not aware of an assertion library that can do this:

Assertron({name}, {           // Uses key in error messages, e. g. "name must be of length between 5 and 7, was 9"
  optional: true,             // Will not perform checks if the value is undefined
  length:   {min: 5, max: 7}, // For a POJO will count own keys.
  or: {                       // Will be true if one of the requirements is true. Keys mean type checks.
    string: {match:         /foo|bar/},
    array:  {containsOneOf: ['foo', 'bar']},
    object: {hasOneOfKeys:  ['foo', 'bar']}
  }
});

Imagine writing that in Chai or validator or whatever assertion library you like the most. you'll end up with nested ifs, it will look terrible and unreadable. And the necessity to wrap it into dev-expression makes it even worse.

Andrey Mikhaylov (lolmaus)
@lolmaus
@koistya Whatcha say?
Konstantin Tarkus
@koistya
@lolmaus something similar to what used in React (PropTypes)?
Andrey Mikhaylov (lolmaus)
@lolmaus

@koistya Probably, except for my approach is not limited to checking types. You can add whatever checks you want.

I draw inspiration from this library's assertions collection and plugins: http://unexpected.js.org/assertions/any/to-be/

I don't use Chai and Unexpected because their API is method chaining, and method chaining:

  • does not allow the or operand;
  • does not allow swapping the main assertion object with a noop.

I find a JSON-like API to be the most powerful.

What do you think?
Konstantin Tarkus
@koistya
Andrey Mikhaylov (lolmaus)
@lolmaus
@koistya Any news on debugging babel-starter-kit modules in Chrome?
Konstantin Tarkus
@koistya
@lolmaus I'm not sure if it's a good idea to include that into the kit, maybe on a separate branch..
@lolmaus it might depend to much on what exactly you're building... e.g. if you're developing React components, it might be a great idea to use react-storybook for testing in a browser
Andrey Mikhaylov (lolmaus)
@lolmaus
@koistya I'm building a generic library, useful in both Node and browser.
And I HATE developing with terminal output as the only way of debugging.
Francisco Pena
@daiky00
@daiky00
Any one can help me with this
kriasoft/react-starter-kit#682
Joel Alejandro Villarreal Bertoldi
@joelalejandro
Hey there, just left a PR for an issue I discovered with a colleague in package.json: kriasoft/babel-starter-kit#100
bala020304
@bala020304
Andrey Mikhaylov (lolmaus)
@lolmaus
@bala020304 Sending to every channel out of desperation?
Mitch Zelmanovich
@mzelmanovich
I just want to use babel so I can use import and export in node js
but it appears not to be working
any assistance i coudl get would be great
Andrey Mikhaylov (lolmaus)
@lolmaus
@mzelmanovich In order to receive help, you must be very specific and explicit about your issue.
Robert Butler
@lighth7015
so can I use this from a simple html file that includes the correct scripts and everything?
Kirk Kohler
@kirkkohler_twitter
off topic but searching the net I stumbled here.
anyone know if "web-starter-kit" by google is a dead project?
suggestions on the "replacement." not sure I need react, angular for a 1 page website i'm trying to create
Vinay
@vinaybedre
Is this repo still alive?
Andrey Mikhaylov (lolmaus)
@lolmaus
@vinaybedre Doesn't look like it. No contributions for over a year.
Vladimir Kutepov
@frenzzy
would be nice to update it but maybe it make sense to wait babel 7 release
netmajor
@netmajor

Hi, I use babel but eslint shows error 'Unexpected token :' here:

function feature (features: string | Array<string>)

How to learn Eslint that is is es6 syntax ?

Vladimir Kutepov
@frenzzy
but it is not valid javascript syntax, probably it is flow or typescript
Marco Faustinelli
@Muzietto
Very naive question... I am writing a library that will run in browsers. AFAIS the formats created by babel-start-kit are all meant for server-side libraries.
Or am I wrong?
Marco Faustinelli
@Muzietto
OK, using the umd version
but stil... I cannot see how the final "exports" is made available in the global namespace
last line in my es6 index.js is: export crosspromo from './crosspromo.js';

in the umd file it gets translated to

exports.crosspromo = crosspromo$1;
Object.defineProperty(exports, '__esModule', { value: true });

I see there is a window.exports object
but it's empty
can you see where I am doing wrong?
Marco Faustinelli
@Muzietto
found the answer
please disregard
Christian Ahidjo
@chriys
hi there, I'm using babel 7 and webpack. I would like to transform arrow function so that IE 11 doesn't throw any syntax error here are my configs http://jsbin.com/cikeluzequ/edit?js
Dinoloop
@ParallelTask

Dinoloop has been designed from the start for gradual adoption, and you can use as little or as much dinoloop as you need. Perhaps you only want to develop some "REST APIs" using dinoloop and other REST APIs can be developed using expressjs. In this section, we will show how to create dinoloop REST API to an existing express app.

Step 1: Add HomeController (file: home.controller.ts)
import { ApiController, Controller, HttpGet } from 'dinoloop';

@Controller('/home')
export class HomeController extends ApiController {

@HttpGet('/get')
get(): string {
    return 'Hello World!';
}

}
Step 2: Mount dinoloop and bind to express instance (file: app.ts)
const app = express();
app.use(bodyParser.json());

// Dino requires express instance and base-uri to which dino will be mounted
const dino = new Dino(app, '/api');

// Dino requires express router too
dino.useRouter(() => express.Router());

// Register controller
dino.registerController(HomeController);

// Bind dino to express
dino.bind();

// These are your normal express endpoints
app.get('/home', (req, res, next) => {
res.status(200).json('Hello World!');
});

app.get('/about', (req, res, next) => {
res.status(200).json('Hello World!');
});

// Start your express app
app.listen(8088, () => console.log('Server started on port 8088'));
Dinoloop is mounted on /api and all of its controller routes/endpoints which are registered with dinoloop are also mounted on /api. Dinoloop will handle those requests which are mounted on /api i.e. /api/home/get, the other end points /home and /about which are created by expressjs are not handled by dinoloop, this way you can slowly migrate your existing express app to dinoloop or you can start writing your new REST APIs using dinoloop.

please find the reference: https://github.com/ParallelTask/dinoloop

Andrey Mikhaylov (lolmaus)
@lolmaus
Wow, open source spam.